You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Executing torch.jit.script over my model is working however it returns a model that fails at runtime.
Looking deeply the nn.ModuleList is loosing None elements from the Modulelist.
Here, above I attach a code for reproducing the error:
import os
import sys
import torch.nn as nn
import torch.nn.functional as F
import torch
from torchvision import transforms
from PIL import Image
class TestBlock(nn.Module):
def __init__(self):
super(TestBlock, self).__init__()
layers = []
layers.append(None)
layers.append(None)
layers.append(nn.Conv2d(3, 64, kernel_size=3, stride=2, padding=1,
bias=False))
self.layer = nn.ModuleList(layers)
def forward(self,x):
for aux in self.layer:
print("ENTER")
if aux is not None:
x = aux(x)
print("Not None")
return x
WaterKnight1998
changed the title
[JIT] TorchScript Scripted model got fewer elements at nn.ModuleList
[JIT] nn.ModuleList with some Nones inside it losses them after Scripting
Jun 1, 2020
WaterKnight1998
changed the title
[JIT] nn.ModuleList with some Nones inside it losses them after Scripting
[JIT] nn.ModuleList loses None objects inside it after scripting
Jun 2, 2020
馃悰 Bug
To Reproduce
Executing torch.jit.script over my model is working however it returns a model that fails at runtime.
Looking deeply the nn.ModuleList is loosing None elements from the Modulelist.
Here, above I attach a code for reproducing the error:
Creating model and tracing it:
Testing model with an image:
This outputs the next:
Traced version output:
Expected behavior
Get same output as original model
cc @suo
The text was updated successfully, but these errors were encountered: