Solved by ptrblck in post #12 
              
              
                There seem to be a few minor mistakes in the code: 


h and w should probably de defined as input.size(2) and input.size(3), respectively. 
Currently you are assigning the same input value to both. However, since you are passing input directly, they can also be removed completely.
As already mention…