_createIndexMap(indicesForReshaped) {
    if (this.indexMap) {
      return
    }

    let [inputRows, inputCols, inputChannels] = this.inputShape

    let indices = new Tensor(indicesForReshaped.data, indicesForReshaped.shape, { type: Int32Array })

    // padding for border mode 'same'
    if (this.padding === 'same') {
      const [paddingRowBefore, paddingRowAfter, paddingColBefore, paddingColAfter] = this.inputPadding
      inputRows = inputRows + paddingRowBefore + paddingRowAfter
      inputCols = inputCols + paddingColBefore + paddingColAfter
      const padValue = -1
      indices = this._padInput(indices, padValue)
    }

    const nbRow = this.kernelShape[1]
    const nbCol = this.kernelShape[2]
    const outputRows = this.outputShape[0]
    const outputCols = this.outputShape[1]
    const nbPatches = outputRows * outputCols
    const patchLen = nbRow * nbCol * inputChannels

    // effective shape after filter dilation
    const nbRowDilated = nbRow + (nbRow - 1) * (this.dilationRate[0] - 1)
    const nbColDilated = nbCol + (nbCol - 1) * (this.dilationRate[1] - 1)

    this.indexMap = new Tensor([], [nbPatches, patchLen], { type: Int32Array })

    const indicesPatch = new Tensor([], [nbRow, nbCol, inputChannels])
    let offset = 0
    for (let i = 0, limit = inputRows - nbRowDilated; i <= limit; i += this.strides[0]) {
      for (let j = 0, limit = inputCols - nbColDilated; j <= limit; j += this.strides[1]) {
        ops.assign(
          indicesPatch.tensor,
          indices.tensor
            .hi(i + nbRowDilated, j + nbColDilated, inputChannels)
            .lo(i, j, 0)
            .step(this.dilationRate[0], this.dilationRate[1], 1)
        )
        this.indexMap.tensor.data.set(indicesPatch.tensor.data, offset)
        offset += patchLen
      }
    }

    this.indexMap.createGLTexture({ type: '2d', format: 'int', supportsTextureFragments: true })
  }
Creates a index mapping from the 2D-reshaped input tensor with associated 3D tensor shape to the representation
required prior to the matrix multiply. This allows us to work directly on the 2D tensor representations rather
than needing to reshape to the 3D reprentation and calling im2col.

@param {Object} indicesForReshaped