Allow ints, floats, and tensors in conditional (#18755)
authorElias Ellison <eellison@fb.com>
Thu, 4 Apr 2019 00:09:37 +0000 (17:09 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 4 Apr 2019 00:12:17 +0000 (17:12 -0700)
commitb80a4fa201d4a7755bfb82b7fbd502297cef41db
tree37c9da61c1f71e9076010127b5107e3496c57957
parent843e6234f5f87f281a487fd4f8434e07101ee3ed
Allow ints, floats, and tensors in conditional (#18755)

Summary:
Per our offline discussion, allow Tensors, ints, and floats to be casted to be bool when used in a conditional

Fix for https://github.com/pytorch/pytorch/issues/18381
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18755

Reviewed By: driazati

Differential Revision: D14752476

Pulled By: eellison

fbshipit-source-id: 149960c92afcf7e4cc4997bccc57f4e911118ff1
docs/source/jit.rst
test/test_jit.py
torch/csrc/jit/register_prim_ops.cpp
torch/csrc/jit/script/compiler.cpp