step method

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

Appends the SGD weight update operations to the provided tape. This optimizer does not require to be updated and can be reused indefinitely via the same tape execution.

Implementation

@override
void step(CommandBuffer tape) {
  for (int i = 0; i < parameters.length; i = i + 1) {
    tape.putInt(OP_SGD_UPDATE);
    tape.putString(parameters[i].id); // The weights
    tape.putString('${parameters[i].id}_grad'); // The gradients
    tape.putFloat(learningRate);
  }
}