RMSprop constructor

RMSprop(
  1. List<Tensor> parameters, {
  2. required double learningRate,
  3. double beta = 0.99,
  4. double epsilon = 1e-8,
})

Implementation

RMSprop(
    super.parameters, {
      required super.learningRate,
      this.beta = 0.99,
      this.epsilon = 1e-8,
    }) {
  _s = {};
  for (Tensor param in parameters) {
    if (param.value is Vector) {
      _s[param] = List<double>.filled((param.value as Vector).length, 0.0);
    } else if (param.value is Matrix) {
      Matrix sMatrix = [];
      int numRows = (param.value as Matrix).length;
      int numCols = numRows > 0 ? (param.value as Matrix)[0].length : 0;
      for (int i = 0; i < numRows; i++) {
        sMatrix.add(List<double>.filled(numCols, 0.0));
      }
      _s[param] = sMatrix;
    }
  }
}