ZhaoZhibin / UDTL

Source codes for the paper "Applications of Unsupervised Deep Transfer Learning to Intelligent Fault Diagnosis: A Survey and Comparative Study" published in TIM
MIT License
400 stars 103 forks source link

The size of tensor a (20) must match the size of tensor b (64) at non-singleton dimension 1 #6

Closed tckwgd closed 2 years ago

tckwgd commented 2 years ago

after 1024 data, the source becomes 20 and the target becomes 64, not equal. I am thinking it was the problem of dataloader

ZhaoZhibin commented 2 years ago

Can you describe the problem more clearly. We have not had this problem

tckwgd commented 2 years ago

thank you for your response, I mean there are 1044 source_train data(CWRU), if I set batch size is 64 or 128, after 1024 data passed, there will be 20 data left, as 1044-1024=20. Of course, I can drop 20 data to solve the problem, but doing so will cost me some data, as I just use 1024 data, not 1044. I met the problem only when use the distance loss, e.g.mk-mmd, but of course I can solve the problem as this: XX = torch.mean(kernels[:batch_size, :batch_size])