ptrblck:

train_sampleweights = torch.from_numpy(train_sampleweights)


Thank you for replying. Unfortunately, it gave this error:
train_sampleweights = torch.from_numpy(train_sampleweights)
TypeError: expected np.ndarray (got Tensor)

So when I print out some information on train_sampleweights, I think it may help, but I’m not sure what the class constructor wants.
train_weights = tensor([4.3002e-06, 4.3002e-06, 4.3002e-06,  ..., 4.3002e-06, 4.3002e-06, 4.3002e-06])
train_weights shape=  torch.Size([246048])