Solved by jpeg729 in post #2 
              
              
                The default tensor constructor only allocates a block of memory, it doesn’t overwrite it. So you get a NaN when the underlying memory contains a NaN.