Hello, I have a tensor size of BxCxHxW that assign to cuda likes
input=input.to(device)
I have a numpy array size of HxW with the type of bool, the value in the numpy array is randomly generated by True or False. Based on the numpy array, I want to change the value in the tensor with a condition:

If the value in numpy at position x,y is True, then change the value in the tensor to zero, otherwise, keep the original value in the tensor

This is my code
import torch
import numpy as np

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
B, C, H, W=2, 2, 4, 5
input =  torch.randn(B, C, H, W)
input = input.to(device)
A_array=np.random.rand(H, W) > 0.5
print (input)
for ind_batch in range (B):
    input[ind_batch,:, A_array]=0

print (input)

For the above code, I got the error

input[ind_batch,:, A_array]=0. TypeError: can’t convert np.ndarray of type numpy.bool_. The only supported types are: double, float, float16, int64, int32, and uint8.

How could I fix it? Thanks