sciai.architecture.NoArgNet
- class sciai.architecture.NoArgNet(backbone, *inputs)[source]
Convert a net with inputs into a net without inputs in construct.
- Parameters
backbone (Cell) – Original network.
*inputs (tuple) – Inputs of the original network.
- Outputs:
Union(Tensor, tuple[Tensor]), The result of original network with the given inputs.
- Supported Platforms:
GPU
CPU
Ascend
Examples
>>> import mindspore as ms >>> from mindspore import ops, nn >>> from sciai.architecture.basic_block import NoArgNet >>> class Net(nn.Cell): >>> def __init__(self): >>> super().__init__() >>> def construct(self, x, y): >>> out1 = x + y >>> return out1.sum() >>> net = Net() >>> x, y = ops.ones((2, 3), ms.float32), ops.ones((2, 3), ms.float32) >>> no_arg_cell = NoArgNet(net, x, y) >>> res = no_arg_cell() >>> print(res) 12.0