Logical element-wise multiplication of tensor with another tensor

Suppose I have a tensor A of shape (128,) and two other tensors B and C, both of shape (512,). I’d like to multiply each element of A with B, whenever A is smaller than 0 and with C otherwise. This should result in a tensor of shape (128,512). Is there an “elegant” way of achieving this without involving for-loops ? As far as I am aware torch.where offers something very close to what I’d need but not quite.

Thanks in advance!