Input "nan" output "-inf"

When the input tensor is “nan”, I expected the output to be “nan” as well. But after a simple Conv2d layer the output becomes “-inf”. And this is only happening with GPU. CPU works as expected. Below is a simple example.

import torch
import torch.nn as nn

x = torch.acos(1+torch.ones(1,1,3,3)) # Make a 'nan' tensor
model = nn.Conv2d(in_channels=1, out_channels=1, kernel_size=(3,3))
y = model(x)
print('input_cpu:',x)
print('output_cpu:',y)

model_gpu = model.cuda()
x_gpu = x.cuda()
y_gpu = model_gpu(x_gpu)
print('input_gpu:',x_gpu)
print('output_gpu:',y_gpu)

and the screen output is:

input_cpu: tensor([[[[nan, nan, nan],
          [nan, nan, nan],
          [nan, nan, nan]]]])
output_cpu: tensor([[[[nan]]]], grad_fn=<ThnnConv2DBackward>)
input_gpu: tensor([[[[nan, nan, nan],
          [nan, nan, nan],
          [nan, nan, nan]]]], device='cuda:0')
output_gpu: tensor([[[[-inf]]]], device='cuda:0', grad_fn=<CudnnConvolutionBackward>)

Is this a bug? How to fix this? My Pytorch version is 1.0.1