I was trying out PyTorch version 0.4.0a0+42bf2f9 and then encountered the following error, which does not happen using 0.3.1:
TypeError: initializer for ctype 'struct THFloatTensor *' must be a cdata pointer, not Variable
Specifically when loss_func()
is called:
def forward(ctx, acts, labels, act_lens, label_lens,
size_average=False, length_average=False):
is_cuda = True if acts.is_cuda else False
acts = acts.contiguous()
loss_func = warp_ctc.lib.gpu_ctc if is_cuda else warp_ctc.lib.cpu_ctc
grads = torch.zeros(acts.size()).type_as(acts)
minibatch_size = acts.size(1)
costs = torch.zeros(minibatch_size).cpu()
loss_func(acts,
grads,
labels,
label_lens,
act_lens,
minibatch_size,
costs)
(source)
The implementation for loss_func
is generated using the create_extensions function.
Since as of 0.4 Tensors are instances of torch.autograd.Variable I don’t believe this type check makes much sense.
Any info on this issue?
Thank you.