Hi when i try to use TrilinearIntepolation layer for sampling_grid and input_data with different height and width I get exception. Please take a look to a small reproducible example.
batch_size, width, height, depth = 1, 128, 128, 32
num_channels = 32
# Input data
input_data = torch.rand(batch_size, num_channels, depth, height, width).float()
sampling_grid = (torch.rand(batch_size, 256, 256, 3) - 0.5)*2.0
# create interpolation layer
trilinear_interpolation = TrilinearIntepolation()
# apply_interpolation
interpolated_data = trilinear_interpolation(input_data, sampling_grid)
print(interpolated_data.shape)
Traceback (most recent call last):
File "temp5.py", line 78, in <module>
interpolated_data = trilinear_interpolation(input_data, sampling_grid)
File "site-packages\torch\nn\modules\module.py", line 541, in __call__
result = self.forward(*input, **kwargs)
File "temp5.py", line 50, in forward
batch_size, num_chans, height, width), [u, v, w])
File "temp5.py", line 49, in <lambda>
u, v, w = map(lambda x:x.view(batch_size, 1, height, width).expand(
RuntimeError: shape '[1, 1, 128, 128]' is invalid for input of size 65536