You’ll have to make a couple changes that may be tricky. For dictionaries the only keys that are supported are str, int, and float, so using a tuple as the key won’t work in TorchScript. Since the range(4, -1, -1) you’re using to create self.convs is not going to change no matter how you initialize DepthDecoder, I’d recommend unrolling that loop and adding them as submodules to DepthDecoder. So something like:
self.upconv_0_0 = ConvBlock(...)
self.upconv_0_1 = ConvBlock(...)

Unfortunately TorchScript is pretty picky about nn.Modules inside of containers, so things like self.convs["upconv1"] currently aren’t supported (but this is something we’re working on fixing).