SpectralMixtureKernel initialize_from_data CUDA bug
See original GitHub issue🐛 Bug
When running initialize_from_data
with CUDA tensors, in this line zero tensor is initialized without input device consideration, so that code fails later.
To reproduce
import torch, gpytorch
train_x = torch.tensor([1.0,2.0]).cuda()
train_y = torch.ones(2).cuda()
kernel = gpytorch.kernels.SpectralMixtureKernel(num_mixtures=4).cuda()
kernel.initialize_from_data(train_x, train_y)
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-1-419d92435b05> in <module>
3 train_y = torch.ones(2).cuda()
4 kernel = gpytorch.kernels.SpectralMixtureKernel(num_mixtures=4).cuda()
----> 5 kernel.initialize_from_data(train_x, train_y)
~/storage/miniconda2/envs/water/lib/python3.6/site-packages/gpytorch/kernels/spectral_mixture_kernel.py in initialize_from_data(self, train_x, train_y, **kwargs)
166 )
167 # Draw means from Unif(0, 0.5 / minimum distance between two points)
--> 168 self.raw_mixture_means.data.uniform_().mul_(0.5).div_(min_dist)
169 self.raw_mixture_means.data = self.raw_mixture_means_constraint.inverse_transform(self.raw_mixture_means.data)
170 # Mixture weights should be roughly the stdv of the y values divided by the number of mixtures
RuntimeError: expected backend CUDA and dtype Float but got backend CPU and dtype Float
Expected Behavior
I expected it to get device info from training data.
System information
Please complete the following information:
- GPyTorch 0.3.2
- PyTorch 1.1.0
- MacOS 10.14
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Mixed-Precision Programming with CUDA 8 - NVIDIA Developer
Specifically, these instructions operate on 16-bit floating point data (“half” or FP16) and 8- and 16-bit integer data (INT8 and INT16). The new ......
Read more >Function-Space Distributions over Kernels - arXiv
We generate 150 data points, xi ∼ U(−7., 7) randomly and then draw a random function from a GP with a two component...
Read more >Implementing a custom kernel in GPyTorch
In this notebook we are looking at how to implement a custom kernel in GPyTorch. As an example, we consider the sinc kernel....
Read more >Pattern Discovery with Gaussian Processes - Cornell University
Step 4: The spectral mixture kernel is flexible, capable of discovering many powerful representations, but the learning surface for a spectral mixture kernel...
Read more >Automating CUDA Synchronization via Program Transformation
can effectively automate synchronization for CUDA kernel functions by fixing 13 data race bugs, 5 barrier divergence bugs, and 2 redundant barrier ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@tzoiker @adam-rysanek Sorry this took an embarrassingly long time to fix for how simple it was.
85a000b should resolve the issue internally.
looks like this should’ve been closed with 85a000b