Closed filbart closed 6 years ago
Converting standard types to Torch tensors is a bit messy and often leads to bugs such as this one. As a workaround, replace attack(image, label)
with attack(image, np.array(label, dtype=np.int64))
.
Works like a charm, thanks!
Thanks for reporting and thanks for the work-around! I fixed this problem in master.
Hello, I've run into a similiar issue as #194 while trying to run example code. I am recieving a following error while creating the attack ( adversarial = attack(image, label) )
RuntimeError: Expected object of type torch.LongTensor but found type torch.IntTensor for argument #2 'target'
I've checked and updated versions of foolbox, torch, torchvision, numpy and scipy. Also tried rewriting the example slightly (code below), still getting the same error.