TensorPlay
API symbolsnn
Copy
View MarkdownDownload .md

UninitializedParameter

class tensorplay.nn.UninitializedParameter(requires_grad=True, device=None, dtype=None)[source]

A parameter that is not initialized.

Uninitialized Parameters are a special case of tensorplay.nn.Parameter where the shape of the data is still unknown.

Unlike a tensorplay.nn.Parameter, uninitialized parameters hold no data and attempting to access some properties, like their shape, will throw a runtime error. The only operations that can be performed on a uninitialized parameter are changing its datatype, moving it to a different device and converting it to a regular tensorplay.nn.Parameter.

The default device or dtype to use when the parameter is materialized can be set during construction using e.g. device='cuda'.

abs(Tensor self) Tensor
abs_(Tensor(a!) self) -> Tensor(a!)
acos(Tensor self) Tensor
acosh(Tensor self) Tensor
add()
add_()

add_.Tensor(Tensor(a!) self, Tensor other, *, Scalar alpha=1) -> Tensor(a!) | add_.Scalar(Tensor(a!) self, Scalar other, Scalar alpha=1) -> Tensor(a!)

addbmm(Tensor self, Tensor batch1, Tensor batch2, *, Scalar beta=1, Scalar alpha=1) Tensor
addcdiv(Tensor self, Tensor tensor1, Tensor tensor2, *, Scalar value=1) Tensor
addcdiv_(Tensor(a!) self, Tensor tensor1, Tensor tensor2, *, Scalar value=1) -> Tensor(a!)
addcmul(Tensor self, Tensor tensor1, Tensor tensor2, *, Scalar value=1) Tensor
addcmul_(Tensor(a!) self, Tensor tensor1, Tensor tensor2, *, Scalar value=1) -> Tensor(a!)
addmv(Tensor self, Tensor mat, Tensor vec, *, Scalar beta=1, Scalar alpha=1) Tensor
addr(Tensor self, Tensor vec1, Tensor vec2, *, Scalar beta=1, Scalar alpha=1) Tensor
airy_ai(Tensor self) Tensor
all(Tensor self) -> Tensor | all.dim(Tensor self, int[] dim, bool keepdim=false) Tensor
allclose(Tensor self, Tensor other, float rtol=1e-05, float atol=1e-08, bool equal_nan=False) bool
angle(Tensor self) Tensor
any(Tensor self) -> Tensor | any.dim(Tensor self, int[] dim, bool keepdim=false) Tensor
argmax(Tensor self, int? dim=None, bool keepdim=False) Tensor
argmin(Tensor self, int? dim=None, bool keepdim=False) Tensor
argsort(Tensor self, int dim=-1, bool descending=False) Tensor
argwhere(Tensor self) Tensor
as_strided(self: tensorplay._C.TensorBase, size: collections.abc.Sequence[SupportsInt | SupportsIndex], stride: collections.abc.Sequence[SupportsInt | SupportsIndex], storage_offset: SupportsInt | SupportsIndex | None = None) tensorplay._C.TensorBase
asin(Tensor self) Tensor
asinh(Tensor self) Tensor
atan(Tensor self) Tensor
atan2(Tensor self, Tensor other) Tensor
atanh(Tensor self) Tensor
backward(self: tensorplay._C.TensorBase, gradient: tensorplay._C.TensorBase | None = None, retain_graph: bool | None = None, create_graph: bool = False) None
bernoulli(Tensor self) Tensor
bernoulli_(Tensor(a!) self) -> Tensor(a!)
bessel_j0(Tensor self) Tensor
bessel_j1(Tensor self) Tensor
bessel_y0(Tensor self) Tensor
bessel_y1(Tensor self) Tensor
bincount(Tensor self, Tensor? weights=None, int minlength=0) Tensor
bitwise_and()
bitwise_left_shift()
bitwise_not(Tensor self) Tensor
bitwise_or()
bitwise_right_shift()
bitwise_xor()
bmm(Tensor self, Tensor mat2) Tensor
broadcast_to(Tensor self, int[] size) Tensor
cauchy_(Tensor(a!) self, float median=0.0, float sigma=1.0) -> Tensor(a!)
ceil(Tensor self) Tensor
celu(Tensor self, Scalar alpha=1.0) Tensor
channel_shuffle(Tensor self, int groups) Tensor
cholesky(Tensor self, bool upper=False) Tensor
cholesky_inverse(Tensor self, bool upper=False) Tensor
cholesky_solve(Tensor self, Tensor input2, bool upper=False) Tensor
chunk(Tensor self, int chunks, int dim=0) Tensor[]
clamp(Tensor self, Scalar? min=None, Scalar? max=None) Tensor
clamp_(Tensor(a!) self, Scalar? min=None, Scalar? max=None) -> Tensor(a!)
clip(Tensor self, Scalar? min=None, Scalar? max=None) Tensor
clone(Tensor self, *, MemoryFormat? memory_format=None) Tensor
cls_to_become

alias of Parameter

coalesce(self: tensorplay._C.TensorBase) tensorplay._C.TensorBase
col_indices(self: tensorplay._C.TensorBase) tensorplay._C.TensorBase
conj(Tensor self) Tensor
contiguous(Tensor self, *, MemoryFormat memory_format=Contiguous) Tensor
copy_(Tensor(a!) self, Tensor src, bool non_blocking=False) -> Tensor(a!)
cos(Tensor self) Tensor
cosh(Tensor self) Tensor
cpu()

Returns a copy of this object in CPU memory. If this object is already in CPU memory, then no copy is performed and the original object is returned.

crow_indices(self: tensorplay._C.TensorBase) tensorplay._C.TensorBase
cuda(device=None, non_blocking=False)

Returns a copy of this object in CUDA memory. If this object is already in CUDA memory and on the correct device, then no copy is performed and the original object is returned.

cummax(Tensor self, int dim) -> (Tensor values, Tensor indices)
cummin(Tensor self, int dim) -> (Tensor values, Tensor indices)
cumprod(Tensor self, int dim, ScalarType? dtype=None) Tensor
cumsum(Tensor self, int dim=0, ScalarType? dtype=None) Tensor
data_ptr(self: tensorplay._C.TensorBase) int
deg2rad(Tensor self) Tensor
dense_dim(self: tensorplay._C.TensorBase) int
dequantize_per_channel(Tensor self, Tensor scales, Tensor zero_points, int axis=0) Tensor
dequantize_per_tensor(Tensor self, float scale, int zero_point) Tensor
detach(self: tensorplay._C.TensorBase) tensorplay._C.TensorBase
detach_(self: object) object
diag(Tensor self, int diagonal=0) Tensor
diag_embed(Tensor self, int offset=0, int dim1=0, int dim2=1) Tensor
diagonal(Tensor self, int offset=0, int dim1=0, int dim2=1) Tensor
diagonal_scatter(Tensor self, Tensor src, int offset=0, int dim1=0, int dim2=1) Tensor
digamma(Tensor self) Tensor
dim(self: tensorplay._C.TensorBase) int
dist(Tensor self, Tensor other, Scalar p=2) Tensor
div()
div_()

div_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) | div_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!)

dot(Tensor self, Tensor tensor) Tensor
dsplit()
element_size(self: tensorplay._C.TensorBase) int
elu(Tensor self, Scalar alpha=1, Scalar scale=1, Scalar input_scale=1) Tensor
eq()
equal(Tensor self, Tensor other) bool
erf(Tensor self) Tensor
erfc(Tensor self) Tensor
erfinv(Tensor self) Tensor
exp(Tensor self) Tensor
exp2(Tensor self) Tensor
expand_as(Tensor self, Tensor other) Tensor
expm1(Tensor self) Tensor
exponential_(Tensor(a!) self, float lambd=1.0) -> Tensor(a!)
fill_()

fill_.Scalar(Tensor(a!) self, Scalar value) -> Tensor(a!)

fix(Tensor self) Tensor
flatten(start_dim=0, end_dim=-1)

Flattens a contiguous range of dims.

floor(Tensor self) Tensor
frac(Tensor self) Tensor
gather(Tensor self, int dim, Tensor index) Tensor
gcd(Tensor self, Tensor other) Tensor
ge()
gelu(Tensor self, str approximate="none") Tensor
geometric_(Tensor(a!) self, float p) -> Tensor(a!)
glu(Tensor self, int dim=-1) Tensor
greater(Tensor self, Tensor other) Tensor
greater_equal(Tensor self, Tensor other) Tensor
gt()
hardshrink(Tensor self, Scalar lambd=0.5) Tensor
hardsigmoid(Tensor self) Tensor
hardswish(Tensor self) Tensor
hardtanh(Tensor self, Scalar min_val=-1, Scalar max_val=1) Tensor
heaviside(Tensor self, Tensor values) Tensor
hsplit()
hypot(Tensor self, Tensor other) Tensor
i0e(Tensor self) Tensor
i1(Tensor self) Tensor
i1e(Tensor self) Tensor
imag(Tensor self) Tensor
index_copy(Tensor self, int dim, Tensor index, Tensor source) Tensor
index_fill()
index_fill_()

index_fill_.Scalar(Tensor(a!) self, int dim, Tensor index, Scalar value) -> Tensor(a!) | index_fill_.Tensor(Tensor(a!) self, int dim, Tensor index, Tensor value) -> Tensor(a!)

index_put(Tensor self, Tensor[] indices, Tensor values, bool accumulate=False) Tensor
index_put_(Tensor(a!) self, Tensor[] indices, Tensor values, bool accumulate=False) -> Tensor(a!)
index_select(Tensor self, int dim, Tensor index) Tensor
inner(Tensor self, Tensor other) Tensor
is_channels_last(self: tensorplay._C.TensorBase) bool
is_channels_last_2d(self: tensorplay._C.TensorBase) bool
is_channels_last_3d(self: tensorplay._C.TensorBase) bool
is_coalesced(self: tensorplay._C.TensorBase) bool
is_complex(self: tensorplay._C.TensorBase) bool
is_contiguous(*args, **kwargs)

Overloaded function.

  1. is_contiguous(self: tensorplay._C.TensorBase) -> bool

  2. is_contiguous(self: tensorplay._C.TensorBase, memory_format: typing.SupportsInt | typing.SupportsIndex) -> bool

is_floating_point(self: tensorplay._C.TensorBase) bool
is_pinned(self: tensorplay._C.TensorBase) bool
is_shared(self: object) bool
is_sparse_csr(self: tensorplay._C.TensorBase) bool
isclose(Tensor self, Tensor other, float rtol=1e-05, float atol=1e-08, bool equal_nan=False) Tensor
isfinite(Tensor self) Tensor
isinf(Tensor self) Tensor
isnan(Tensor self) Tensor
isneginf(Tensor self) Tensor
isposinf(Tensor self) Tensor
isreal(Tensor self) Tensor
itemsize(self: tensorplay._C.TensorBase) int
kthvalue(Tensor self, int k, int dim=-1, bool keepdim=False) -> (Tensor values, Tensor indices)
lcm(Tensor self, Tensor other) Tensor
le()
leaky_relu(Tensor self, Scalar negative_slope=0.01) Tensor
lerp(Tensor self, Tensor end, Scalar weight) -> Tensor | lerp.Tensor(Tensor self, Tensor end, Tensor weight) Tensor
lerp_()

lerp_.Scalar(Tensor(a!) self, Tensor end, Scalar weight) -> Tensor(a!) | lerp_.Tensor(Tensor(a!) self, Tensor end, Tensor weight) -> Tensor(a!)

less(Tensor self, Tensor other) Tensor
less_equal(Tensor self, Tensor other) Tensor
lgamma(Tensor self) Tensor
log(Tensor self) Tensor
log10(Tensor self) Tensor
log1p(Tensor self) Tensor
log2(Tensor self) Tensor
log_normal_(Tensor(a!) self, float mean=1.0, float std=2.0) -> Tensor(a!)
log_softmax(Tensor self, int dim, ScalarType dtype=Undefined) Tensor
logaddexp(Tensor self, Tensor other) Tensor
logaddexp2(Tensor self, Tensor other) Tensor
logcumsumexp(Tensor self, int dim, ScalarType? dtype=None) Tensor
logical_not(Tensor self) Tensor
logical_or(Tensor self, Tensor other) Tensor
logical_xor(Tensor self, Tensor other) Tensor
logit(Tensor self, Scalar? eps=None) Tensor
logsumexp(Tensor self, int dim, bool keepdim=False) Tensor
lt()
masked_fill()
masked_fill_()

masked_fill_.Tensor(Tensor(a!) self, Tensor mask, Tensor value) -> Tensor(a!) | masked_fill_(Tensor(a!) self, Tensor mask, Scalar value) -> Tensor(a!)

masked_scatter(Tensor self, Tensor mask, Tensor source) Tensor
masked_select(Tensor self, Tensor mask) Tensor
materialize(shape, device=None, dtype=None)

Create a Parameter or Tensor with the same properties of the uninitialized one.

Given a shape, it materializes a parameter in the same device and with the same dtype as the current one or the specified ones in the arguments.

Parameters:
  • shape – (tuple): the shape for the materialized tensor.

  • device (tensorplay.device) – the desired device of the parameters and buffers in this module. Optional.

  • dtype (tensorplay.dtype) – the desired floating point type of the floating point parameters and buffers in this module. Optional.

matmul(Tensor self, Tensor other) Tensor
max(Tensor self) -> Tensor | max.dim(Tensor self, int[] dim, bool keepdim=false) Tensor
mean(Tensor self, *, ScalarType dtype=Undefined) -> Tensor | mean.dim(Tensor self, int[] dim, bool keepdim=false, *, ScalarType dtype=Undefined) Tensor
median(Tensor self) Tensor
memory_format(self: tensorplay._C.TensorBase) int
min(Tensor self) -> Tensor | min.dim(Tensor self, int[] dim, bool keepdim=false) Tensor
mish(Tensor self) Tensor
mm(Tensor self, Tensor mat2) Tensor
mode(Tensor self, int dim=-1, bool keepdim=False) -> (Tensor values, Tensor indices)
modified_bessel_i1(Tensor self) Tensor
modified_bessel_k0(Tensor self) Tensor
modified_bessel_k1(Tensor self) Tensor
moveaxis()
movedim(Tensor self, int[] source, int[] destination) Tensor
msort(Tensor self) Tensor
mul()
mul_()

mul_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!) | mul_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!)

mv(Tensor self, Tensor vec) Tensor
nan_to_num(Tensor self, Scalar nan=0.0, Scalar? posinf=None, Scalar? neginf=None) Tensor
nanmean(Tensor self, int? dim=None, bool keepdim=False, *, ScalarType? dtype=None) Tensor
nanmedian(Tensor self) Tensor
nansum(Tensor self, int[] dim=[], bool keepdim=False) Tensor
narrow(Tensor self, int dim, int start, int length) Tensor
ndimension() int

Alias for dim()

ne()
neg(Tensor self) Tensor
neg_(Tensor(a!) self) -> Tensor(a!)
negative(Tensor self) Tensor
nextafter(Tensor self, Tensor other) Tensor
norm(Tensor self, float p=2.0) -> Tensor | norm.dim(Tensor self, int[] dim, float p=2.0, bool keepdim=false) Tensor
normal_(Tensor(a!) self, float mean=0.0, float std=1.0) -> Tensor(a!)
not_equal(Tensor self, Tensor other) Tensor
numel(self: tensorplay._C.TensorBase) int
numpy(self: object) numpy.ndarray
outer(Tensor self, Tensor vec2) Tensor
pdist(Tensor self, float p=2.0) Tensor
pin_memory(self: tensorplay._C.TensorBase) tensorplay._C.TensorBase
poisson(Tensor self) Tensor
polygamma(int n, Tensor self) Tensor
positive(Tensor self) Tensor
pow()
prelu(Tensor self, Tensor weight) Tensor
prod(Tensor self, *, ScalarType dtype=Undefined) -> Tensor | prod.dim_IntList(Tensor self, int[] dim, bool keepdim=false, *, ScalarType dtype=Undefined) Tensor
quantize_per_channel(Tensor self, Tensor scales, Tensor zero_points, int axis=0) Tensor
quantize_per_tensor(Tensor self, float scale, int zero_point, int quant_min=-128, int quant_max=127) Tensor
rad2deg(Tensor self) Tensor
random_(Tensor(a!) self, int low=0, int high=0) -> Tensor(a!)
ravel(Tensor self) Tensor
reciprocal(Tensor self) Tensor
register_hook(hook)

Registers a backward hook (torch’s Tensor.register_hook).

The hook is called every time a gradient with respect to this tensor is computed. It may modify the gradient by returning a replacement Tensor; returning None leaves the gradient unchanged. Hooks compose in registration order.

Returns a RemovableHandle whose remove() method (or context-manager form) unregisters the hook.

register_post_accumulate_grad_hook(hook)

Registers a hook (torch’s Tensor.register_post_accumulate_grad_hook).

The hook runs after the gradient has been accumulated into self.grad. It receives the tensor (the parameter) and its return value is ignored; unlike register_hook() it cannot replace the gradient, but it may modify self.grad in place. Only leaf tensors that require grad and are used in the autograd graph support this hook.

Returns a RemovableHandle.

relu(Tensor self) Tensor
relu6(Tensor self) Tensor
relu_(Tensor(a!) self) -> Tensor(a!)
renorm(Tensor self, Scalar p, int dim, Scalar maxnorm) Tensor
repeat(Tensor self, int[] repeats) Tensor
requires_grad_(self: object, requires_grad: bool = True) object
reshape(Tensor self, int[] shape) Tensor
resize_(Tensor(a!) self, int[] size) -> Tensor(a!)
retain_grad(self: tensorplay._C.TensorBase) None
rot90(Tensor self, int k=1, int[] dims=[]) Tensor
round(Tensor self) Tensor
rsqrt(Tensor self) Tensor
rsqrt_(Tensor(a!) self) -> Tensor(a!)
scaled_modified_bessel_k0(Tensor self) Tensor
scaled_modified_bessel_k1(Tensor self) Tensor
scatter()
scatter_()

scatter_.src(Tensor(a!) self, int dim, Tensor index, Tensor src) -> Tensor(a!) | scatter_.value(Tensor(a!) self, int dim, Tensor index, Scalar value) -> Tensor(a!)

scatter_add(Tensor self, int dim, Tensor index, Tensor src) Tensor
scatter_add_(Tensor(a!) self, int dim, Tensor index, Tensor src) -> Tensor(a!)
select(Tensor self, int dim, int index) Tensor
select_scatter(Tensor self, Tensor src, int dim, int index) Tensor
selu(Tensor self) Tensor
sgn(Tensor self) Tensor
sigmoid(Tensor self) Tensor
sign(Tensor self) Tensor
signbit(Tensor self) Tensor
silu(Tensor self) Tensor
sin(Tensor self) Tensor
sinc(Tensor self) Tensor
sinh(Tensor self) Tensor
size(*args, **kwargs)

Overloaded function.

  1. size(self: tensorplay._C.TensorBase) -> tensorplay._C.Size

  2. size(self: tensorplay._C.TensorBase, arg0: typing.SupportsInt | typing.SupportsIndex) -> int

slice(Tensor self, int dim=0, int? start=None, int? end=None, int step=1) Tensor
slice_scatter(Tensor self, Tensor src, int dim=0, int? start=None, int? end=None, int step=1) Tensor
softmax(Tensor self, int dim, ScalarType dtype=Undefined) Tensor
softplus(Tensor self, Scalar beta=1, Scalar threshold=20) Tensor
softshrink(Tensor self, Scalar lambd=0.5) Tensor
sort(Tensor self, int dim=-1, bool descending=False) -> (Tensor values, Tensor indices)
sparse_dim(self: tensorplay._C.TensorBase) int
sparse_mask(self: tensorplay._C.TensorBase, mask: tensorplay._C.TensorBase) tensorplay._C.TensorBase
sparse_sum(Tensor self, int[]? dim=None, ScalarType? dtype=None) Tensor
spherical_bessel_j0(Tensor self) Tensor
split(Tensor self, int split_size, int dim=0) -> Tensor[] | split.sizes(Tensor self, int[] split_sizes, int dim=0) Tensor[]
split_with_sizes(Tensor self, int[] split_sizes, int dim=0) Tensor[]
sqrt(Tensor self) Tensor
sqrt_(Tensor(a!) self) -> Tensor(a!)
square(Tensor self) Tensor
squeeze(Tensor self) -> Tensor | squeeze.dim(Tensor self, int dim) Tensor
std(Tensor self, int correction=1) -> Tensor | std.dim(Tensor self, int[] dim, int correction=1, bool keepdim=false) Tensor
stride(*args, **kwargs)

Overloaded function.

  1. stride(self: tensorplay._C.TensorBase) -> tuple

  2. stride(self: tensorplay._C.TensorBase, arg0: typing.SupportsInt | typing.SupportsIndex) -> int

sub()
sub_()

sub_.Tensor(Tensor(a!) self, Tensor other, *, Scalar alpha=1) -> Tensor(a!) | sub_.Scalar(Tensor(a!) self, Scalar other, Scalar alpha=1) -> Tensor(a!)

sum(Tensor self, *, ScalarType dtype=Undefined) -> Tensor | sum.dim_IntList(Tensor self, int[] dim, bool keepdim=false, *, ScalarType dtype=Undefined) Tensor
svd(Tensor self, bool some=True, bool compute_uv=True) -> (Tensor U, Tensor S, Tensor V)
swapaxes(Tensor self, int axis0, int axis1) Tensor
swapdims(Tensor self, int dim0, int dim1) Tensor
t()

Returns the transpose of the tensor. Aliased to transpose(0, 1) to ensure correct autograd behavior (TransposeBackward).

take(Tensor self, Tensor index) Tensor
take_along_dim(Tensor self, Tensor indices, int? dim=None) Tensor
tan(Tensor self) Tensor
tanh(Tensor self) Tensor
tensor_split()
tile(Tensor self, int[] dims) Tensor
to(*args, **kwargs)

Overloaded function.

  1. to(self: tensorplay._C.TensorBase, dtype: tensorplay._C.DType, non_blocking: bool = False, copy: bool = False) -> tensorplay._C.TensorBase

  2. to(self: tensorplay._C.TensorBase, device: tensorplay._C.Device, non_blocking: bool = False, copy: bool = False) -> tensorplay._C.TensorBase

  3. to(self: tensorplay._C.TensorBase, device: tensorplay._C.Device, dtype: tensorplay._C.DType, non_blocking: bool = False, copy: bool = False) -> tensorplay._C.TensorBase

to_dense(Tensor self) Tensor
to_sparse(Tensor self) Tensor
to_sparse_csr(Tensor self) Tensor
tolist(self: tensorplay._C.TensorBase) object
trace(Tensor self) Tensor
transpose(Tensor self, int dim0, int dim1) Tensor
triangular_solve(Tensor self, Tensor A, bool upper=False, bool transpose=False, bool unitriangular=False) -> (Tensor solution, Tensor cloned_coefficient)
tril(Tensor self, int diagonal=0) Tensor
triu(Tensor self, int diagonal=0) Tensor
trunc(Tensor self) Tensor
type(dtype=None, non_blocking=False, **kwargs)

Returns the type if dtype is not provided, else casts this object to the specified type.

unbind(Tensor self, int dim=0) Tensor[]
unflatten(dim, sizes)

Expands a dimension of the input tensor over multiple dimensions.

unfold(dimension, size, step)

Returns a view of the original tensor which contains all slices of size size from self in the dimension dimension, stepping by step (torch’s Tensor.unfold).

Port of aten/src/ATen/native/TensorShape.cpp: the view appends a new trailing dimension of length size and re-strides dimension by step.

uniform_(Tensor(a!) self, float from=0.0, float to=1.0) -> Tensor(a!)
unsqueeze(Tensor self, int dim) Tensor
values(self: tensorplay._C.TensorBase) tensorplay._C.TensorBase
var(Tensor self, int correction=1) -> Tensor | var.dim(Tensor self, int[] dim, int correction=1, bool keepdim=false) Tensor
vdot(Tensor self, Tensor other) Tensor
view(Tensor self, int[] shape) Tensor
vsplit()
zero_(Tensor(a!) self) -> Tensor(a!)
zeta(Tensor self, Tensor other) Tensor
Ask DeepWiki