nlsde-safety-team / DualAttentionAttack

53 stars 9 forks source link

Tensor size #16

Open neilsambhu opened 1 year ago

neilsambhu commented 1 year ago

For src/train.py, how do I resolve the dimension error when the cal_texture function returns?

texture_origin.size(): torch.Size([1, 23145, 6, 6, 6, 3])
texture_mask.size(): torch.Size([1, 23145, 6, 6, 6, 3])
textures.size(): torch.Size([647, 646, 3])
Traceback (most recent call last):
  File "src/train.py", line 378, in <module>
    run_cam(train_dir, EPOCH)
  File "src/train.py", line 262, in run_cam
    textures = cal_texture()
  File "src/train.py", line 239, in cal_texture
    return texture_origin * (1 - texture_mask) + texture_mask * textures
RuntimeError: The size of tensor a (6) must match the size of tensor b (646) at non-singleton dimension 4

My personal train.py: https://github.com/neilsambhu/DualAttentionAttack/blob/NeilBranch0/src/train.py How I call train.py: https://github.com/neilsambhu/DualAttentionAttack/blob/NeilBranch0/run_custom/train.sh