Thanks very much for your help. In answer to your questions:

It’s “something like x:x+width etc.” - It’s indexing a portion of the input. In fact, I think it would be more akin to x-0.5*kernel_size:x+0.5*kernel_size

Yes (or a tensor of size(number of batches x 1 x 1))
The last line isn’t really correct. My point was just that the scalar outputs need to be joined together into a 2d tensor

BTW: the pseudocode does not account for padding, but this would be necessary to ensure input and output sizes of the function are equal