mindspore.Tensor.set_const_arg
- Tensor.set_const_arg(const_arg=True)[source]
Specify whether the tensor is a constant when it is used for the argument of a network.
- Parameters
const_arg (bool) – Whether the tensor is a constant when it is used for the argument of a network. Default:
True
.- Returns
Tensor, has been specified whether to be a const network argument.
- Raises
TypeError – If const_arg is not a bool.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import numpy as np >>> from mindspore import Tensor >>> x = Tensor(np.array([[1,2,3],[4,5,6]], dtype=np.float32)) >>> x.set_const_arg(True)