reshapeTo2DSquare() {
    const squareDim = Math.ceil(Math.sqrt(this.tensor.size))
    const reshaped = ndarray(new this.arrayType(squareDim ** 2), [squareDim, squareDim])
    reshaped.data.set(this.tensor.data)

    this.originalShape = this.tensor.shape
    this.indicesForReshaped = tensorUtils.createIndicesFor2DReshaped(this.tensor.shape, true)
    this.tensor = reshaped
    this.is2DSquareReshaped = true
  }
Reshapes data into 2D square representation (underlying data remaining contiguous)