zahra:

self.fc1 = nn.Linear(rows_num_after_convolution, 1).to(torch.device(“cuda:0”), dtype=torch.half, non_blocking=True)


@zahra Can you share how you are using the input.
model = CNNModel()
input = torch.ones((1,4), device='cuda', dtype=torch.half)
output = model(input)
print(output)

This works perfectly fine for me with your Model.