Pytorch loss error help please

for epoch in range(0, 300):
    out1 = net(X)

“Found dtype Long but expected Float” help!

Hi @PARDUS, Most likely your tensors are Long type but should be Float type. Could you share part of the code that has loss, optimizer, network initialization and your input for the network.

loss = nn.BCELoss()
optim = torch.optim.Adam(net.parameters())

(X: tensor([44., 76., 47., …, 21., 68., 46.]), y: tensor([0, 1, 0, …, 1, 0, 1]))

lossf = loss(out, y)

Try changing the input tensor X to type float. Something like this:

x = torch.tensor([44.,76.,57.,...,21.,68.,46.], dtype=torch.float32)

Could you also copy and paste what the full error - that has information on which line of code is giving - is? (full traceback of error is better)