Ah sorry, forgot the bt. The “useful” part is:
[New Thread 0x7fff00067700 (LWP 18408)]
[New Thread 0x7fff00868700 (LWP 18409)]

Thread 1 "python" received signal SIGSEGV, Segmentation fault.
_PyMethodDef_RawFastCallDict () at /tmp/build/80754af9/python_1565725737370/work/Objects/call.c:464
464	/tmp/build/80754af9/python_1565725737370/work/Objects/call.c: No such file or directory.
(gdb) bt
#0  _PyMethodDef_RawFastCallDict () at /tmp/build/80754af9/python_1565725737370/work/Objects/call.c:464
#1  0x00005555556897c1 in _PyCFunction_FastCallDict (func=0x7fff39e0dbe0, args=<optimised out>, nargs=<optimised out>, kwargs=<optimised out>)
    at /tmp/build/80754af9/python_1565725737370/work/Objects/call.c:586
#2  0x00007ffef71602c3 in pybind11::detail::simple_collector<(pybind11::return_value_policy)1>::call (ptr=<optimised out>, this=0x7fffffffc888)
    at /home/ian/anaconda3/lib/python3.7/site-packages/pybind11/include/pybind11/cast.h:2032
#3  pybind11::detail::object_api<pybind11::detail::accessor<pybind11::detail::accessor_policies::str_attr> >::operator()<(pybind11::return_value_policy)1, pybind11::tuple&> (this=this@entry=0x7fffffffc940)
    at /home/ian/anaconda3/lib/python3.7/site-packages/pybind11/include/pybind11/cast.h:2187
#4  0x00007ffef71684a6 in pybind11::detail::print (args=..., kwargs=...)
    at /home/ian/anaconda3/lib/python3.7/site-packages/pybind11/include/pybind11/pybind11.h:2008
#5  0x00007ffef7168d3b in pybind11::print<(pybind11::return_value_policy)1, char const (&) [2]> ()
    at /home/ian/anaconda3/lib/python3.7/site-packages/pybind11/include/pybind11/pybind11.h:2037


But I don’t know why it’s saying it’s in print - it crashes on either of these two lines:
pybind11::gil_scoped_release no_gil;

loss.backward();

Do I need to bt from a different thread?