John1231983:

mask [:,:,16:d-16, 16:h-16,16:w-16]=1.0


Hi,
I used your code and checked. I initialized input_tensor with random values. Only the values in the given region is non zero. Others are zero.
import torch

d = h = w = 64
input_tensor = torch.randn((2, 4, d, h, w))
print(input_tensor[0,0, 35, 35, 35])
print(input_tensor[0, 0, 0, 0, 0])
mask=torch.zeros_like(input_tensor)
mask [:,:,16:d-16, 16:h-16,16:w-16]=1.0
print(mask[0,0, 35, 35, 35])
print(mask[0, 0, 0, 0, 0])
input_tensor=input_tensor*mask

print(input_tensor[0,0, 35, 35, 35])
print(input_tensor[0, 0, 0, 0, 0])

If you are getting zero for all the entries, probably you may be passing a zero input_tensor as input (or at least zeros in the given region)
Thanks