Skip to content

Instantly share code, notes, and snippets.

Thread 1880 "python3" hit Catchpoint 1 (exception thrown), 0x00007ffff35d3afd in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
(gdb) bt
#0 0x00007ffff35d3afd in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#1 0x00007ffebab6ebca in c10::detail::torchCheckFail (func=0x7ffecc977968 "validate_outputs", file=0x7ffecc977528 "/workspaces/work/pytorch/torch/csrc/autograd/engine.cpp", line=812,
msg="Function SigmoidBackward0 returned an invalid gradient at index 0 - got [80, 1] but expected shape compatible with [<=80, 1]")
at /workspaces/work/pytorch/c10/util/Exception.cpp:86
#2 0x00007ffec22e746b in torch::autograd::validate_outputs(std::vector<torch::autograd::Edge, std::allocator<torch::autograd::Edge> > const&, std::vector<at::Tensor, std::allocator<at::Tensor> >&, std::function<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)> const&) (edges=std::vecto
ERROR: test_simple_expand_on_2d_tensor (__main__.TestDynamicShapes)
----------------------------------------------------------------------
Traceback (most recent call last):
File "pytorch/xla/test/test_dynamic_shapes.py", line 31, in test_simple_expand_on_2d_tensor
t4 = t3.expand(t2.shape[0], size1, size2)
RuntimeError: SymIntArrayRef expected to contain only concrete integers
Exception raised from asIntArrayRefSlow at /workspaces/work/pytorch/c10/core/SymIntArrayRef.h:35 (most recent call first):
frame #0: <unknown function> + 0x95e6f (0x7f3b2c19ae6f in /home/ptxla/.local/lib/python3.8/site-packages/torch/lib/libc10.so)
frame #1: std::function<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > ()>::operator()() const + 0x4d (0x7f3b33a8889d in /home/ptxla/.local/lib/python3.8/site-packages/torch/lib/libtorch_cpu.so)
frame #2: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) + 0x57 (0x7f3b2c199e97 in /home
xw32, file=/workspaces/work/pytorch/torch/csrc/autograd/engine.cpp, line=809function=validate_outputs: is_same_shape=0
xw32, file=/workspaces/work/pytorch/torch/csrc/autograd/input_metadata.h, line=111function=is_expandable_to_shape: grad.is_nested()=0
xw32, file=/workspaces/work/pytorch/aten/src/ATen/ExpandUtils.h, line=504function=is_expandable_to: ndim=2, target_dim=2
xw32, file=/workspaces/work/pytorch/aten/src/ATen/ExpandUtils.h, line=511function=is_expandable_to: i=0, size=1, target=1
xw32, file=/workspaces/work/pytorch/c10/core/SymInt.cpp, line=99function=operator==: is_symbolic()=0, sci.is_symbolic()=0
xw32, file=/workspaces/work/pytorch/aten/src/ATen/ExpandUtils.h, line=516function=is_expandable_to: succeeded for i=.0
xw32, file=/workspaces/work/pytorch/aten/src/ATen/ExpandUtils.h, line=511function=is_expandable_to: i=1, size=<=80, target=80
xw32, file=/workspaces/work/pytorch/c10/core/SymInt.cpp, line=99function=operator==: is_symbolic()=1, sci.is_symbolic()=0
xw32, file=torch_xla/csrc/tensor.cpp,
root@t1v-n-621e873b-w-0:/workspaces/work# python3 pytorch/xla/test/test_dynamic_shape_backward_models.py
pred.size()= torch.Size([<=80, 1])
xw32, file=torch_xla/csrc/tensor.cpp, line=665function=eq:
xw32, file=torch_xla/csrc/tensor.cpp, line=757function=bool_:
xw32, file=/workspaces/work/pytorch/c10/core/SymInt.cpp, line=99function=operator==: is_symbolic()=0, sci.is_symbolic()=0
xw32, file=/workspaces/work/pytorch/c10/core/SymInt.cpp, line=99function=operator==: is_symbolic()=0, sci.is_symbolic()=0
xw32, file=torch_xla/csrc/ops/dynamic_ir.cpp, line=113function=getDynamicValue: dim_node_0->getDynamicValue()=79, dim_node_1->getDynamicValue()=79
pred.size()= torch.Size([<=80, 1])
xw32, file=/workspaces/work/pytorch/torch/csrc/autograd/input_metadata.h, line=102function=is_same_shape: typeid(gradSymSizes).name()=N3c108ArrayRefINS_6SymIntEEE, typeid(shapeAsDimVector).name()=N3c108ArrayRefINS_6SymIntEEE
xw32, file=/workspaces/work/pytorch/torch/csrc/autograd/input_metadata.h, line=102function=is_same_shape: typ
root@t1v-n-621e873b-w-0:/workspaces/work# python3 pytorch/xla/test/test_dynamic_shape_backward_models.py
xw32, file=torch_xla/csrc/tensor.cpp, line=665function=eq:
xw32, file=torch_xla/csrc/tensor.cpp, line=757function=bool_:
xw32, file=/workspaces/work/pytorch/c10/core/SymInt.cpp, line=99function=operator==: is_symbolic()=0, sci.is_symbolic()=0
xw32, file=/workspaces/work/pytorch/c10/core/SymInt.cpp, line=99function=operator==: is_symbolic()=0, sci.is_symbolic()=0
xw32, file=torch_xla/csrc/ops/dynamic_ir.cpp, line=113function=getDynamicValue: dim_node_0->getDynamicValue()=79, dim_node_1->getDynamicValue()=79
xw32, file=/workspaces/work/pytorch/torch/csrc/autograd/input_metadata.h, line=102function=is_same_shape: typeid(gradSymSizes).name()=N3c108ArrayRefINS_6SymIntEEE, typeid(shapeAsDimVector).name()=N3c108ArrayRefINS_6SymIntEEE
xw32, file=/workspaces/work/pytorch/torch/csrc/autograd/input_metadata.h, line=102function=is_same_shape: typeid(gradSymSizes).name()=N3c108ArrayRefINS_6SymIntEEE, typeid(shapeAsD
root@t1v-n-621e873b-w-0:/workspaces/work# python3 pytorch/xla/test/test_dynamic_shape_backward_models.py
x_test_nonzero_dev.shape= torch.Size([<=80, 2])
y_test_nonzero_dev.shape= torch.Size([<=80])
xw32, file=torch_xla/csrc/tensor.cpp, line=665function=eq:
xw32, file=torch_xla/csrc/tensor.cpp, line=757function=bool_:
xw32, file=/workspaces/work/pytorch/c10/core/SymInt.cpp, line=99function=operator==: is_symbolic()=0, sci.is_symbolic()=0
xw32, file=/workspaces/work/pytorch/c10/core/SymInt.cpp, line=99function=operator==: is_symbolic()=0, sci.is_symbolic()=0
xw32, file=torch_xla/csrc/ops/dynamic_ir.cpp, line=113function=getDynamicValue: dim_node_0->getDynamicValue()=79, dim_node_1->getDynamicValue()=79
xw32, file=/workspaces/work/pytorch/torch/csrc/autograd/input_metadata.h, line=102function=is_same_shape: typeid(gradSymSizes).name()=N3c108ArrayRefINS_6SymIntEEE, typeid(shapeAsDimVector).name()=N3c108ArrayRefINS_6SymIntEEE
xw32, file=/workspaces/work/pytorch/torch/csrc/autograd/engine.cpp, line=893function=c
VERSION = "1.12" #@param ["1.13", "nightly", "20220315"] # or YYYYMMDD format
!curl https://raw.githubusercontent.com/pytorch/xla/master/contrib/scripts/env-setup.py -o pytorch-xla-env-setup.py
!python pytorch-xla-env-setup.py --version $VERSION
import os
os.environ['LD_LIBRARY_PATH']='/usr/local/lib'
!echo $LD_LIBRARY_PATH
!sudo ln -s /usr/local/lib/libmkl_intel_lp64.so /usr/local/lib/libmkl_intel_lp64.so.1
!sudo ln -s /usr/local/lib/libmkl_intel_thread.so /usr/local/lib/libmkl_intel_thread.so.1
!sudo ln -s /usr/local/lib/libmkl_core.so /usr/local/lib/libmkl_core.so.1
root@t1v-n-621e873b-w-0:/workspaces/work# python3 pytorch/xla/test/test_dynamic_shape_backward_models.py
x_test_nonzero_dev.shape= torch.Size([<=80, 2])
y_test_nonzero_dev.shape= torch.Size([<=80])
xw32, file=/workspaces/work/pytorch/xla/torch_xla/csrc/tensor.cpp, line=665function=eq:
xw32, file=/workspaces/work/pytorch/xla/torch_xla/csrc/tensor.cpp, line=757function=bool_:
xw32, file=/workspaces/work/pytorch/c10/core/SymInt.cpp, line=99function=operator==: is_symbolic()=0, sci.is_symbolic()=0
xw32, file=/workspaces/work/pytorch/c10/core/SymInt.cpp, line=99function=operator==: is_symbolic()=0, sci.is_symbolic()=0
xw32, file=/workspaces/work/pytorch/xla/torch_xla/csrc/ops/dynamic_ir.cpp, line=113function=getDynamicValue: dim_node_0->getDynamicValue()=79, dim_node_1->getDynamicValue()=79
xw32, file=/workspaces/work/pytorch/torch/csrc/autograd/input_metadata.h, line=102function=is_same_shape: typeid(gradSymSizes).name()=N3c108ArrayRefINS_6SymIntEEE, typeid(shapeAsDimVector).name()=N3c108ArrayRefINS_6SymIntEEE
ERROR: test_backward_pass_with_dynamic_input_simple (__main__.TestDynamicShapeModels)
----------------------------------------------------------------------
Traceback (most recent call last):
File "pytorch/xla/test/test_dynamic_shape_models.py", line 110, in test_backward_pass_with_dynamic_input_simple
loss.backward()
File "/home/ptxla/.local/lib/python3.8/site-packages/torch/_tensor.py", line 488, in backward
torch.autograd.backward(
File "/home/ptxla/.local/lib/python3.8/site-packages/torch/autograd/__init__.py", line 197, in backward
Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass
RuntimeError: /workspaces/work/pytorch/xla/torch_xla/csrc/helpers.cpp:273 : Check failed: out_size <= size_at_dyndim / input_shape.dimensions( input_dynamic_dimension) (2 vs. 1)
import argparse
import sys
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('--verbosity', type=int, default=2)
FLAGS, leftovers = parser.parse_known_args()
sys.argv = [sys.argv[0]] + leftovers
import numpy as np
import unittest