Skip to content

RuntimeError: The size of tensor a (2) must match the size of tensor b (10) at non-singleton dimension 0 #4

Description

@Joanna-0421

When running the main_dftnd file, the following error occurs, I hope you can help me. Thank you.

RuntimeError: Caught RuntimeError in replica 0 on device 0.
Original Traceback (most recent call last):
File "/home/kemove/anaconda3/envs/pytorch_1_10/lib/python3.8/site-packages/torch/nn/parallel/parallel_apply.py", line 61, in _worker
output = module(*input, **kwargs)
File "/home/kemove/anaconda3/envs/pytorch_1_10/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/data/workplace/ziyuan/TrojanNetDetector-master/DFTND/robustness_lib/robustness/attacker.py", line 290, in forward
adv = self.attacker(inp, target, **attacker_kwargs)
File "/home/kemove/anaconda3/envs/pytorch_1_10/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/data/workplace/ziyuan/TrojanNetDetector-master/DFTND/robustness_lib/robustness/attacker.py", line 273, in forward
adv_ret = get_adv_examples(x)
File "/data/workplace/ziyuan/TrojanNetDetector-master/DFTND/robustness_lib/robustness/attacker.py", line 128, in get_adv_examples
losses = losses * W1
RuntimeError: The size of tensor a (2) must match the size of tensor b (10) at non-singleton dimension 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions