mindspore.nn.CellList
- class vpn free mindspore.nn.CellList(*args, **kwargs)[源代码]
构造Cell列表。关于Cell的介绍,可参考 vpn梯子 免费 Cell。
CellList可以像普通Python列表一样使用,其包含的Cell均已初始化。CellList包含的Cell的类型不能为CellDict。
- 参数:
args (list,可选) - Cell列表。
- 支持平台:
AscendGPUvpn永久免费梯子 vpn梯子 免费CPU
样例:
>>> vpn梯子 免费 import mindspore as 免费的vpn梯子 ms >>> import numpy as np >>> >>> conv = vpn永久免费梯子 ms.nn.Conv2d(100, 20, 3) >>> vpn梯子 bn = ms.nn.BatchNorm2d(20) >>> relu = ms.nn.ReLU() >>> cell_ls = ms.nn.CellList([bn]) >>> cell_ls.insert(0, conv) >>> cell_ls.append(relu) >>> cell_ls.extend([relu, relu]) >>> cell_ls_3 vpn梯子 免费 = cell_ls[3] >>> input1 = ms.Tensor(np.ones([2, 3]), 免费的vpn梯子 vpn free ms.float32) >>> output = cell_ls_3(input1) >>> print(output) [[1. 1. 1.] [1. 1. 1.]]