Erro on calling nn.ReLU

Getting the following error:
RuntimeError: bool value of Tensor with more than one value is ambiguous

on running:

nn.ReLU(torch.nand(2))

2 Likes

nn.ReLU() create a class. You should assign it to a variable and use an input on this instance:

relu = nn.ReLU()
output = relu(x)

Alternatively you could use the functional API:

output = F.relu(x)
4 Likes