pytorch-dnc
pytorch-dnc copied to clipboard
batch_first argument doesn’t work
Hi,
I just want to let you know that with current implementation (file dnc.py, line 76:86), the batch_first will always be True. It is trivial but sometime troublesome.
Have a nice day.
I think you might be right, when I set batch_first = True and I give input of shape bs x ts x n. I get this error with batch size (bs): 256
File "/home/root/pytorch/lib/python3.5/site-packages/dnc/dnc.py", line 223, in forward inputs = [T.cat([input[:, x, :], last_read], 1) for x in range(max_length)] File "/home/root/pytorch/lib/python3.5/site-packages/dnc/dnc.py", line 223, in <listcomp> inputs = [T.cat([input[:, x, :], last_read], 1) for x in range(max_length)] RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 256 and 1 in dimension 0 at /pytorch/aten/src/THC/generic/THCTensorMath.cu:71
But when I permute my input to shape ts x bs x n and set batch_first = False, I do not get the error.