oneflow.nn.Parameter¶
-
class
oneflow.nn.
Parameter
¶ -
__init__
(*args, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__abs__
()abs(self)
__add__
(value, /)Return self+value.
__and__
(value, /)Return self&value.
__array__
()Tensor.numpy() → numpy.ndarray
__bool__
()is_nonzero(input) -> (bool)
__contains__
(element)Check if element is present in tensor
__delattr__
(name, /)Implement delattr(self, name).
__delitem__
(key, /)Delete self[key].
__dir__
()Default dir() implementation.
__eq__
(value, /)Return self==value.
__float__
()__floordiv__
(value, /)Return self//value.
__format__
(format_spec)Default object formatter.
__ge__
(value, /)Return self>=value.
__getattribute__
(name, /)Return getattr(self, name).
__getitem__
(key, /)Return self[key].
__getstate__
()__gt__
(value, /)Return self>value.
__hash__
()Return hash(self).
__iadd__
(other)__imul__
(value, /)Return self*=value.
__index__
()__init__
(*args, **kwargs)Initialize self.
__init_subclass__
This method is called when a class is subclassed.
__int__
()__invert__
()~self
__ipow__
(value, /)Return self**=value.
__isub__
(value, /)Return self-=value.
__itruediv__
(value, /)Return self/=value.
__le__
(value, /)Return self<=value.
__len__
()Return len(self).
__lt__
(value, /)Return self<value.
__matmul__
(value, /)Return self@value.
__mod__
(value, /)Return self%value.
__mul__
(value, /)Return self*value.
__ne__
(value, /)Return self!=value.
__neg__
()-self
__new__
(**kwargs)Create and return a new object.
__or__
(value, /)Return self|value.
__pow__
(value[, mod])Return pow(self, value, mod).
__radd__
(value, /)Return value+self.
__rand__
(value, /)Return value&self.
__reduce__
()Helper for pickle.
__reduce_ex__
(protocol, /)Helper for pickle.
__repr__
()Return repr(self).
__rfloordiv__
(value, /)Return value//self.
__rmatmul__
(value, /)Return value@self.
__rmod__
(value, /)Return value%self.
__rmul__
(value, /)Return value*self.
__ror__
(value, /)Return value|self.
__rpow__
(value[, mod])Return pow(value, self, mod).
__rsub__
(value, /)Return value-self.
__rtruediv__
(value, /)Return value/self.
__rxor__
(value, /)Return value^self.
__setattr__
(name, value, /)Implement setattr(self, name, value).
__setitem__
(key, value, /)Set self[key] to value.
__setstate__
(pickle_dict)__sizeof__
()Size of object in memory, in bytes.
__str__
()Return str(self).
__sub__
(value, /)Return self-value.
__subclasshook__
Abstract classes can override this to customize issubclass().
__truediv__
(value, /)Return self/value.
__xor__
(value, /)Return self^value.
_copy_from_numpy
_copy_to_numpy
_meta_repr
()_register_post_grad_accumulation_hook
_register_storage_delete_hook
_zero_grad_
abs
See
oneflow.abs()
acos
See
oneflow.acos()
acosh
See
oneflow.acosh()
add
(other, *[, alpha])See
oneflow.add()
add_
(other, *[, alpha])In-place version of
oneflow.Tensor.add()
.addcdiv
addcdiv_
In-place version of
oneflow.Tensor.addcdiv()
addcmul
addcmul_
In-place version of
oneflow.Tensor.addcmul()
.addmm
(mat1, mat2[, alpha, beta])See
oneflow.addmm()
all
([dim, keepdim])See
oneflow.all()
allclose
(other[, atol, rtol, equal_nan])amax
See
oneflow.amax()
amin
See
oneflow.amin()
any
([dim, keepdim])See
oneflow.any()
arccos
See
oneflow.arccos()
arccosh
arcsin
See
oneflow.arcsin()
arcsinh
arctan
See
oneflow.arctan()
arctanh
argmax
See
oneflow.argmax()
argmin
See
oneflow.argmin()
argsort
([dim, descending])argwhere
()as_strided
(size, stride[, storage_offset])as_strided_
(size, stride[, storage_offset])In-place version of
oneflow.Tensor.as_strided()
asin
See
oneflow.asin()
asinh
See
oneflow.asinh()
atan
See
oneflow.atan()
atan2
See
oneflow.atan2()
atanh
See
oneflow.atanh()
backward
([gradient, retain_graph, create_graph])Computes the gradient of current tensor w.r.t. graph leaves.
baddbmm
bernoulli
bernoulli_
The inplace version of
oneflow.Tensor.bernoulli_()
.bfloat16
bincount
bitwise_and
bitwise_not
bitwise_or
bitwise_xor
bmm
See
oneflow.bmm()
bool
Tensor.bool()
is equivalent toTensor.to(oneflow.bool)
.broadcast_to
byte
self.byte() is equivalent to self.to(oneflow.uint8).
cast
See
oneflow.cast()
ceil
See
oneflow.ceil()
ceil_
See
oneflow.ceil_()
check_meta_consistency
chunk
See
oneflow.chunk()
clamp
See
oneflow.clamp()
.clamp_
Inplace version of
oneflow.Tensor.clamp()
.clamp_max
clamp_max_
clamp_min
clamp_min_
clip
Alias for
oneflow.Tensor.clamp()
.clip_
Alias for
oneflow.Tensor.clamp_()
.clone
See
oneflow.clone()
contiguous
contiguous_
copy_
(other)Copies the elements from src into self tensor and returns self.
cos
See
oneflow.cos()
cosh
See
oneflow.cosh()
cpu
Returns a copy of this object in CPU memory.
cross
(other[, dim])See
oneflow.cross()
cuda
Returns a copy of this object in CUDA memory.
cumprod
(dim[, dtype])cumsum
(dim[, dtype])See
oneflow.cumsum()
detach
diag
See
oneflow.diag()
diagonal
dim
Tensor.dim() → int
div
See
oneflow.div()
div_
(value)In-place version of
oneflow.Tensor.div()
.dot
See
oneflow.dot()
double
Tensor.double()
is equivalent toTensor.to(flow.float64)
.element_size
Tensor.element_size() → int
eq
(other)See
oneflow.eq()
equal
See
oneflow.equal()
erf
()See
oneflow.erf()
erfc
()See
oneflow.erfc()
erfinv
See
oneflow.erfinv()
erfinv_
Inplace version of
oneflow.erfinv()
exp
See
oneflow.exp()
exp2
See
oneflow.exp2()
expand
()See
oneflow.expand()
expand_as
(other)Expand this tensor to the same size as
other
.expm1
See
oneflow.expm1()
exponential_
([lambd, generator])fill_
Tensor.fill_(value) → Tensor
flatten
flip
See
oneflow.flip()
float
Tensor.float()
is equivalent toTensor.to(flow.float32)
.floor
See
oneflow.floor()
floor_
See
oneflow.floor_()
floor_divide
fmod
(other)See
oneflow.fmod()
gather
(dim, index)See
oneflow.gather()
ge
See
oneflow.ge()
gelu
get_device
()For CUDA tensors, this function returns the device ordinal of the GPU on which the tensor resides.
global_id
global_to_global
([placement, sbp, grad_sbp, …])Performs Tensor placement and/or sbp conversion.
gt
See
oneflow.gt()
gt_
(value)In-place version of
oneflow.Tensor.gt()
.half
self.half() is equivalent to self.to(dtype=oneflow.float16).
in_top_k
(targets, predictions, k)index_add
(dim, index, source[, alpha])index_add_
(dim, index, source, *[, alpha])The interface is consistent with PyTorch.
index_select
(dim, index)int
Tensor.int()
is equivalent toTensor.to(flow.int32)
.inverse
is_consistent
()is_contiguous
()Returns True if self tensor is contiguous in memory.
is_floating_point
is_offloaded
()Determine whether the tensor has been moved to CPU memory and the CUDA device memory has been released.
is_pinned
()Returns true if this tensor resides in pinned memory.
isclose
isinf
See
oneflow.isinf()
isnan
See
oneflow.isnan()
item
Returns the value of this tensor as a standard Python number.
kaiming_normal_
([a, mode, nonlinearity, …])kaiming_uniform_
([a, mode, nonlinearity, …])le
See
oneflow.le()
lerp
See
oneflow.lerp()
lerp_
See
oneflow.lerp_()
load
Load tensor data stored on the host (CPU) back to GPU memory.
local_to_global
([placement, sbp, …])Creates a global tensor from a local tensor.
log
See
oneflow.log()
log10
See
oneflow.log10()
log1p
See
oneflow.log1p()
log2
See
oneflow.log2()
log_softmax
logaddexp
(other)logical_and
()logical_not
()logical_or
()logical_xor
()logsumexp
long
Tensor.long()
is equivalent toTensor.to(flow.int64)
.lt
See
oneflow.lt()
masked_fill
masked_fill_
In-place version of
oneflow.Tensor.masked_fill()
.masked_select
(mask)matmul
See
oneflow.matmul()
max
(dim, index)See
oneflow.max()
maximum
mean
([dim, keepdim])See
oneflow.mean()
median
See
oneflow.median()
min
(dim, index)See
oneflow.min()
minimum
mish
See
oneflow.mish()
mm
See
oneflow.mm()
mode
See
oneflow.mode()
mul
(value)See
oneflow.mul()
mul_
(value)In-place version of
oneflow.Tensor.mul()
.mv
See
oneflow.mv()
nansum
See
oneflow.nansum()
narrow
See
oneflow.narrow()
ndimension
ne
See
oneflow.ne()
neg
See
oneflow.neg()
negative
nelement
Tensor.nelement() → int
new
Constructs a new tensor of the same data type and device (or placemant and sbp) as self tensor.
new_empty
(*size[, dtype, device, placement, …])Returns a Tensor of size
size
filled with uninitialized data.new_full
(size, fill_value[, dtype, device, …])Returns a Tensor of size size filled with fill_value.
new_ones
()new_tensor
(data[, dtype, device, …])new_zeros
([size, dtype, device, placement, …])Returns a Tensor of size size filled with 0.
nms
(scores, iou_threshold)See
oneflow.nms()
nonzero
(input[, as_tuple])norm
([p, dim, keepdim, dtype])See
oneflow.norm()
normal_
([mean, std, generator])Fills
self
tensor with elements samples from the normal distribution parameterized bymean
andstd
.numel
See
oneflow.numel()
numpy
()Tensor.numpy() → numpy.ndarray
offload
Transfer tensor data from GPU memory back to host (CPU) memory.
orthogonal_
([gain])permute
pin_memory
()Copies the tensor to pinned memory, if it’s not already pinned.
pow
See
oneflow.pow()
prod
([dim, keepdim])See
oneflow.prod()
quantile
reciprocal
register_hook
(hook)Registers a backward hook.
relu
See
oneflow.relu()
relu_
repeat
(*size)See
oneflow.repeat()
repeat_interleave
(repeats[, dim, output_size])requires_grad_
([requires_grad])Sets this tensor’s requires_grad attribute in-place.
reshape
reshape_as
(other)Returns this tensor as the same shape as other.
retain_grad
Enables this Tensor to have their
grad
populated duringbackward()
.roll
See
oneflow.roll()
round
See
oneflow.round()
round_
See
oneflow.round_()
rsqrt
See
oneflow.rsqrt()
scatter
(dim, index, src, *[, reduce])scatter_
(dim, index, src, *[, reduce])Inplace version of
oneflow.Tensor.scatter()
scatter_add
(dim, index, src)scatter_add_
(dim, index, src)Inplace version of
oneflow.Tensor.scatter_add()
selu
See
oneflow.selu()
sigmoid
sign
See
oneflow.sign()
silu
See
oneflow.silu()
sin
()See
oneflow.sin()
sin_
See
oneflow.sin_()
sinh
See
oneflow.sinh()
size
Returns the size of the self tensor.
softmax
softplus
softsign
sort
([dim, descending])See
oneflow.sort()
split
See
oneflow.split()
sqrt
See
oneflow.sqrt()
square
See
oneflow.square()
squeeze
([dim])squeeze_
([dim])In-place version of
oneflow.Tensor.squeeze()
std
See
oneflow.std()
storage_offset
()Returns self tensor’s offset in the underlying storage in terms of number of storage elements (not bytes).
stride
sub
See
oneflow.sub()
sub_
(value)In-place version of
oneflow.Tensor.sub()
.sum
([dim, keepdim])See
oneflow.sum()
swapaxes
swapdims
t
See
oneflow.t()
tan
See
oneflow.tan()
tanh
See
oneflow.tanh()
tile
(*dims)See
oneflow.tile()
to
(*args, **kwargs)Performs Tensor dtype and/or device conversion.
to_consistent
(*args, **kwargs)This interface is no longer available, please use
oneflow.Tensor.to_global()
instead.to_global
([placement, sbp])Creates a global tensor if this tensor is a local tensor, otherwise performs Tensor placement and/or sbp conversion.
to_local
(**kwargs)Returns the local component of this global tensor in the current rank.
to_numpy
tolist
()Returns the tensor as a (nested) list.
topk
See
oneflow.topk()
transpose
tril
See
oneflow.tril()
tril_
triu
See
oneflow.triu()
triu_
trunc
See
oneflow.trunc()
trunc_normal_
([mean, std, a, b])type
([dtype, non_blocking])Returns the type if dtype is not provided, else casts this object to the specified type.
type_as
Returns this tensor cast to the type of the given tensor.
unbind
See
oneflow.unbind()
unfold
Returns a view of the original tensor which contains all slices of size size from self tensor in the dimension dimension.
uniform_
([a, b])Tensor.uniform_(from=0, to=1) → Tensor
unique
See
oneflow.unique()
unsqueeze
(dim)unsqueeze_
(dim)In-place version of
oneflow.Tensor.unsqueeze()
var
See
oneflow.var()
view
Returns a new tensor with the same data as the
self
tensor but of a differentshape
.view_as
(other)Expand this tensor to the same size as
other
.where
([x, y])See
oneflow.where()
xavier_normal_
([gain])xavier_uniform_
([gain])zero_
()Fills self tensor with zeros.
Attributes
T
Is this Tensor with its dimensions reversed.
_tensor_buffer_shapes_and_dtypes
data
device
Is the
oneflow.device
where this Tensor is, which is invalid for global tensor.dtype
grad
Return the gradient calculated by autograd functions.
grad_fn
Return the function that created this tensor if it’s
requires_grad
is True.is_cuda
Is True if the Tensor is stored on the GPU, False otherwise.
is_eager
is_global
Return whether this Tensor is a global tensor.
is_lazy
Return whether this Tensor is a lazy tensor.
is_leaf
All Tensors that have
requires_grad
which isFalse
will be leaf Tensors by convention.is_local
ndim
placement
Is the
oneflow.placement
where this Tensor is, which is invalid for local tensor.requires_grad
Is
True
if gradient need to be computed for this Tensor,False
otherwise.sbp
Is the
oneflow.sbp
representing that how the data of the global tensor is distributed, which is invalid for local tensor.shape
-