megengine.Parameter¶
- class Parameter(data, dtype=None, device=None, is_const=False, no_cache=False, name=None, format='default')[source]¶
A kind of Tensor that is to be considered a module parameter.
Note
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.Attributes
alias of
transpose
.Returns a string represents the device a
Tensor
storaged on.callback for device mapping, see
load
.Returns a
numpy.dtype
object represents the data type of aTensor
.Returns a string represents the memory format of a
Tensor
.gradient of this tensor, see
autodiff
.Returns a string represents the name of a
Tensor
.Returns the number of dimensions of self
Tensor
.Returns a
QParams
object containing quantization params of aTensor
.Returns a bool indicates whether the
Tensor
requires gradient.Returns the size of the self
Tensor
.Methods
astype
(dtype)Returns a
Tensor
with the same data and number of elements with the specifieddtype
.detach
()Returns a new
Tensor
, detached from the current graph.flatten
([start_axis, end_axis])See
flatten
.item
(*args)Returns the value of this
Tensor
as a standard Pythonnumbers.Number
.max
([axis, keepdims])See
max
.mean
([axis, keepdims])See
mean
.min
([axis, keepdims])See
min
.numpy
()Returns self
Tensor
as anumpy.ndarray
.prod
([axis, keepdims])See
prod
.Deprecated since version 1.0.
reshape
(*args)See
reshape
.set_value
(value)Deprecated since version 1.0.
sum
([axis, keepdims])See
sum
.to
(device, *[, _borrow])Copy self
Tensor
to specified device.tolist
()Returns the tensor as a (nested) list.
transpose
(*args)See
transpose
.