PyTorch modules expect inputs with the batch dimension in dim0 (there are some exceptions in e.g. RNNs, but this is not interesting for your model). Since you are indexing the [500, 42, 51] tensor in dim0 and are passing the input as [42, 51] the batch size would be 42. Is this expected?
from_numpy() keeps the dtype and since numpy uses float64 by default, you would need to transform it to float32 (the default in PyTorch) via tensor = tensor.float() or transform your model parameters via model.double() (I would use the former approach, as float64 is usually not needed in ML/DL and would slow down your code).