def backward(self, dEdY):
        self.dEdW = 0
        dEdX = np.zeros(self.X.shape)
        for i in range(self.X.shape[0]):
            for j in range(self.X.shape[2]):
                dEdX[i, self.argX[i, j, :], j, range(0, self.X.shape[3])] = dEdY[i, j, :]
        dEdX = dEdX.reshape(dEdX.shape[0], dEdX.shape[1] * dEdX.shape[2], dEdX.shape[3])
        if self.mod > 0:
            dEdX = dEdX[:, :-(self.windowSize - self.mod), :]
        return dEdX
Assuming the last dimension is the largest.
dataset/ETHPy150Open renmengye/imageqa-public/src/nn/maxpool1d.py/MaxPool1D.backward