Skip to content

'get_shape' Attribute #1235

Open
Open
@amissafari

Description

@amissafari

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions