[JIT] Convert float Tensor argument to double in prim::tolist (#37465)
Summary:
**Summary**
Converting a float `Tensor` to a Python list is not supported because
Python's float is actually a double. This commit modifies the
implementation of `prim::tolist` so that it converts an input argument
that is a float Tensor into a double Tensor and emits a warning.
**Test Plan**
Modified and ran the corresponding unit test.
*Before*
```
======================================================================
ERROR: test_to_list (jit.test_list_dict.TestList)
Unit tests for Tensor.tolist() function.
----------------------------------------------------------------------
...
RuntimeError: The following operation failed in the TorchScript interpreter.
Traceback of TorchScript (most recent call last):
RuntimeError: Output annotation element type and runtime tensor element type must match for tolist()
----------------------------------------------------------------------
Ran 1 test in 0.151s
FAILED (errors=1)
```
*After*
```
UserWarning: Converting float Tensor to double because tolist is only supported for double type Tensors (Triggered internally at ../torch/csrc/jit/runtime/register_prim_ops_fulljit.cpp:626.)
return callable(*args, **kwargs)
.
----------------------------------------------------------------------
Ran 1 test in 0.210s
OK
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/37465
Differential Revision: D21311829
Pulled By: SplitInfinity
fbshipit-source-id: a0c1796013e35baf8d7641af271424a10e26f161