Closed rainbow979 closed 4 years ago
(*filter(bool, [x])) removes None layers in x. For example, if the block was the following:
self.conv = nn.Sequential(*filter(bool, [
nn.Conv2d(512, 64, (1, 1), stride=(1, 1)),
nn.ReLU() if args.use_relu else None,
]))
Here, I believe the filter would remove None layers if args.use_relu was False.
It is redundant in the referred line, you can ignore it.
What does this code(filter(bool, [])) mean? `self.conv = nn.Sequential(filter(bool, [ nn.Conv2d(512, 64, (1, 1), stride=(1, 1)), nn.ReLU() ]))` https://github.com/devendrachaplot/Neural-SLAM/blob/master/model.py#L80