Solved by ptrblck in post #2 
              
              
                Could you check the stats of the input tensor as well as the parameters of the linear layer, which is causing this issue? 
E.g. if your input contains Infs or very large values in their magnitude, the result might overflow and could be set to NaN in further operations.