Pytorch的nn.Sequential(*modules)中*的理解

*作用在实参上,是将输入迭代器拆成一个个元素。

从nn.Sequential的定义来看,遇到list,必须用*号进行转化,否则会报错 TypeError: list is not a Module subclass。

参考:nn.Sequential的参数的注意事项_apodxxx的博客-CSDN博客

posted @ 2022-04-01 17:23  vv_869  阅读(287)  评论(0编辑  收藏  举报