Let “a” is array of [1,1,3,3] tensor having value from 1 to 50. and “b” is torch.zero tensor of same size [1,1,3,3]. “c” is array of [5] tensor.
If 1st value in tensor “c” is non zero then i want to find out value in range (0,10) from tensor “a” and replace the value of c[0] in tensor “b” of size [1,1,3,3] where tensor “a” of size [1,1,3,3] have value between (0,10).
If 2nd value in tensor “c” is non zero then i want to find out value in range (11,20) from tensor “a” and replace the value of c[1] in tensor “b” of size [1,1,3,3] where tensor “a” of size [1,1,3,3] have value between (11,20).
For example, let c=[0.1, 0.3, 0, 0.5, 1] and if a[0,0,0,0] = 9 (its between 0 to 10) then b[0,0,0,0] = 0.1 (first value of c). If a[0,0,0,0] = 39 (its between 31 to 40) then b[0,0,0,0] = 0.5 (fourth value of c).
Is there any simplest way using pytorch functions?