A-Unified-Framework-for-Deep-Attribute-Graph-Clustering icon indicating copy to clipboard operation
A-Unified-Framework-for-Deep-Attribute-Graph-Clustering copied to clipboard

[BUG] run HSAN on cpu/cuda

Open habaneraa opened this issue 1 year ago • 0 comments

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.

habaneraa avatar Oct 12 '23 10:10 habaneraa