pytorch/torch/csrc/jit/frontend
Tugrul Ince c9023e3b12 Support left and right shift operators in JIT (#34563)
Summary:
With this PR, we can now support left and right shift operators in the JIT engine for <int, int> and <Tensor, int>.

Updated tests pass as expected:
```
> python test/test_jit.py
...
Ran 2427 tests in 84.861s

OK (skipped=139, expected failures=1)
```

Running the following code with Python results in the output below:
```
> cat ~/expressions.py
import torch

torch.jit.script
def fn(a, b):
    # type: (int, int)
    return (
        a << b,  # supported
        b >> a,  # supported
        a & b,
        a | b,
        a ^ b
    )
print(fn.graph)
```

```
> python ~/expressions.py
graph(%a.1 : int,
      %b.1 : int):
  %4 : int = aten::leftshift(%a.1, %b.1) # /home/ince/expressions.py:7:8
  %7 : int = aten::rightshift(%b.1, %a.1) # /home/ince/expressions.py:8:8
  %10 : int = aten::__and__(%a.1, %b.1) # /home/ince/expressions.py:9:8
  %13 : int = aten::__or__(%a.1, %b.1) # /home/ince/expressions.py:10:8
  %16 : int = aten::__xor__(%a.1, %b.1) # /home/ince/expressions.py:11:8
  %17 : (int, int, int, int, int) = prim::TupleConstruct(%4, %7, %10, %13, %16)
  return (%17)
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/34563

Differential Revision: D20434209

Pulled By: tugrulince

fbshipit-source-id: 886386c59755106e17b84778b8e495b80a6269cd
2020-03-13 13:00:33 -07:00
..
builtin_functions.cpp [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
builtin_functions.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
canonicalize_modified_loop.cpp
canonicalize_modified_loop.h
code_template.h
concrete_module_type.cpp [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
concrete_module_type.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
convert_to_ssa.cpp [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
convert_to_ssa.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
edit_distance.cpp [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
edit_distance.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
error_report.cpp [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
error_report.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
exit_transforms.cpp
exit_transforms.h
function_schema_parser.cpp [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
function_schema_parser.h
inline_loop_condition.cpp
inline_loop_condition.h
ir_emitter.cpp Support left and right shift operators in JIT (#34563) 2020-03-13 13:00:33 -07:00
ir_emitter.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
lexer.cpp Support left and right shift operators in JIT (#34563) 2020-03-13 13:00:33 -07:00
lexer.h Support left and right shift operators in JIT (#34563) 2020-03-13 13:00:33 -07:00
mini_environment.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
parse_string_literal.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
parser_constants.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
parser.cpp [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
parser.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
resolver.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
schema_matching.cpp [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
schema_matching.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
schema_type_parser.cpp [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
schema_type_parser.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
script_type_parser.cpp [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
script_type_parser.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
source_range.cpp improved TorchScript traceback (#33834) 2020-03-03 12:27:38 -08:00
source_range.h improved TorchScript traceback (#33834) 2020-03-03 12:27:38 -08:00
string_to_type.cpp [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
strtod.cpp [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
strtod.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
sugared_value.cpp [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
sugared_value.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
tracer.cpp Delete AT_WARN and replace all AT_WARN with TORCH_WARN (#34623) 2020-03-13 12:27:22 -07:00
tracer.h Attempt to resolve inconsistent dll linkage warnings on MSVC (#34639) 2020-03-12 11:41:02 -07:00
tree_views.h Support left and right shift operators in JIT (#34563) 2020-03-13 13:00:33 -07:00
tree.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00