import torch
from typing import Any, Dict
class TestModule(torch.nn.Module):
def __init__(self):
super(TestModule, self).__init__()
def forward(self, input: Any) -> Any:
isinstance(input, Dict)
return input
m = torch.jit.script(TestModule())
m({"1": torch.tensor(1)})
#0 0x00007fffef06f7f7 in c10::DictType::create (key=..., value=...) at ../aten/src/ATen/core/jit_type.h:884
884 switch (key->kind()) {
#0 0x00007fffef06f7f7 in c10::DictType::create (key=..., value=...) at ../aten/src/ATen/core/jit_type.h:884
#1 0x00007fffef147bf7 in torch::jit::<lambda(c10::TypePtr, c10::TypePtr)>::operator() (__closure=<optimized out>, value=..., key=...)
at ../torch/csrc/jit/python/python_ir.cpp:772
#2 pybind11::detail::initimpl::factory<torch::jit::initPythonIRBindings(PyObject*)::<lambda(c10::TypePtr, c10::TypePtr)>, pybind11::detail::void_type (*)(), std::shared_ptr<c10::DictType>(std::shared_ptr<c10::Type>, std::shared_ptr<c10::Type>), pybind11::detail::void_type()>::<lambda(pybind11::detail::value_and_holder&, std::shared_ptr<c10::Type>, std::shared_ptr<c10::Type>)>::operator() (__closure=<optimized out>, args#1=..., args#0=..., v_h=...)
at ../torch/include/pybind11/detail/init.h:237
<...>
Segfaults, with stack trace:
cc @gmagogsfm