Solved by tom in post #2 
              
              
                That’s because torch::kF32 is a constant indicating a type, not a C++ type. I think you want elementSize(torch::kF32), which gives you the element size. 
Best regards 
Thomas