Hello everyone. I attempt to use
torch.jit.script on the Dict[str,List[float]], but it doesn’t work。
Has anyone ever done any related work?
by the way, I build the pytorch from source and the torch version is 1.4.0a0+93db2b8
I’d appreciate if anybody can help me! Thanks in advance!
here is the code:
import torch
from typing import Dict, List
class dictlist(torch.nn.Module):
    item:Dict[str, List[float]]
    hyps:List[Dict[str, List[float]]]
    def __init__(self):
        torch.nn.Module.__init__(self)
        self.item = {'score': [0.0], 'ys': [0, 1]}
        self.hyps = [self.item]
    def forward(self):
        new_item:Dict[str, List[float]] = {'score':[1.0], 'ys': [1,2,3]}
        self.hyps.append(new_item)
model = dictlist()
script_model = torch.jit.script(model)

and here is the log:
 RuntimeError: values[i]->type()->isSubtypeOf(value_type) INTERNAL ASSERT FAILED at /pytorch/torch/csrc/jit/ir.cpp:1527, please report a bug to PyTorch.  (createDict at pytorch/torch/csrc/jit/ir.cpp:1527)