Why do I get a segmentation violation (SIGSEGV) when calling a forward pass?

Hi there,

I have been getting a segmentation violation error, also called SIGSEGV when calling a forward pass in my graph convolutional neural network:

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

This error comes after I have created an instance of my graph convolutional neural network and am calling the forward method on it for the first time, thereby passing the data.

This is part of my script:

# create model
model: LinkPredictHetero = LinkPredictHetero(
    g=deephet.graph,
    h_dim=h_dim,
    out_dim=h_out,
    num_hidden_layers=n_hidden_layers,
)
    
# call forward pass
embed = model(deephet.graph)

The graph is an instance of the dgl.heterograph.

The forward()method of the model links to the forward method of the base layer class, defined as follows:

def forward(self, graph):
    graph = graph.local_var()
    hs = {}
    hs = self.embed_layer(graph)
    for layer in self.layers:
        hs = layer(g, inputs = hs)
    return hs

Related to this forward method,
self.embed_layer is a torch.nn.ModuleDict():

self.embed_layer = torch.nn.ModuleDict()
for node_type in self.graph.node_types:
    in_size = list(self.graph.nodes[node_type].data['feature'].size())[1]
    self.embed_layer[node_type] = torch.nn.Linear(in_size, self.embed_size)

and self.layers is a torch.nn.ModuleList() to which different layer implementations are appended.

So when in the script I call model(deephet.graph), which should call the forward() method of the layer, the segmentation violation ends my program, and actually also terminates python.

Could you please help me to find out why this happens? I would really appreciate it.
Thank you, dear community.

1 Like

What is your pytorch version?

I’ve got this version: torch==1.5.0