[BUG] argnum
of stoch_pulse_grad
applied to a tape does not work as expected/documented
#5457
Closed
1 task done
Labels
bug 🐛
Something isn't working
Expected behavior
The
argnum
kwarg of gradient transforms applied to a tape is supposed to index into the set of trainable parameters, not all tape parameters.That is, for
tape.trainable_params = [1]
andargnum=0
, the tape parameters with index1
, which also is marked as trainable, should be differentiated.Actual behavior
stoch_pulse_grad
uses theargnum
user input to index into all tape parameters. For the example above, this means that the tape parameter with index0
, which is not marked as trainable, is targeted.This is an inconsistency compared to other gradient transforms (see first code example). In addition, it disallows differentiation with respect to some parameters (see second code example).
Additional information
Will have a fix up shortly.
Source code
Tracebacks
System information
Existing GitHub issues
The text was updated successfully, but these errors were encountered: