tianzheng4 / Distributionally-Adversarial-Attack

AAAI 2019 oral presentation
Other
50 stars 12 forks source link

Dimensional problem in blob_rand.py #2

Closed antonyalexos closed 4 years ago

antonyalexos commented 4 years ago

This is the error that is produced:

ValueError: A 2-dimensional array must be passed.

in the file blob_rand.py in line: sq_dist = pdist(theta) It seems that this comes from: kxy, dxkxy = self.svgd_kernel(x_adv)

x_adv contains the images which are 4 dimensional((batch_size, 28, 28, 1)). Do you have any idea about it?

Darylnn commented 4 years ago

Hi, I am also facing the same error. May I ask how did you fix it in the end?

antonyalexos commented 4 years ago

Sorry man, it's been a long time and I don't have the code available. I think that if you try to run the code in the repository it kind of runs. Maybe it was the way that I imported the data. I don't remember tbh

tianzheng4 commented 4 years ago

Hi, I am also facing the same error. May I ask how did you fix it in the end?

Hi, you can simply reshape input array into (-1, 784), and then reshape the output into (-1, 28, 28, 1).

Darylnn commented 4 years ago

Thank you for responding! The truth is, I am facing the problem trying to use the svgdkernel( ) function in the blob_rand.py file for the CIFAR10 dataset using the model.py from https://github.com/MadryLab/cifar10_challenge. However, as the cifar10 dataset is in the format (10000, 32, 32, 3), could you help me in making it 2-dimensional for this line?

sq_dist = pdist(theta)