Hi,
Following the comments in this question, I was trying to create a class that has attributes of the same class type as shown below:
import torch
from typing import Dict, List, Optional
@torch.jit.script
class JSONValue(object):
def __init__(self):
self.value = torch.jit.annotate(Optional[JSONValue], None)
class TestModule(torch.jit.ScriptModule):
@torch.jit.script_method
def forward(self, input):
# type: (JSONValue) -> JSONValue
return input
m = TestModule()
m.save("test.pt")
But this code results in a segfault with message Segmentation fault: 11
. Any thoughts on what could be wrong?
Thanks!