Skip to content

Add functions add/sub/rsub/mul/div that accept a scalar as first arg#29602

Closed
xuhdev wants to merge 42 commits intogh/xuhdev/52/basefrom
gh/xuhdev/52/head
Closed

Add functions add/sub/rsub/mul/div that accept a scalar as first arg#29602
xuhdev wants to merge 42 commits intogh/xuhdev/52/basefrom
gh/xuhdev/52/head

Conversation

@xuhdev
Copy link
Collaborator

@xuhdev xuhdev commented Nov 11, 2019

Stack from ghstack:

Because #29238 removes special processing of add/sub/rsub/mul/div, calls like torch.add(Scalar, Tensor) will not be automatically translated to torch.add(Tensor, Tensor). Therefore, we explicitly overload these ops with a scalar as their first arg.

… first arg"


Because #29238 removes special processing of `add/sub/rsub/mul/div`, calls like `torch.add(Scalar, Tensor)` will not be automatically translated to `torch.add(Tensor, Tensor)`. Therefore, we explicitly overload these ops with a scalar as their first arg.


[ghstack-poisoned]
… first arg"


Because #29238 removes special processing of `add/sub/rsub/mul/div`, calls like `torch.add(Scalar, Tensor)` will not be automatically translated to `torch.add(Tensor, Tensor)`. Therefore, we explicitly overload these ops with a scalar as their first arg.


[ghstack-poisoned]
Copy link
Contributor

@ailzhang ailzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmmm this is a lot of overloads...
I'd take a step back and do the design carefully first.
There are two benefits of having this PR:

  1. Currently in C++ frontend torch::add(1, tensor) doesn't compile. This PR will solve that.
  2. This PR combines the next in the stack together will remove the hack in python_args_parser where we convert a scalar directly to a tensor.
    My main concern about this PR is:
  3. Number of overloads added and the future maintenance burden with it.
    cc: @ezyang @gchanan @yf225 to comment here.
    (Sorry I'm not really requesting changes but to make sure we don't proceed without a design.

@ailzhang ailzhang requested review from ezyang and yf225 November 12, 2019 01:44
@ezyang
Copy link
Contributor

ezyang commented Nov 12, 2019

I shouldn't make the call here, but my 2c is that for binary ops, it seems acceptable to me to have (Tensor, Tensor), (Tensor, Scalar) and (Scalar, Tensor) overloads; it's a similar situation to how Python magic methods have __add__ and __radd__. If we get ops with a lot more arguments, doing every permutations of scalars is a much harder sell, but fortunately, we don't support scalars for those anyway!

@yf225
Copy link
Contributor

yf225 commented Nov 12, 2019

I think this is an important addition for Python/C++ API parity, otherwise there will be friction and ongoing maintenance overhead if the user has to translate Python code torch.add(1, tensor) to C++ code torch::add(tensor, 1), as we have to think whether this is strictly equivalent to the Python version every time we look at the C++ code.

@nairbv
Copy link
Collaborator

nairbv commented Nov 12, 2019

Is there some other approach we can take with this, even if it's not an immediate change in this PR but something to think about for refactoring longer-term?

I could imagine having functions be polymorphic in some way where we don't have to define any functions as accepting Scalar (other than in cases where they explicitly do not accept tensors). I'd think any function that can accept a tensor parameter should also be able to accept a scalar, and have it be interpreted as a zero-dim "wrapped number" tensor without extra handling or interfaces.

It's odd to me that we can torch.pow(tensor, scalar), torch.pow(scalar,tensor), but not torch.pow(scalar, scalar). If we rely on implementing every combination manually, we'll always have some gaps. I know it's probably uncommon to want to use torch.pow() on two scalars, but consistency helps keep user code generic across inputs. I imagine there are at least a few ways we could solve for this.

@nairbv
Copy link
Collaborator

nairbv commented Nov 12, 2019

Also, I think these new interfaces would need to be handled in shape_analysis.cpp?

@xuhdev
Copy link
Collaborator Author

xuhdev commented Nov 12, 2019

@nairbv We might be able to use some templating with some helpers, but I think that might likely also require some other changes in how function declarations are generated...

@ezyang
Copy link
Contributor

ezyang commented Nov 13, 2019

I mean, we can talk all we want about how exactly the C++ API should be implemented, but at the end of the day, we still need to actually implement kernels for each of the overloads. This isn't evident from this PR because it's still using the old mechanism (wrap_scalar_tensor), but my understanding from performance discussion is that we don't want to be doing this if we want to speed up our scalar operations.

variants: function
supports_named_tensor: True

- func: rsub.Scalar2(Scalar other, Tensor self, Scalar alpha=1) -> Tensor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need rsub? Why would I call this in C++? Is it necessary for the python binding later?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need rsub (including the original ones), but we may need rsub_. I added merely because there are rsubs before. I can attempt to delete the existing rsubs if they are truly unecessary.

}

Tensor sub(Scalar other, const Tensor& self, Scalar alpha) {
return native::sub(wrapped_scalar_tensor(other), self, alpha);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is wrong, same as add.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is correct? It is different from add.

… first arg"


Because #29238 removes special processing of `add/sub/rsub/mul/div`, calls like `torch.add(Scalar, Tensor)` will not be automatically translated to `torch.add(Tensor, Tensor)`. Therefore, we explicitly overload these ops with a scalar as their first arg.


[ghstack-poisoned]
… first arg"


Because #29238 removes special processing of `add/sub/rsub/mul/div`, calls like `torch.add(Scalar, Tensor)` will not be automatically translated to `torch.add(Tensor, Tensor)`. Therefore, we explicitly overload these ops with a scalar as their first arg.


[ghstack-poisoned]
@ezyang ezyang removed their request for review November 18, 2019 14:57
@ezyang
Copy link
Contributor

ezyang commented Nov 18, 2019

Removing myself from reviewer list. If there's something specific you want me to look at let me know.

… first arg"


Because #29238 removes special processing of `add/sub/rsub/mul/div`, calls like `torch.add(Scalar, Tensor)` will not be automatically translated to `torch.add(Tensor, Tensor)`. Therefore, we explicitly overload these ops with a scalar as their first arg.


[ghstack-poisoned]
… first arg"


Because #29238 removes special processing of `add/sub/rsub/mul/div`, calls like `torch.add(Scalar, Tensor)` will not be automatically translated to `torch.add(Tensor, Tensor)`. Therefore, we explicitly overload these ops with a scalar as their first arg.


[ghstack-poisoned]
@kostmo
Copy link
Member

kostmo commented Jan 16, 2020

💊 CircleCI build failures summary and remediations

As of commit 4a47c6c (more details on the Dr. CI page):


  • 13/14 failures introduced in this PR

  • 1/14 broken upstream at merge base 6b5740c since Mar 24

    Please rebase on the viable/strict branch (expand for instructions)

    If your commit is newer than viable/strict, you can try basing on an older, stable commit:

    git fetch https://github.com/pytorch/pytorch viable/strict
    git rebase --onto FETCH_HEAD $(git merge-base origin/master HEAD)
    

    If your commit is older than viable/strict:

    git fetch https://github.com/pytorch/pytorch viable/strict
    git rebase FETCH_HEAD
    

    Check out the recency history of this "viable master" tracking branch.


🕵️ 12 new failures recognized by patterns

The following build failures do not appear to be due to upstream breakages:

See CircleCI build pytorch_ios_11_2_1_x86_64_build (1/12)

Step: "Run Simulator Tests" (full log | pattern match details)

[!] Tests have failed
[21:30:08]: ▸ Loading... 
[21:32:08]: Exit status: 65 
+--------------------+---+ 
|      Test Results      | 
+--------------------+---+ 
| Number of tests    | 1 | 
| Number of failures | 1 | 
+--------------------+---+ 
 
 
[!] Tests have failed 
 
####################################################################### 
# fastlane 2.144.0 is available. You are on 2.140.0. 
# You should use the latest version. 
# Please update using `sudo gem install fastlane`. 
####################################################################### 

See CircleCI build pytorch_linux_xenial_py3_6_gcc5_4_ge_config_simple_test (2/12)

Step: "Test" (full log | pattern match details)

Mar 24 22:25:07 RuntimeError: test_jit_simple failed!
Mar 24 22:25:07 Generated XML report: test-reports/python-unittest/TEST-jit.test_models.TestModels-20200324222356.xml 
Mar 24 22:25:07 Generated XML report: test-reports/python-unittest/TEST-jit.test_builtins.TestTensorBuiltins-20200324222356.xml 
Mar 24 22:25:07 Generated XML report: test-reports/python-unittest/TEST-jit.test_autodiff_subgraph_slicing.TestAutodiffSubgraphSlicing-20200324222356.xml 
Mar 24 22:25:07 Generated XML report: test-reports/python-unittest/TEST-jit.test_data_parallel.TestDataParallel-20200324222356.xml 
Mar 24 22:25:07 Generated XML report: test-reports/python-unittest/TEST-test_jit.TestDocs-20200324222356.xml 
Mar 24 22:25:07 Traceback (most recent call last): 
Mar 24 22:25:07   File "test/run_test.py", line 682, in <module> 
Mar 24 22:25:07     main() 
Mar 24 22:25:07   File "test/run_test.py", line 675, in main 
Mar 24 22:25:07     raise RuntimeError(message) 
Mar 24 22:25:07 RuntimeError: test_jit_simple failed! 
Mar 24 22:25:07 + cleanup 
Mar 24 22:25:07 + retcode=1 
Mar 24 22:25:07 + set +x 
retrieving test reports 

See CircleCI build pytorch_linux_xenial_py3_6_gcc5_4_ge_config_legacy_test (3/12)

Step: "Test" (full log | pattern match details)

Mar 24 22:25:11 Arguments for call are not valid.
Mar 24 22:25:11 Traceback (most recent call last): 
Mar 24 22:25:11   File "/var/lib/jenkins/workspace/test/test_jit.py", line 17394, in test_torchscript_multi_head_attn 
Mar 24 22:25:11     attn_mask=None           # type: Optional[Tensor] 
Mar 24 22:25:11   File "/opt/conda/lib/python3.6/site-packages/torch/jit/__init__.py", line 1296, in script 
Mar 24 22:25:11     fn = torch._C._jit_script_compile(qualified_name, ast, _rcb, get_default_args(obj)) 
Mar 24 22:25:11   File "/opt/conda/lib/python3.6/site-packages/torch/jit/_recursive.py", line 568, in try_compile_fn 
Mar 24 22:25:11     return torch.jit.script(fn, _rcb=rcb) 
Mar 24 22:25:11   File "/opt/conda/lib/python3.6/site-packages/torch/jit/__init__.py", line 1296, in script 
Mar 24 22:25:11     fn = torch._C._jit_script_compile(qualified_name, ast, _rcb, get_default_args(obj)) 
Mar 24 22:25:11 RuntimeError:  
Mar 24 22:25:11 Arguments for call are not valid. 
Mar 24 22:25:11 The following variants are available: 
Mar 24 22:25:11    
Mar 24 22:25:11   aten::ne.Tensor(Tensor self, Tensor other) -> (Tensor): 
Mar 24 22:25:11   Expected a value of type 'Tensor' for argument 'self' but instead found type 'List[int]'. 
Mar 24 22:25:11    
Mar 24 22:25:11   aten::ne.Scalar(Tensor self, Scalar other) -> (Tensor): 
Mar 24 22:25:11   Expected a value of type 'Tensor' for argument 'self' but instead found type 'List[int]'. 
Mar 24 22:25:11    
Mar 24 22:25:11   aten::ne.Tensor_out(Tensor self, Tensor other, *, Tensor(a!) out) -> (Tensor(a!)): 
Mar 24 22:25:11   Expected a value of type 'Tensor' for argument 'self' but instead found type 'List[int]'. 

See CircleCI build pytorch_python_doc_push (4/12)

Step: "Doc Build and Push" (full log | pattern match details)

Mar 24 22:31:23 There is a programmable error in your configuration file:
Mar 24 22:31:22 Saved activation image for GELU() at /var/lib/jenkins/workspace/docs/source/scripts/activation_images/GELU.png 
Mar 24 22:31:22 Saved activation image for Sigmoid() at /var/lib/jenkins/workspace/docs/source/scripts/activation_images/Sigmoid.png 
Mar 24 22:31:22 Saved activation image for Softplus(beta=1, threshold=20) at /var/lib/jenkins/workspace/docs/source/scripts/activation_images/Softplus.png 
Mar 24 22:31:22 Saved activation image for Softshrink(0.5) at /var/lib/jenkins/workspace/docs/source/scripts/activation_images/Softshrink.png 
Mar 24 22:31:22 Saved activation image for Softsign() at /var/lib/jenkins/workspace/docs/source/scripts/activation_images/Softsign.png 
Mar 24 22:31:22 Saved activation image for Tanh() at /var/lib/jenkins/workspace/docs/source/scripts/activation_images/Tanh.png 
Mar 24 22:31:22 Saved activation image for Tanhshrink() at /var/lib/jenkins/workspace/docs/source/scripts/activation_images/Tanhshrink.png 
Mar 24 22:31:23 Running Sphinx v2.4.4 
Mar 24 22:31:23  
Mar 24 22:31:23 Configuration error: 
Mar 24 22:31:23 There is a programmable error in your configuration file: 
Mar 24 22:31:23  
Mar 24 22:31:23 Traceback (most recent call last): 
Mar 24 22:31:23   File "/opt/conda/lib/python3.6/site-packages/sphinx/config.py", line 348, in eval_config_file 
Mar 24 22:31:23     execfile_(filename, namespace) 
Mar 24 22:31:23   File "/opt/conda/lib/python3.6/site-packages/sphinx/util/pycompat.py", line 81, in execfile_ 
Mar 24 22:31:23     exec(code, _globals) 
Mar 24 22:31:23   File "/var/lib/jenkins/workspace/docs/source/conf.py", line 27, in <module> 
Mar 24 22:31:23     import torchvision  # noqa: F401 
Mar 24 22:31:23   File "/opt/conda/lib/python3.6/site-packages/torchvision-0.6.0a0+3c254fb-py3.6-linux-x86_64.egg/torchvision/__init__.py", line 3, in <module> 
Mar 24 22:31:23     from torchvision import models 

See CircleCI build caffe2_onnx_py2_gcc5_ubuntu16_04_test (5/12)

Step: "Test" (full log | pattern match details)

Mar 24 22:33:26 ../.local/lib/python2.7/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_op_jit FAILED [ 86%]
Mar 24 22:33:24 ../.local/lib/python2.7/site-packages/caffe2/python/operator_test/integral_image_ops_test.py::TestIntegralImageOps::test_integral_image_ops PASSED [ 85%] 
Mar 24 22:33:24 ../.local/lib/python2.7/site-packages/caffe2/python/operator_test/jsd_ops_test.py::TestJSDOps::test_bernoulli_jsd PASSED [ 85%] 
Mar 24 22:33:24 ../.local/lib/python2.7/site-packages/caffe2/python/operator_test/key_split_ops_test.py::TestKeySplitOps::test_key_split_op PASSED [ 85%] 
Mar 24 22:33:25 ../.local/lib/python2.7/site-packages/caffe2/python/operator_test/lars_test.py::TestLars::test_lars PASSED [ 85%] 
Mar 24 22:33:25 ../.local/lib/python2.7/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_brew_wrapper PASSED [ 85%] 
Mar 24 22:33:25 ../.local/lib/python2.7/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_grad PASSED [ 85%] 
Mar 24 22:33:26 ../.local/lib/python2.7/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_grad_op PASSED [ 85%] 
Mar 24 22:33:26 ../.local/lib/python2.7/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_op PASSED [ 86%] 
Mar 24 22:33:26 ../.local/lib/python2.7/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_op_c10 PASSED [ 86%] 
Mar 24 22:33:26 ../.local/lib/python2.7/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_op_c10_preallocated_outputs PASSED [ 86%] 
Mar 24 22:33:26 ../.local/lib/python2.7/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_op_jit FAILED [ 86%] 
Mar 24 22:33:26  
Mar 24 22:33:26 =================================== FAILURES =================================== 
Mar 24 22:33:26 ____________________ TestLayerNormOp.test_layer_norm_op_jit ____________________ 
Mar 24 22:33:26  
Mar 24 22:33:26 self = <caffe2.python.operator_test.layer_norm_op_test.TestLayerNormOp testMethod=test_layer_norm_op_jit> 
Mar 24 22:33:26  
Mar 24 22:33:26     @given(X=hu.tensor(min_dim=2), 
Mar 24 22:33:26 >          eps=st.floats(1e-5, 1e-3), 
Mar 24 22:33:26            elementwise_affine=st.booleans(), 
Mar 24 22:33:26            **hu.gcs) 

See CircleCI build caffe2_onnx_ort2_py3_6_clang7_ubuntu16_04_test (6/12)

Step: "Test" (full log | pattern match details)

Mar 24 22:34:13 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_op_jit FAILED [ 86%]
Mar 24 22:34:11 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/integral_image_ops_test.py::TestIntegralImageOps::test_integral_image_ops PASSED [ 85%] 
Mar 24 22:34:11 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/jsd_ops_test.py::TestJSDOps::test_bernoulli_jsd PASSED [ 85%] 
Mar 24 22:34:11 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/key_split_ops_test.py::TestKeySplitOps::test_key_split_op PASSED [ 85%] 
Mar 24 22:34:12 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/lars_test.py::TestLars::test_lars PASSED [ 85%] 
Mar 24 22:34:12 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_brew_wrapper PASSED [ 85%] 
Mar 24 22:34:12 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_grad PASSED [ 85%] 
Mar 24 22:34:13 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_grad_op PASSED [ 85%] 
Mar 24 22:34:13 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_op PASSED [ 86%] 
Mar 24 22:34:13 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_op_c10 PASSED [ 86%] 
Mar 24 22:34:13 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_op_c10_preallocated_outputs PASSED [ 86%] 
Mar 24 22:34:13 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_op_jit FAILED [ 86%] 
Mar 24 22:34:13  
Mar 24 22:34:13 =================================== FAILURES =================================== 
Mar 24 22:34:13 ____________________ TestLayerNormOp.test_layer_norm_op_jit ____________________ 
Mar 24 22:34:13  
Mar 24 22:34:13 self = <caffe2.python.operator_test.layer_norm_op_test.TestLayerNormOp testMethod=test_layer_norm_op_jit> 
Mar 24 22:34:13  
Mar 24 22:34:13     @given(X=hu.tensor(min_dim=2), 
Mar 24 22:34:13 >          eps=st.floats(1e-5, 1e-3), 
Mar 24 22:34:13            elementwise_affine=st.booleans(), 
Mar 24 22:34:13            **hu.gcs) 

See CircleCI build caffe2_onnx_main_py3_6_clang7_ubuntu16_04_test (7/12)

Step: "Test" (full log | pattern match details)

Mar 24 22:34:23 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_op_jit FAILED [ 86%]
Mar 24 22:34:20 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/integral_image_ops_test.py::TestIntegralImageOps::test_integral_image_ops PASSED [ 85%] 
Mar 24 22:34:20 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/jsd_ops_test.py::TestJSDOps::test_bernoulli_jsd PASSED [ 85%] 
Mar 24 22:34:21 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/key_split_ops_test.py::TestKeySplitOps::test_key_split_op PASSED [ 85%] 
Mar 24 22:34:21 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/lars_test.py::TestLars::test_lars PASSED [ 85%] 
Mar 24 22:34:21 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_brew_wrapper PASSED [ 85%] 
Mar 24 22:34:22 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_grad PASSED [ 85%] 
Mar 24 22:34:22 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_grad_op PASSED [ 85%] 
Mar 24 22:34:22 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_op PASSED [ 86%] 
Mar 24 22:34:22 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_op_c10 PASSED [ 86%] 
Mar 24 22:34:22 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_op_c10_preallocated_outputs PASSED [ 86%] 
Mar 24 22:34:23 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_op_jit FAILED [ 86%] 
Mar 24 22:34:23  
Mar 24 22:34:23 =================================== FAILURES =================================== 
Mar 24 22:34:23 ____________________ TestLayerNormOp.test_layer_norm_op_jit ____________________ 
Mar 24 22:34:23  
Mar 24 22:34:23 self = <caffe2.python.operator_test.layer_norm_op_test.TestLayerNormOp testMethod=test_layer_norm_op_jit> 
Mar 24 22:34:23  
Mar 24 22:34:23     @given(X=hu.tensor(min_dim=2), 
Mar 24 22:34:23 >          eps=st.floats(1e-5, 1e-3), 
Mar 24 22:34:23            elementwise_affine=st.booleans(), 
Mar 24 22:34:23            **hu.gcs) 

See CircleCI build caffe2_onnx_ort1_py3_6_clang7_ubuntu16_04_test (8/12)

Step: "Test" (full log | pattern match details)

Mar 24 22:36:04 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_op_jit FAILED [ 86%]
Mar 24 22:36:02 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/integral_image_ops_test.py::TestIntegralImageOps::test_integral_image_ops PASSED [ 85%] 
Mar 24 22:36:02 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/jsd_ops_test.py::TestJSDOps::test_bernoulli_jsd PASSED [ 85%] 
Mar 24 22:36:02 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/key_split_ops_test.py::TestKeySplitOps::test_key_split_op PASSED [ 85%] 
Mar 24 22:36:02 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/lars_test.py::TestLars::test_lars PASSED [ 85%] 
Mar 24 22:36:03 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_brew_wrapper PASSED [ 85%] 
Mar 24 22:36:03 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_grad PASSED [ 85%] 
Mar 24 22:36:04 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_grad_op PASSED [ 85%] 
Mar 24 22:36:04 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_op PASSED [ 86%] 
Mar 24 22:36:04 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_op_c10 PASSED [ 86%] 
Mar 24 22:36:04 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_op_c10_preallocated_outputs PASSED [ 86%] 
Mar 24 22:36:04 ../.local/lib/python3.6/site-packages/caffe2/python/operator_test/layer_norm_op_test.py::TestLayerNormOp::test_layer_norm_op_jit FAILED [ 86%] 
Mar 24 22:36:04  
Mar 24 22:36:04 =================================== FAILURES =================================== 
Mar 24 22:36:04 ____________________ TestLayerNormOp.test_layer_norm_op_jit ____________________ 
Mar 24 22:36:04  
Mar 24 22:36:04 self = <caffe2.python.operator_test.layer_norm_op_test.TestLayerNormOp testMethod=test_layer_norm_op_jit> 
Mar 24 22:36:04  
Mar 24 22:36:04     @given(X=hu.tensor(min_dim=2), 
Mar 24 22:36:04 >          eps=st.floats(1e-5, 1e-3), 
Mar 24 22:36:04            elementwise_affine=st.booleans(), 
Mar 24 22:36:04            **hu.gcs) 

See CircleCI build pytorch_linux_xenial_py3_6_gcc5_4_test (9/12)

Step: "Test" (full log | pattern match details)

Mar 24 22:36:38 RuntimeError: test_quantization failed!
Mar 24 22:36:38 Generated XML report: test-reports/python-unittest/TEST-ObserverTest-20200324223547.xml 
Mar 24 22:36:38 Generated XML report: test-reports/python-unittest/TEST-RecordHistogramObserverTest-20200324223547.xml 
Mar 24 22:36:38 Generated XML report: test-reports/python-unittest/TEST-FunctionalModuleTest-20200324223547.xml 
Mar 24 22:36:38 Generated XML report: test-reports/python-unittest/TEST-GraphModePostTrainingQuantTest-20200324223547.xml 
Mar 24 22:36:38 Generated XML report: test-reports/python-unittest/TEST-PostTrainingDynamicQuantTest-20200324223547.xml 
Mar 24 22:36:38 Traceback (most recent call last): 
Mar 24 22:36:38   File "test/run_test.py", line 682, in <module> 
Mar 24 22:36:38     main() 
Mar 24 22:36:38   File "test/run_test.py", line 675, in main 
Mar 24 22:36:38     raise RuntimeError(message) 
Mar 24 22:36:38 RuntimeError: test_quantization failed! 
Mar 24 22:36:38 + cleanup 
Mar 24 22:36:38 + retcode=1 
Mar 24 22:36:38 + set +x 
Mar 24 22:36:38 =================== sccache compilation log =================== 
Mar 24 22:36:38 =========== If your build fails, please take a look at the log above for possible reasons =========== 
Mar 24 22:36:38 Compile requests                  8 
Mar 24 22:36:38 Compile requests executed         7 
Mar 24 22:36:38 Cache hits                        0 
Mar 24 22:36:38 Cache misses                      7 
Mar 24 22:36:38 Cache timeouts                    0 

See CircleCI build pytorch_windows_vs2019_py36_cuda10.1_test2 (10/12)

Step: "Test" (full log | pattern match details)

ERROR: test_jit_jacobian (__main__.TestTransforms)
	  File "<string>", line 20 
	          normalized_ndim = len(normalized_shape) 
	          n = 1 
	          for i in range(input_ndim - normalized_ndim): 
	                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE 
	              n *= input.size(i) 
	          input_reshape = input.contiguous().view(1, n, -1) 
 
 
====================================================================== 
ERROR: test_jit_jacobian (__main__.TestTransforms) 
---------------------------------------------------------------------- 
Traceback (most recent call last): 
  File "C:\Users\circleci\project\build\win_tmp\build\torch\jit\__init__.py", line 631, in run_mod_and_filter_tensor_outputs 
    outs = wrap_retval(mod(*_clone_inputs(inputs))) 
  File "C:\Users\circleci\project\build\win_tmp\build\torch\testing\_internal\common_utils.py", line 88, in prof_func_call 
    return prof_callable(func_call, *args, **kwargs) 
  File "C:\Users\circleci\project\build\win_tmp\build\torch\testing\_internal\common_utils.py", line 85, in prof_callable 
    return callable(*args, **kwargs) 
RuntimeError:  
all inputs of range must be ints, found number in argument 0: 

See CircleCI build pytorch_linux_xenial_py3_clang5_asan_test (11/12)

Step: "Test" (full log | pattern match details)

Mar 24 23:39:04 RuntimeError: test_quantization failed!
Mar 24 23:39:03 Generated XML report: test-reports/python-unittest/TEST-ObserverTest-20200324233542.xml 
Mar 24 23:39:03 Generated XML report: test-reports/python-unittest/TEST-RecordHistogramObserverTest-20200324233542.xml 
Mar 24 23:39:03 Generated XML report: test-reports/python-unittest/TEST-FunctionalModuleTest-20200324233542.xml 
Mar 24 23:39:03 Generated XML report: test-reports/python-unittest/TEST-GraphModePostTrainingQuantTest-20200324233542.xml 
Mar 24 23:39:03 Generated XML report: test-reports/python-unittest/TEST-PostTrainingDynamicQuantTest-20200324233542.xml 
Mar 24 23:39:03 Traceback (most recent call last): 
Mar 24 23:39:03   File "test/run_test.py", line 682, in <module> 
Mar 24 23:39:04     main() 
Mar 24 23:39:04   File "test/run_test.py", line 675, in main 
Mar 24 23:39:04     raise RuntimeError(message) 
Mar 24 23:39:04 RuntimeError: test_quantization failed! 
Mar 24 23:39:04 + cleanup 
Mar 24 23:39:04 + retcode=1 
Mar 24 23:39:04 + set +x 
Mar 24 23:39:04 =================== sccache compilation log =================== 
Mar 24 23:39:04 =========== If your build fails, please take a look at the log above for possible reasons =========== 
Mar 24 23:39:04 Compile requests                 0 
Mar 24 23:39:04 Compile requests executed        0 
Mar 24 23:39:04 Cache hits                       0 
Mar 24 23:39:04 Cache misses                     0 
Mar 24 23:39:04 Cache timeouts                   0 

See CircleCI build pytorch_linux_xenial_cuda10_2_cudnn7_py3_gcc7_test (12/12)

Step: "Test" (full log | pattern match details)

Mar 25 00:09:18 RuntimeError: test_quantization failed!
Mar 25 00:09:18 Generated XML report: test-reports/python-unittest/TEST-ObserverTest-20200325000830.xml 
Mar 25 00:09:18 Generated XML report: test-reports/python-unittest/TEST-RecordHistogramObserverTest-20200325000830.xml 
Mar 25 00:09:18 Generated XML report: test-reports/python-unittest/TEST-FunctionalModuleTest-20200325000830.xml 
Mar 25 00:09:18 Generated XML report: test-reports/python-unittest/TEST-GraphModePostTrainingQuantTest-20200325000830.xml 
Mar 25 00:09:18 Generated XML report: test-reports/python-unittest/TEST-PostTrainingDynamicQuantTest-20200325000830.xml 
Mar 25 00:09:18 Traceback (most recent call last): 
Mar 25 00:09:18   File "test/run_test.py", line 682, in <module> 
Mar 25 00:09:18     main() 
Mar 25 00:09:18   File "test/run_test.py", line 675, in main 
Mar 25 00:09:18     raise RuntimeError(message) 
Mar 25 00:09:18 RuntimeError: test_quantization failed! 
Mar 25 00:09:18 + cleanup 
Mar 25 00:09:18 + retcode=1 
Mar 25 00:09:18 + set +x 
Mar 25 00:09:18 =================== sccache compilation log =================== 
Mar 25 00:09:18 =========== If your build fails, please take a look at the log above for possible reasons =========== 
Mar 25 00:09:18 Compile requests                 38 
Mar 25 00:09:18 Compile requests executed        13 
Mar 25 00:09:18 Cache hits                        0 
Mar 25 00:09:18 Cache misses                     13 
Mar 25 00:09:18 Cache timeouts                    0 

Job pytorch_xla_linux_xenial_py3_6_clang7_test is failing. Please create an issue with title prefixed by [PT_BREAK] in pytorch/xla and link to to this PR. If you have questions, please reach out to @ailzhang/@dlibenzi/@JackCaoG.


🚧 1 upstream failure:

These were probably caused by upstream breakages:


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker.

This comment has been revised 238 times.

… first arg"


Because #29238 removes special processing of `add/sub/rsub/mul/div`, calls like `torch.add(Scalar, Tensor)` will not be automatically translated to `torch.add(Tensor, Tensor)`. Therefore, we explicitly overload these ops with a scalar as their first arg.


[ghstack-poisoned]
… first arg"


Because #29238 removes special processing of `add/sub/rsub/mul/div`, calls like `torch.add(Scalar, Tensor)` will not be automatically translated to `torch.add(Tensor, Tensor)`. Therefore, we explicitly overload these ops with a scalar as their first arg.


[ghstack-poisoned]
… first arg"


Because #29238 removes special processing of `add/sub/rsub/mul/div`, calls like `torch.add(Scalar, Tensor)` will not be automatically translated to `torch.add(Tensor, Tensor)`. Therefore, we explicitly overload these ops with a scalar as their first arg.


[ghstack-poisoned]
… first arg"


Because #29238 removes special processing of `add/sub/rsub/mul/div`, calls like `torch.add(Scalar, Tensor)` will not be automatically translated to `torch.add(Tensor, Tensor)`. Therefore, we explicitly overload these ops with a scalar as their first arg.


[ghstack-poisoned]
… first arg"


Because #29238 removes special processing of `add/sub/rsub/mul/div`, calls like `torch.add(Scalar, Tensor)` will not be automatically translated to `torch.add(Tensor, Tensor)`. Therefore, we explicitly overload these ops with a scalar as their first arg.


[ghstack-poisoned]
… first arg"


Because #29238 removes special processing of `add/sub/rsub/mul/div`, calls like `torch.add(Scalar, Tensor)` will not be automatically translated to `torch.add(Tensor, Tensor)`. Therefore, we explicitly overload these ops with a scalar as their first arg.


[ghstack-poisoned]
… first arg"


Because #29238 removes special processing of `add/sub/rsub/mul/div`, calls like `torch.add(Scalar, Tensor)` will not be automatically translated to `torch.add(Tensor, Tensor)`. Therefore, we explicitly overload these ops with a scalar as their first arg.


[ghstack-poisoned]
… first arg"


Because #29238 removes special processing of `add/sub/rsub/mul/div`, calls like `torch.add(Scalar, Tensor)` will not be automatically translated to `torch.add(Tensor, Tensor)`. Therefore, we explicitly overload these ops with a scalar as their first arg.


[ghstack-poisoned]
… first arg"


Because #29238 removes special processing of `add/sub/rsub/mul/div`, calls like `torch.add(Scalar, Tensor)` will not be automatically translated to `torch.add(Tensor, Tensor)`. Therefore, we explicitly overload these ops with a scalar as their first arg.


[ghstack-poisoned]
… first arg"


Because #29238 removes special processing of `add/sub/rsub/mul/div`, calls like `torch.add(Scalar, Tensor)` will not be automatically translated to `torch.add(Tensor, Tensor)`. Therefore, we explicitly overload these ops with a scalar as their first arg.


[ghstack-poisoned]
@xuhdev xuhdev mentioned this pull request Feb 21, 2020
… first arg"


Because #29238 removes special processing of `add/sub/rsub/mul/div`, calls like `torch.add(Scalar, Tensor)` will not be automatically translated to `torch.add(Tensor, Tensor)`. Therefore, we explicitly overload these ops with a scalar as their first arg.


[ghstack-poisoned]
… first arg"


Because #29238 removes special processing of `add/sub/rsub/mul/div`, calls like `torch.add(Scalar, Tensor)` will not be automatically translated to `torch.add(Tensor, Tensor)`. Therefore, we explicitly overload these ops with a scalar as their first arg.


[ghstack-poisoned]
@ezyang
Copy link
Contributor

ezyang commented Mar 3, 2020

@xuhdev are you still working on this or do you need another review round?

@xuhdev
Copy link
Collaborator Author

xuhdev commented Mar 4, 2020

I'm still working on this (but slowly). I probably need some help, as it seems like a lot of JIT code is involved, which I'm unfamiliar with...

@xuhdev
Copy link
Collaborator Author

xuhdev commented Mar 16, 2020

@ezyang I'm unlikely to work on this PR this week (like the past week), and I'm not sure about the week after this week. Do you have an urgent need of this PR? If so, I'm OK with letting someone else take over it.

@ezyang
Copy link
Contributor

ezyang commented Mar 16, 2020

Nope, not urgent, just trying to make sure people aren't blocked.' It looks like you are blocked, but I'm not sure if there's someone on our side with time to help you unblock, sorry :(

@xuhdev
Copy link
Collaborator Author

xuhdev commented Mar 17, 2020

@ezyang That's awesome! Let me come back to this some time later.

… first arg"


Because #29238 removes special processing of `add/sub/rsub/mul/div`, calls like `torch.add(Scalar, Tensor)` will not be automatically translated to `torch.add(Tensor, Tensor)`. Therefore, we explicitly overload these ops with a scalar as their first arg.


[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

Hi @xuhdev!

Thank you for your pull request. We require contributors to sign our Contributor License Agreement, and yours needs attention.

You currently have a record in our system, but we do not have a signature on file.

In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@pytorchbot
Copy link
Collaborator

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as Stale.
Feel free to remove the Stale label if you feel this was a mistake.
If you are unable to remove the Stale label please contact a maintainer in order to do so.
Stale pull requests will automatically be closed 30 days after being marked Stale

@pytorchbot pytorchbot added Stale and removed Stale labels Apr 12, 2022
@github-actions
Copy link
Contributor

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as Stale.
Feel free to remove the Stale label if you feel this was a mistake.
If you are unable to remove the Stale label please contact a maintainer in order to do so.
If you want the bot to never mark this PR stale again, add the no-stale label.
Stale pull requests will automatically be closed after 30 days of inactivity.

@github-actions github-actions bot added the Stale label Jun 11, 2022
@github-actions github-actions bot closed this Jul 11, 2022
@facebook-github-bot facebook-github-bot deleted the gh/xuhdev/52/head branch August 10, 2022 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed open source Stale triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.