I just copied the original code, when the batch is set to 1, there is an error says:
Traceback (most recent call last):
File "jit.py", line 209, in <module>
test_script_gru_layer(5, 1, 3, 7)
File "jit.py", line 161, in test_script_gru_layer
out, out_state = gru_jit(inp, h)
File "/home/wu/anaconda3/envs/torch/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in __call__
result = self.forward(*input, **kwargs)
RuntimeError: Dimension out of range (expected to be in range of [-1, 0], but got 1)
The above operation failed in interpreter.
Traceback (most recent call last):
File "<string>", line 10
alpha: number = 1.0):
result = torch.add(self, other, alpha=alpha)
self_size, other_size = AD_sizes_if_not_equal_multi_1(self, other, result)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
def backward(grad_output):
grad_other = (grad_output * alpha)._grad_sum_to_size(other_size)
File "<string>", line 10, in AD_sizes_if_not_equal_multi_1
alpha: number = 1.0):
result = torch.add(self, other, alpha=alpha)
self_size, other_size = AD_sizes_if_not_equal_multi_1(self, other, result)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
def backward(grad_output):
grad_other = (grad_output * alpha)._grad_sum_to_size(other_size)
File "<string>", line 10, in AD_sizes_if_not_equal_multi_1
alpha: number = 1.0):
result = torch.add(self, other, alpha=alpha)
self_size, other_size = AD_sizes_if_not_equal_multi_1(self, other, result)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
def backward(grad_output):
grad_other = (grad_output * alpha)._grad_sum_to_size(other_size)
The above operation failed in interpreter.
Traceback (most recent call last):