Named Tensor¶
-
class
namedtensor.
NamedTensor
(tensor, names, mask=0)[source]¶ -
assert_size
(**kwargs)¶ Return the raw shape of the tensor
-
property
dims
¶ Return the dim names for the tensor
-
op
(*axis_ops, dim=None, _drop=None, _add=None, **kwargs)[source]¶ Apply ops that may change dimensions sizes
-
rename
(dim, name)¶ Rename a dimension.
-
renorm
(p, name, maxnorm)[source]¶ Apply
torch.Tensor.renorm()
over name
-
property
shape
¶ The ordered dict of available dimensions.
-
size
(dim)¶ Return the raw shape of the tensor
-
split
(dim, names, **dim_sizes)¶ Split an of existing dimension into new dimensions.
-
stack
(dims, name)¶ Stack any number of existing dimensions into a single new dimension.
-
transpose
(*dims)¶ Return a new DataArray object with transposed dimensions.
-
property
values
¶ The raw underlying tensor object.
-
property
vshape
¶ The raw dim size for the tensor.
-
Basic Methods¶
These methods return a named tensor of the same form as the original.
_basic
(*args)¶
torch.Tensor.float()
torch.Tensor.trunc()
torch.Tensor.sqrt()
torch.Tensor.tan()
torch.Tensor.sign()
torch.Tensor.tanh()
torch.Tensor.log()
torch.Tensor.cuda()
torch.Tensor.half()
torch.Tensor.neg()
torch.Tensor.to()
torch.Tensor.cpu()
torch.Tensor.atan()
torch.Tensor.abs()
torch.Tensor.long()
torch.Tensor.cosh()
torch.Tensor.round()
torch.Tensor.sigmoid()
torch.Tensor.sin()
torch.Tensor.reciprocal()
torch.Tensor.contiguous()
torch.Tensor.cos()
torch.Tensor.acos()
torch.Tensor.short()
torch.Tensor.asin()
torch.Tensor.exp()
torch.Tensor.clone()
torch.Tensor.floor()
torch.Tensor.rsqrt()
torch.Tensor.byte()
torch.Tensor.relu()
torch.Tensor.detach()
torch.Tensor.double()
torch.Tensor.ceil()
torch.Tensor.frac()
torch.Tensor.sinh()
torch.Tensor.int()
torch.Tensor.expm1()
Reduction Methods¶
These methods return a named tensor with one or more reduced dimensions
_reduction
(dims, *args)¶
Tupled Reduction Methods¶
These methods return a tuple of named tensor with one or more reduced dimensions
_tuple_reduction
(dims, *args)¶
Non-Tensor Methods¶
These methods return non-tensor information.
_info
(*args)¶
torch.Tensor.backward()
torch.Tensor.stride()
torch.Tensor.storage()
torch.Tensor.is_contigious()
torch.Tensor.any()
torch.Tensor.numpy()
torch.Tensor.dim()
torch.Tensor.item()
torch.Tensor.type()
torch.Tensor.all()
torch.Tensor.storage_offset()
torch.Tensor.is_pinned()
torch.Tensor.tolist()
Broadcast Methods¶
These methods apply broadcasting before operating between two tensors.
_operate
(other, *args)¶
Inline Methods¶
These methods modify the tensor inline.
_operate
(*args)
torch.Tensor.random_()
torch.Tensor.sin_()
torch.Tensor.ceil_()
torch.Tensor.tan_()
torch.Tensor.rsqrt_()
torch.Tensor.abs_()
torch.Tensor.sign_()
torch.Tensor.tanh_()
torch.Tensor.round_()
torch.Tensor.floor_()
torch.Tensor.sinh_()
torch.Tensor.fill_()
torch.Tensor.log_()
torch.Tensor.cosh_()
torch.Tensor.exp_()
torch.Tensor.sqrt_()
torch.Tensor.sub_()
torch.Tensor.cos_()
torch.Tensor.asin_()
torch.Tensor.acos_()
torch.Tensor.clamp_()
torch.Tensor.pow_()
torch.Tensor.sigmoid_()
torch.Tensor.atan_()
torch.Tensor.fmod_()
Named Torch¶
Named torch ntorch is a module that wraps the core torch operations with named variants. It contains named variants of most of the the core torch functionality.
Dictionary Builders¶
These methods construct a new named tensor where the sizes are specified through an ordered dict of names.
-
_build
(ordereddict, *args)¶
Other Builders¶
These methods construct a new named tensor where the sizes are specified through an ordered dict of names.
-
_build
(ordereddict, *args)
Basic Functions¶
These functions return a named tensor of the same form as the original.
_basic
(*args)
torch.float()
torch.trunc()
torch.sqrt()
torch.tan()
torch.sign()
torch.tanh()
torch.log()
torch.cuda()
torch.sub()
torch.half()
torch.mul()
torch.to()
torch.cpu()
torch.atan()
torch.abs()
torch.long()
torch.cosh()
torch.round()
torch.clamp()
torch.fmod()
torch.sigmoid()
torch.sin()
torch.reciprocal()
torch.contiguous()
torch.cos()
torch.acos()
torch.pow()
torch.short()
torch.asin()
torch.exp()
torch.clone()
torch.floor()
torch.rsqrt()
torch.byte()
torch.relu()
torch.double()
torch.ceil()
torch.frac()
torch.sinh()
torch.int()
torch.expm1()
Named NN¶
Named nn ntorch.nn is a module that wraps the core nn operations with named variants.
Basic Modules¶
These modules constructors are like NN and they behave identically.
Module
(*args)¶
torch.nn.Dropout()
Update Modules¶
These modules constructors are like NN.
Module
(*args)
They have an extra method that allows for renaming the main named dimension.
spec
()¶
torch.nn.Linear()
torch.nn.Conv1d()
torch.nn.Conv2d()
torch.nn.Conv3d()
torch.nn.MaxPool1d()
torch.nn.MaxPool2d()
torch.nn.MaxPool3d()
torch.nn.ConstantPad1d()
torch.nn.ConstantPad2d()
torch.nn.ConstantPad3d()
Augment Modules¶
These modules constructors are like NN.
Module
(*args)
They have an extra method that allows you to name an extra appended dimension.
spec
()
torch.nn.Embedding()
Loss Modules¶
These modules constructors are like NN losses.
Module
(*args)
torch.nn.CrossEntropyLoss()
torch.nn.NLLLoss()
Distributions¶
A wrapping of the torch distributions library to make it more clear to sample and batch the object.
Builders¶
These methods construct a new named distributinon where the sizes are specified through an ordered dict of names.
-
_build
(ordereddict, *args)
torch.distributions.Gumbel
torch.distributions.Categorical
torch.distributions.Poisson
torch.distributions.LogNormal
torch.distributions.HalfNormal
torch.distributions.Normal
torch.distributions.Gamma
torch.distributions.HalfCauchy
torch.distributions.FisherSnedecor
torch.distributions.Binomial
torch.distributions.Exponential
torch.distributions.RelaxedBernoulli
torch.distributions.StudentT
torch.distributions.LowRankMultivariateNormal
torch.distributions.Beta
torch.distributions.NegativeBinomial
torch.distributions.Weibull
torch.distributions.OneHotCategorical
torch.distributions.RelaxedOneHotCategorical
torch.distributions.Cauchy
torch.distributions.Multinomial
torch.distributions.Independent
torch.distributions.Chi2
torch.distributions.TransformedDistribution
torch.distributions.MultivariateNormal
torch.distributions.Laplace
torch.distributions.Bernoulli
torch.distributions.Uniform
torch.distributions.Dirichlet
torch.distributions.Geometric
torch.distributions.Pareto