reshapeFrom2DSquare() {
    if (!this.is2DSquareReshaped) {
      throw new Error('[Tensor] not in reshaped 2D square representation.')
    }
    if (!this.originalShape) {
      throw new Error('[Tensor] does not contain originalShape.')
    }

    const size = this.originalShape.reduce((a, b) => a * b, 1)
    const reshaped = ndarray(new this.arrayType(size), this.originalShape)
    reshaped.data.set(this.tensor.data.subarray(0, size))

    this.tensor = reshaped
  }
Reshapes tensor in 2D square representation back to original (underlying data remains contiguous)