![nn sequential nn sequential](https://f4.bcbits.com/img/a2405528778_10.jpg)
![nn sequential nn sequential](https://www.jasss.org/23/1/7/Figure7.jpg)
The sequential, module list, and module dictionary containers are the highest level containers and can be thought of as neural networks with no layers added in. multiple outputs return out1, out2, out3 as this will again. nn.Squential will work exactly the way you know, as it will look like you gave it one input. The forward() method of Sequential accepts any input and forwards it to the first module it contains. Alternatively, an OrderedDict of modules can be passed in. Modules will be added to it in the order they are passed in the constructor. I passed two input images to a network using the dictionary output = model_4ch()īut, it gives an error below File "C:\Users\shyu\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module. Containers can be defined as sequential, module list, module dictionary, parameter list, or parameter dictionary. Although I don’t know exactly how it works, it makes nn.Sequential feed the multiple inputs to a network if the type of inputs is a tuple. Sequential ( args) source ¶ A sequential container. Self.block = self.BlockGenerator(block, num_filter, num_blocks, growh_rate)ĭef BlockGenerator(self, block, num_filter, num_blocks, growh_rate):ĭblk = block(num_filter * growh_rate, kernel_size=8, stride=4, padding=2) class BlkGenerator(nn.Module):ĭef _init_(self, block, num_filter, num_blocks, growh_rate):
#NN SEQUENTIAL CODE#
In the post nn.Sequential(*layers) forward: with multiple inputs Error, they said that multiple inputs can be passed to nn.Sequential(*layer) using the dictionary, but it’s not working in my code below. As I knew, nn.Sequential cannot handle multiple inputs. I’m trying to generate a network with sequential blocks and multiple inputs(images) using nn.Sequential(*layer).