@alexis-jacq
thank you for your advice, but that didn’t work  because the input to g(x) is already torch.cuda.**Tensor and the problem is the weights etc are not torch.cuda.**Tensor.
@albanD @apaszke
thank you two, ok I’ll create blocks as nn.Module subclasses like the tochvision implement.
@apaszke
Is torch.cuda.RealTensor in the TypeError message equivalent to torch.cuda.FloatTensor? I couldn’t find RealTensor in the doc.