I have a tensor size of 2x4x64x64x64 (bxcxdxhxw)
I only want to compute grad ( update weight in certain region of the tensor). For example, the region from 16 to 48 in both d,h,w. So, I made a mask such as
mask=torch.zeros_like(input_tensor)
mask [:,:,16:d-16, 16:h-16,16:w-16]=1.0
input_tensor=input_tensor*mask

However, my updated weight always zero. What is happen in my code? Thanks