mindspore.nn.CellList
- class mindspore.nn.CellList(*args, **kwargs)[source]
Holds Cells in a list. For more details about Cell, please refer to Cell.
CellList can be used like a regular Python list, the Cells it contains have been initialized.
- Parameters
args (list, optional) – List of subclass of Cell.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore.nn as nn >>> >>> conv = nn.Conv2d(100, 20, 3) >>> bn = nn.BatchNorm2d(20) >>> relu = nn.ReLU() >>> cell_ls = nn.CellList([bn]) >>> cell_ls.insert(0, conv) >>> cell_ls.append(relu) >>> cell_ls.extend([relu, relu])
- append(cell)[source]
Appends a given Cell to the end of the list.
- Parameters
cell (Cell) – The subcell to be appended.