Difficulty casting a tensor to another type

I want to cast a tensor from torch.FloatTensor to torch.DoubleTensor

First I create a tensor:


pnts = [503.566484,512.937416,507.566474,557.514461,516.105827,550.315139,519.150589,517.935416]
pnts =array(pnts)
pnts =pnts.reshape((4, 2))
flow = tensor(pnts)

Then try casting to DoubleTensor:

flow=flow.double()
type(flow)
>>torch.Tensor

Try again:

flow=flow.type(torch.DoubleTensor)
type(flow)
>>torch.Tensor

Use t.type() instead of type(t).