Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'get_shape' Attribute #1235

Open
amissafari opened this issue May 12, 2023 · 0 comments
Open

'get_shape' Attribute #1235

amissafari opened this issue May 12, 2023 · 0 comments

Comments

@amissafari
Copy link

amissafari commented May 12, 2023

Describe the bug
when I use optimize_linear function from utils.py. I get the following error:
'numpy.ndarray' object has no attribute 'get_shape'

When I check the code there was no function definition for attribute get_shape.

To Reproduce
Steps to reproduce the behavior:

  1. Go to utils.py
  2. Check def optimize_linear(grad, eps, norm=np.inf) at line 198
  3. I used optimize_linear in the following code:
    def F_FGM (dncnn_model,
    x,r,c,val,
    eps,
    norm,
    ):
    grad = F_Gradient (dncnn_model,x,r,c,val,0.0001)
    optimal_perturbation = optimize_linear(grad, eps, norm)
    %% Add perturbation to original example to obtain adversarial example
    adv_x = x + optimal_perturbation.numpy()
    return adv_x
    z1 = z + np.linalg.norm(z)F_FGM(dncnn_model,z,r,c,val_label[i,:,:],np.linalg.norm(x)/SS,2)/(SSnp.linalg.norm(F_FGM(dncnn_model,z,r,c,val_label[i,:,:],np.linalg.norm(x)/SS,2)))

Note: The dncnn is my CNN network.

Expected behavior
Code runs without issue and create a perturbed signal

System configuration

  • OS: Windows 10
  • Python version 3.9.16
  • TensorFlow version 2.10.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant