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

See oneflow.addcdiv()

addcdiv_

In-place version of oneflow.Tensor.addcdiv()

addcmul

See oneflow.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

See oneflow.arccosh()

arcsin

See oneflow.arcsin()

arcsinh

See oneflow.arcsinh()

arctan

See oneflow.arctan()

arctanh

See oneflow.arctanh()

argmax

See oneflow.argmax()

argmin

See oneflow.argmin()

argsort([dim, descending])

See oneflow.argsort()

argwhere()

See oneflow.argwhere()

as_strided(size, stride[, storage_offset])

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.

bernoulli

See oneflow.bernoulli()

bernoulli_

The inplace version of oneflow.Tensor.bernoulli_().

bfloat16

bincount

See oneflow.bincount()

bmm

See oneflow.bmm()

bool

Tensor.bool() is equivalent to Tensor.to(oneflow.bool).

broadcast_to

See oneflow.broadcast_to()

byte

self.byte() is equivalent to self.to(oneflow.uint8).

cast

See oneflow.cast()

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

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])

See oneflow.cumprod()

cumsum(dim[, dtype])

See oneflow.cumsum()

detach

diag

See oneflow.diag()

diagonal

See oneflow.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 to Tensor.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()

expand()

See oneflow.expand()

expand_as(other)

Expand this tensor to the same size as other.

expm1

See oneflow.expm1()

exponential_([lambd, generator])

fill_(value)

Tensor.fill_(value) → Tensor

flatten

See oneflow.flatten()

flip

See oneflow.flip()

float

Tensor.float() is equivalent to Tensor.to(flow.float32).

floor

See oneflow.floor()

floor_

In-place version of 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()

half

self.half() is equivalent to self.to(dtype=oneflow.float16).

in_top_k(targets, predictions, k)

See oneflow.in_top_k()

index_add(dim, index, source[, alpha])

index_add_(dim, index, source, *[, alpha])

The interface is consistent with PyTorch.

index_select(dim, index)

See oneflow.index_select()

int

Tensor.int() is equivalent to Tensor.to(flow.int32).

inverse()

is_consistent()

is_contiguous()

Returns True if self tensor is contiguous in memory.

is_floating_point

See oneflow.is_floating_point()

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()

local_to_global([placement, sbp, check_meta])

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()

See oneflow.logical_and()

logical_not()

See oneflow.logical_not()

logical_or()

See oneflow.logical_or()

logical_xor()

See oneflow.logical_xor()

logsumexp

See oneflow.logsumexp()

long

Tensor.long() is equivalent to Tensor.to(flow.int64).

lt

See oneflow.lt()

masked_fill

See oneflow.masked_fill()

masked_fill_

In-place version of oneflow.Tensor.masked_fill().

masked_select(mask)

See oneflow.masked_select()

matmul

See oneflow.matmul()

max(dim, index)

See oneflow.max()

maximum

See oneflow.maximum()

mean([dim, keepdim])

See oneflow.mean()

median

See oneflow.median()

min(dim, index)

See oneflow.min()

minimum

See oneflow.minimum()

mish

See oneflow.mish()

mm(mat2)

See oneflow.mm()

mul(value)

See oneflow.mul()

mul_(value)

In-place version of oneflow.Tensor.mul().

mv(vec)

See oneflow.mv()

nansum

See oneflow.nansum()

narrow

See oneflow.narrow()

ndimension

ne

See oneflow.ne()

neg

See oneflow.neg()

negative

See oneflow.negative()

nelement

Tensor.nelement() → int

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()

See oneflow.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])

See oneflow.nonzero()

norm([p, dim, keepdim, dtype])

See oneflow.norm()

normal_([mean, std, generator])

Fills self tensor with elements samples from the normal distribution parameterized by mean and std.

numel

See oneflow.numel()

numpy()

Tensor.numpy() → numpy.ndarray

orthogonal_([gain])

permute

See oneflow.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()

reciprocal

See oneflow.reciprocal()

register_hook(hook)

Registers a backward hook.

relu

See oneflow.relu()

relu_

repeat(*size)

See oneflow.repeat()

repeat_interleave(repeats[, dim, output_size])

See oneflow.repeat_interleave()

requires_grad_([requires_grad])

Sets this tensor’s requires_grad attribute in-place.

reshape

See oneflow.reshape()

reshape_as(other)

Returns this tensor as the same shape as other.

retain_grad

Enables this Tensor to have their grad populated during backward().

roll

See oneflow.roll()

round

See oneflow.round()

rsqrt

See oneflow.rsqrt()

scatter(dim, index, src, *[, reduce])

See oneflow.scatter()

scatter_(dim, index, src, *[, reduce])

Inplace version of oneflow.Tensor.scatter()

scatter_add(dim, index, src)

See oneflow.scatter_add()

scatter_add_(dim, index, src)

Inplace version of oneflow.Tensor.scatter_add()

selu

See oneflow.selu()

sigmoid

See oneflow.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

See oneflow.softmax()

softplus

See oneflow.softplus()

softsign

See oneflow.softsign()

sort([dim, descending])

See oneflow.sort()

split

See oneflow.split()

sqrt

See oneflow.sqrt()

square

See oneflow.square()

squeeze

See oneflow.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(other)

See oneflow.sub()

sub_(value)

In-place version of oneflow.Tensor.sub().

sum([dim, keepdim])

See oneflow.sum()

swapaxes

See oneflow.swapaxes()

swapdims

See oneflow.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(k[, dim, largest, sorted])

See oneflow.topk()

transpose

See oneflow.transpose()

tril

See oneflow.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(target)

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

See oneflow.unsqueeze()

var

See oneflow.var()

view

Returns a new tensor with the same data as the self tensor but of a different shape.

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 is False will be leaf Tensors by convention.

is_local

ndim

See oneflow.Tensor.dim()

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