I tried to run HSAN on cpu ( args.device is "cpu") but an exception was raised.
I noticed that .cuda() methods are called on the pytorch tensors pos_weight/pos_neg_weight when creating HardSampleAwareNetwork instance. All tensors should respect the args.device and all model parameters should be moved as a whole between CPU and GPU. PyTorch would move all registered parameters when .to(device) is called on a module. So I think maybe we should treat pos_weight/pos_neg_weight as parameters of the HSAN module.
I tried to run HSAN on cpu ( args.device is "cpu") but an exception was raised.
I noticed that
.cuda()
methods are called on the pytorch tensorspos_weight
/pos_neg_weight
when creatingHardSampleAwareNetwork
instance. All tensors should respect theargs.device
and all model parameters should be moved as a whole between CPU and GPU. PyTorch would move all registered parameters when.to(device)
is called on a module. So I think maybe we should treatpos_weight
/pos_neg_weight
as parameters of the HSAN module.