Why there are orders of magnitude in the evaluation of torch.sin() and numpy.sin() at integer multiples of Pi?
Why are trigonometric functions of Pytorch and Numpy when evaluated at integer multiples of Pi result in such huge discrepancy in the orders of magnitude?
&gt;&gt;&gt; torch.sin(torch.ones(1)*2*np.pi)
tensor([1.7485e-07])
&gt;&gt;&gt; np.sin(np.ones(1)*2*np.pi)
array([-2.4492936e-16])


Torch defaults to 32-bit floats, while NumPy defaults to 64-bit. The rounding error you're getting in Torch is around the expected scale for 32-bit floats. Specify a different dtype if you want a different dtype.
