Solved by ptrblck in post #2 
              
              
                Your second code snippet is unfortunately not executable (the first one is and works fine), so I guess some of the input tensors do not have the float32 dtype and raise this error. Check the types of all tensors in your training loop and make sure they are floating point types.