Solved by ptrblck in post #12 
              
              
                In the latest stable release (0.4.0) type() of a tensor no longer reflects the data type. 
You should use tensor.type() and isinstance() instead. 
Have a look at the Migration Guide for more information.