Solved by hamzarawal in post #3 
              
              
                Thanks K. Frank, actually the problem was with the default floating point precision. When I print the values using .item() they are indeed different but very minutely. The predicted probability values are also very small.