megengine.Parameter¶
- class Parameter(data, dtype=None, device=None, is_const=False, no_cache=False, name=None)[源代码]¶
一类表示模块参数的张量。
注解
Operations happened on Parameter usually return a Tensor instead of Parameter. For example, with a Parameter
x,x.reshape/to/sum/...will result into a Tensor. Any operations between Parameter and Tensor will have Tensor as outputs.属性
alias of
transpose.Returns a string represents the device a
Tensorstoraged on.Returns a
numpy.dtypeobject represents the data type of aTensor.返回自身
Tensor的维数。Returns a
QParamsobject containing quantization params of aTensor.Returns the size of the self
Tensor.方法
astype(dtype)Returns a
Tensorwith the same data and number of elements with the specifieddtype.detach()Returns a new
Tensor, detached from the current graph.flatten()See
flatten.item(*args)Returns the value of this
Tensoras a standard Pythonnumbers.Number.max([axis, keepdims])Returns the max value of each row of the input tensor in the given dimension
axis.mean([axis, keepdims])Returns the mean value of each row of the input tensor in the given dimension
axis.min([axis, keepdims])Returns the min value of each row of the input tensor in the given dimension
axis.numpy()Returns self
Tensoras anumpy.ndarray.prod([axis, keepdims])Returns the product of each row of the input tensor in the given dimension
axis.1.0 版后已移除.
reshape(*args)See
reshape.set_value(value)1.0 版后已移除.
sum([axis, keepdims])Returns the sum of each row of the input tensor in the given dimension
axis.to(device)Copy self
Tensorto specified device.tolist()Returns the tensor as a (nested) list.
transpose(*args)See
transpose.