[ONNX] Do not use `numpy` in ONNX opsets (#65188)
authorNikita Shulga <nshulga@fb.com>
Fri, 17 Sep 2021 17:32:26 +0000 (10:32 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Fri, 17 Sep 2021 18:28:44 +0000 (11:28 -0700)
commit340531f2e0bc6b1465d4cf962d271b964bdb2041
tree02301532b044852e61f15a61a2570b4d5e495842
parent7ced25eee35e121b22e65311b4d1539671c8b630
[ONNX] Do not use `numpy` in ONNX opsets (#65188)

Summary:
Replace `torch.tensor([numpy.arange(a, b, c)])` with `torch.arange(a, b, c).unsqueeze(0)`
Replace `tuple(numpy.add(a, b))` with `tuple( x + y for (x, y) in zip(a, b)`

As `numpy` is an optional dependency, it shouldn't be used in PyTorch core by default

Pull Request resolved: https://github.com/pytorch/pytorch/pull/65188

Reviewed By: mruberry

Differential Revision: D31009490

Pulled By: malfet

fbshipit-source-id: 528e48f055bf9ac1de1fd7e94c0be41915df9a0b
torch/onnx/symbolic_opset11.py
torch/onnx/symbolic_opset9.py