generateTensor3DData function

List<List<List<double>>> generateTensor3DData(
  1. int depth,
  2. int rows,
  3. int cols
)

Implementation

List<List<List<double>>> generateTensor3DData(int depth, int rows, int cols) {
  List<List<List<double>>> data = [];
  for (int d = 0; d < depth; d = d + 1) {
    List<List<double>> matrix = <List<double>>[];
    for (int i = 0; i < rows; i = i + 1) {
      List<double> row = <double>[];
      for (int j = 0; j < cols; j = j + 1) {
        row.add(((d * rows * cols + i * cols + j) % 100).toDouble() / 100.0);
      }
      matrix.add(row);
    }
    data.add(matrix);
  }
  return data;
}