step method

  1. @override
void step(
  1. CommandBuffer tape
)
override

Appends the Adam weight update operations to the provided tape. Increments the currentStep automatically after processing all parameters.

Implementation

@override
void step(CommandBuffer tape) {
  _stepOffsets.clear();
  for (int i = 0; i < parameters.length; i = i + 1) {
    tape.putInt(OP_ADAM_UPDATE);
    tape.putString(parameters[i].id);
    tape.putString('${parameters[i].id}_grad');
    tape.putString(mCaches[i].id);
    tape.putString(vCaches[i].id);
    tape.putFloat(learningRate);
    tape.putFloat(beta1);
    tape.putFloat(beta2);
    tape.putFloat(epsilon);
    _stepOffsets.add(tape.reserveInt()); // was: tape.putInt(currentStep);
    tape.putFloat(weightDecay);
  }
}