You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Go to utils.py
Check def optimize_linear(grad, eps, norm=np.inf) at line 198
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
The text was updated successfully, but these errors were encountered:
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:
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
The text was updated successfully, but these errors were encountered: