(gdb) bt
#0  0x00007ffff7a81c45 in pthread_cond_wait@@GLIBC_2.3.2 ()
   from /usr/lib/libpthread.so.0
#1  0x00007fffe9c061c1 in __gthread_cond_wait (__mutex=<optimized out>, 
    __cond=<optimized out>)
    at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:865
#2  std::condition_variable::wait (this=<optimized out>, __lock=...)
    at /build/gcc/src/gcc/libstdc++-v3/src/c++11/condition_variable.cc:53
#3  0x00007fffdfb899dc in torch::autograd::Engine::execute(std::vector<torch::autograd::Edge, std::allocator<torch::autograd::Edge> > const&, std::vector<torch::autograd::Variable, std::allocator<torch::autograd::Variable> > const&, bool, bool, std::vector<torch::autograd::Edge, std::allocator<torch::autograd::Edge> > const&) ()
   from /home/mtgd/cpp-test/env/lib/python3.7/site-packages/torch/lib/libtorch.so
#4  0x00007fffea18015e in torch::autograd::python::PythonEngine::execute(std::vector<torch::autograd::Edge, std::allocator<torch::autograd::Edge> > const&, std::vector<torch::autograd::Variable, std::allocator<torch::autograd::Variable> > const&, bool, bool, std::vector<torch::autograd::Edge, std::allocator<torch::autograd::Edge> > const&) ()
   from /home/mtgd/cpp-test/env/lib/python3.7/site-packages/torch/lib/libtorch_python.so
rad::Variable, std::allocator<torch::autograd::Variable> > const&, std::vector<torch::autograd::Variable, std::allocator<torch::autograd::Variable> > const&, bool, bool, std::vector<torch::autograd::Variable, std::allocator<torch::autograd::Variable> > const&, bool) () from /home/mtgd/cpp-test/env/lib/python3.7/site-packages/torch/lib/libtorch.so
#6  0x00007fffdfb780e8 in torch::autograd::backward(std::vector<torch::autograd::Variable, std::allocator<torch::autograd::Variable> > const&, std::vector<torch::autograd::Variable, std::allocator<torch::autograd::Variable> > const&, c10::optional<bool>, bool) () from /home/mtgd/cpp-test/env/lib/python3.7/site-packages/torch/lib/libtorch.so
#7  0x00007fffdfbb1ac5 in torch::autograd::Variable::backward(at::Tensor const&, bool, bool) const () from /home/mtgd/cpp-test/env/lib/python3.7/site-packages/torch/lib/libtorch.so
#8  0x00007fffdc2308de in at::ATenOpTable::callUnboxed<void, at::Tensor const&, at::Tensor const&, bool, bool> (this=0x555555b80150)
    at /home/mtgd/cpp-test/env/lib/python3.7/site-packages/torch/include/c10/util/llvmMathExtras.h:204
#9  at::Tensor::backward (create_graph=true, keep_graph=true, gradient=..., this=0x7fffffffdbd0) at /home/mtgd/cpp-test/env/lib/python3.7/site-packages/torch/include/ATen/core/TensorMethods.h:65
#10 backw (tens=...) at diff.cpp:4
#11 0x00007fffdc23227b in pybind11::detail::argument_loader<at::Tensor>::call_impl<void, void (*&)(at::Tensor), 0ul, pybind11::detail::void_type> (f=<optimized out>, this=0x7fffffffdbb8)
    at /home/mtgd/cpp-test/env/lib/python3.7/site-packages/torch/include/c10/util/intrusive_ptr.h:216
#12 pybind11::detail::argument_loader<at::Tensor>::call<void, pybind11::detail::void_type, void (*&)(at::Tensor)>(void (*&)(at::Tensor)) && (f=<optimized out>, this=0x7fffffffdbb8)
    at /home/mtgd/cpp-test/env/lib/python3.7/site-packages/torch/include/pybind11/cast.h:1913
#13 pybind11::cpp_function::initialize<void (*&)(at::Tensor), void, at::Tensor, pybind11::name, pybind11::scope, pybind11::sibling, char [11]>(void (*&)(at::Tensor), void (*)(at::Tensor), pybind11::name const&, pybind11::scope const&, pybind11::sibling const&, char const (&) [11])::{lambda(pybind11::detail::function_call&)#3}::operator()(pybind11::detail::function_call&) const (call=..., this=0x0)
    at /home/mtgd/cpp-test/env/lib/python3.7/site-packages/torch/include/pybind11/pybind11.h:155
#14 pybind11::cpp_function::initialize<void (*&)(at::Tensor), void, at::Tensor, pybind11::name, pybind11::scope, pybind11::sibling, char [11]>(void (*&)(at::Tensor), void (*)(at::Tensor), pybind11::name const&, pybind11::scope const&, pybind11::sibling const&, char const (&) [11])::{lambda(pybind11::detail::function_call&)#3}::_FUN(pybind11::detail::function_call&) ()
    at /home/mtgd/cpp-test/env/lib/python3.7/site-packages/torch/include/pybind11/pybind11.h:133
#15 0x00007fffdc23a87e in pybind11::cpp_function::dispatcher (self=<optimized out>, args_in=0x7ffff74a8d50, kwargs_in=0x0)
    at /home/mtgd/cpp-test/env/lib/python3.7/site-packages/torch/include/pybind11/pybind11.h:620
#16 0x00007ffff7bce688 in _PyMethodDef_RawFastCallKeywords () from /usr/lib/libpython3.7m.so.1.0
#17 0x00007ffff7bce784 in _PyCFunction_FastCallKeywords () from /usr/lib/libpython3.7m.so.1.0
#18 0x00007ffff7beccc4 in ?? () from /usr/lib/libpython3.7m.so.1.0
#19 0x00007ffff7c1c9b4 in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.7m.so.1.0
#20 0x00007ffff7be0fd8 in _PyEval_EvalCodeWithName () from /usr/lib/libpython3.7m.so.1.0
#21 0x00007ffff7be1dba in PyEval_EvalCodeEx () from /usr/lib/libpython3.7m.so.1.0
#22 0x00007ffff7c5eebc in PyEval_EvalCode () from /usr/lib/libpython3.7m.so.1.0
#23 0x00007ffff7c90345 in ?? () from /usr/lib/libpython3.7m.so.1.0
#24 0x00007ffff7b78e67 in PyRun_FileExFlags () from /usr/lib/libpython3.7m.so.1.0
#25 0x00007ffff7b87b37 in PyRun_SimpleFileExFlags () from /usr/lib/libpython3.7m.so.1.0
#26 0x00007ffff7c9a640 in ?? () from /usr/lib/libpython3.7m.so.1.0
#27 0x00007ffff7c9a6bc in _Py_UnixMain () from /usr/lib/libpython3.7m.so.1.0
#28 0x00007ffff7dfd153 in __libc_start_main () from /usr/lib/libc.so.6
#29 0x000055555555505e in _start ()