Trouble computing gradient of constraint function in PyTorch for SQUAT adversarial attack algorithm implementation
I am implementing the SQUAT algorithm from a research paper on adversarial attacks using Sequential Quadratic Programming (SQP). My current task involves calculating the Gradient (∇g
) of a constraint function ????(????_????) = (????_???? − 1_????.???? * ????_????)*????(????_????) ≤ 0
where C(x k)
represents the classifier’s output (a vector torch.FloatTensor torch.Size([10])
), and ????_j
is the canonical basis vector for class j.