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__([dtype])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_absSee
oneflow.abs()acosSee
oneflow.acos()acoshSee
oneflow.acosh()add(other, *[, alpha])See
oneflow.add()add_(other, *[, alpha])In-place version of
oneflow.Tensor.add().addcdivaddcdiv_In-place version of
oneflow.Tensor.addcdiv()addcmuladdcmul_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])amaxSee
oneflow.amax()aminSee
oneflow.amin()any([dim, keepdim])See
oneflow.any()arccosSee
oneflow.arccos()arccosharcsinSee
oneflow.arcsin()arcsinharctanSee
oneflow.arctan()arctanhargmaxSee
oneflow.argmax()argminSee
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()asinSee
oneflow.asin()asinhSee
oneflow.asinh()atanSee
oneflow.atan()atan2See
oneflow.atan2()atanhSee
oneflow.atanh()backward([gradient, retain_graph, create_graph])Computes the gradient of current tensor w.r.t. graph leaves.
baddbmmbernoullibernoulli_The inplace version of
oneflow.Tensor.bernoulli_().bfloat16bincountbitwise_andbitwise_notbitwise_orbitwise_xorbmmSee
oneflow.bmm()boolTensor.bool()is equivalent toTensor.to(oneflow.bool).broadcast_tobyteself.byte() is equivalent to self.to(oneflow.uint8).
castSee
oneflow.cast()ceilSee
oneflow.ceil()ceil_See
oneflow.ceil_()check_meta_consistencychunkSee
oneflow.chunk()clampSee
oneflow.clamp().clamp_Inplace version of
oneflow.Tensor.clamp().clamp_maxclamp_max_clamp_minclamp_min_clipAlias for
oneflow.Tensor.clamp().clip_Alias for
oneflow.Tensor.clamp_().cloneSee
oneflow.clone()conj()conj_physical()contiguouscontiguous_copy_(other)Copies the elements from src into self tensor and returns self.
cosSee
oneflow.cos()coshSee
oneflow.cosh()cpuReturns a copy of this object in CPU memory.
cross(other[, dim])See
oneflow.cross()cudaReturns a copy of this object in CUDA memory.
cumprod(dim[, dtype])cumsum(dim[, dtype])See
oneflow.cumsum()data_ptrdetachdiagSee
oneflow.diag()diagonaldigammaSee
oneflow.digamma()dimTensor.dim() → int
divSee
oneflow.div()div_(value)In-place version of
oneflow.Tensor.div().dotSee
oneflow.dot()doubleTensor.double()is equivalent toTensor.to(flow.float64).element_sizeTensor.element_size() → int
eq(other)See
oneflow.eq()equalSee
oneflow.equal()erf()See
oneflow.erf()erfc()See
oneflow.erfc()erfinvSee
oneflow.erfinv()erfinv_Inplace version of
oneflow.erfinv()expSee
oneflow.exp()exp2See
oneflow.exp2()expand()See
oneflow.expand()expand_as(other)Expand this tensor to the same size as
other.expm1See
oneflow.expm1()exponential_([lambd, generator])fill_Tensor.fill_(value) → Tensor
flattenflipSee
oneflow.flip()floatTensor.float()is equivalent toTensor.to(flow.float32).floorSee
oneflow.floor()floor_See
oneflow.floor_()floor_dividefmod(other)See
oneflow.fmod()fracSee
oneflow.frac().frac_In-place version of
oneflow.Tensor.frac().gather(dim, index)See
oneflow.gather()geSee
oneflow.ge()geluget_device()For CUDA tensors, this function returns the device ordinal of the GPU on which the tensor resides.
global_idglobal_to_global([placement, sbp, grad_sbp, …])Performs Tensor placement and/or sbp conversion.
gtSee
oneflow.gt()gt_(value)In-place version of
oneflow.Tensor.gt().halfself.half() is equivalent to self.to(dtype=oneflow.float16).
imag()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)intTensor.int()is equivalent toTensor.to(flow.int32).inverseis_consistent()is_contiguous()Returns True if self tensor is contiguous in memory.
is_floating_pointis_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.
is_viewiscloseisinfSee
oneflow.isinf()isnanSee
oneflow.isnan()itemReturns the value of this tensor as a standard Python number.
kaiming_normal_([a, mode, nonlinearity, …])kaiming_uniform_([a, mode, nonlinearity, …])leSee
oneflow.le()lerpSee
oneflow.lerp()lerp_See
oneflow.lerp_()loadLoad tensor data stored on the host (CPU) back to GPU memory.
local_to_global([placement, sbp, …])Creates a global tensor from a local tensor.
logSee
oneflow.log()log10See
oneflow.log10()log1pSee
oneflow.log1p()log2See
oneflow.log2()log_softmaxlogaddexp(other)logical_and()logical_not()logical_or()logical_xor()logsumexplongTensor.long()is equivalent toTensor.to(flow.int64).ltSee
oneflow.lt()masked_fillmasked_fill_In-place version of
oneflow.Tensor.masked_fill().masked_select(mask)matmulSee
oneflow.matmul()max(dim, index)See
oneflow.max()maximummean([dim, keepdim])See
oneflow.mean()medianSee
oneflow.median()min(dim, index)See
oneflow.min()minimummishSee
oneflow.mish()mmSee
oneflow.mm()modeSee
oneflow.mode()mul(value)See
oneflow.mul()mul_(value)In-place version of
oneflow.Tensor.mul().mvSee
oneflow.mv()nansumSee
oneflow.nansum()narrowSee
oneflow.narrow()ndimensionneSee
oneflow.ne()negSee
oneflow.neg()negativenelementTensor.nelement() → int
newConstructs 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
sizefilled 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
selftensor with elements samples from the normal distribution parameterized bymeanandstd.numelSee
oneflow.numel()numpy([dtype])Tensor.numpy() → numpy.ndarray
offloadTransfer tensor data from GPU memory back to host (CPU) memory.
orthogonal_([gain])permutepin_memory()Copies the tensor to pinned memory, if it’s not already pinned.
powSee
oneflow.pow()prod([dim, keepdim])See
oneflow.prod()quantilereal()reciprocalregister_hook(hook)Registers a backward hook.
reluSee
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.
reshapereshape_as(other)Returns this tensor as the same shape as other.
retain_gradEnables this Tensor to have their
gradpopulated duringbackward().rollSee
oneflow.roll()roundSee
oneflow.round()round_See
oneflow.round_()rsqrtSee
oneflow.rsqrt()scatter(dim, index, src, *[, reduce])scatter_(dim, index, src, *[, reduce])Inplace version of
oneflow.Tensor.scatter()scatter_addscatter_add_(dim, index, src)Inplace version of
oneflow.Tensor.scatter_add()seluSee
oneflow.selu()sigmoidsignSee
oneflow.sign()siluSee
oneflow.silu()sin()See
oneflow.sin()sin_See
oneflow.sin_()sinhSee
oneflow.sinh()sizeReturns the size of the self tensor.
softmaxsoftplussoftsignsort([dim, descending])See
oneflow.sort()splitSee
oneflow.split()sqrtSee
oneflow.sqrt()squareSee
oneflow.square()squeeze([dim])squeeze_([dim])In-place version of
oneflow.Tensor.squeeze()stdSee
oneflow.std()storage()storage_offset()Returns self tensor’s offset in the underlying storage in terms of number of storage elements (not bytes).
stridesubSee
oneflow.sub()sub_(value)In-place version of
oneflow.Tensor.sub().sum([dim, keepdim])See
oneflow.sum()swapaxesswapdimstSee
oneflow.t()tanSee
oneflow.tan()tanhSee
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_numpytolist()Returns the tensor as a (nested) list.
topkSee
oneflow.topk()transposetrilSee
oneflow.tril()tril_triuSee
oneflow.triu()triu_truncSee
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_asReturns this tensor cast to the type of the given tensor.
unbindSee
oneflow.unbind()unfoldReturns 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
uniqueSee
oneflow.unique()unsqueeze(dim)unsqueeze_(dim)In-place version of
oneflow.Tensor.unsqueeze()varSee
oneflow.var()viewReturns a new tensor with the same data as the
selftensor 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
TIs this Tensor with its dimensions reversed.
_ref_index_ref_tensor_tensor_buffer_shapes_and_dtypesdatadeviceIs the
oneflow.devicewhere this Tensor is, which is invalid for global tensor.dtypegradReturn the gradient calculated by autograd functions.
grad_fnReturn the function that created this tensor if it’s
requires_gradis True.is_cpuis_cudaIs True if the Tensor is stored on the GPU, False otherwise.
is_eageris_globalReturn whether this Tensor is a global tensor.
is_lazyReturn whether this Tensor is a lazy tensor.
is_leafAll Tensors that have
requires_gradwhich isFalsewill be leaf Tensors by convention.is_locallayoutndimplacementIs the
oneflow.placementwhere this Tensor is, which is invalid for local tensor.requires_gradIs
Trueif gradient need to be computed for this Tensor,Falseotherwise.sbpIs the
oneflow.sbprepresenting that how the data of the global tensor is distributed, which is invalid for local tensor.shape-