Float8_e4m3fnTensor
Attributes
 Source
 Tensor.scala
 Graph

 Supertypes
Members list
Value members
Concrete methods
Attributes
 Definition Classes
 Source
 Tensor.scala
Inherited methods
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Divides each element of this tensor by the corresponding element of other
. *
Divides each element of this tensor by the corresponding element of other
. *
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Computes the absolute value of each element.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Tests if all elements of this tensor evaluate to true
.
Tests if all elements of this tensor evaluate to true
.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 See also
 Inherited from:
 Tensor
 Source
 Tensor.scala
Tests if any element of this tensor evaluates to true
.
Tests if any element of this tensor evaluates to true
.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Returns the indices of the maximum value of all elements in the tensor.
Returns the indices of the maximum value of all elements in the tensor.
This is the second value returned by torch.max(). See its documentation for the exact semantics of this method.
Example:
val a = torch.rand(Seq(1, 3))
a.argmax()
// tensor dtype=float32, shape=[1] 2
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Computes the gradient of current tensor w.r.t. graph leaves.
Computes the gradient of current tensor w.r.t. graph leaves.
The graph is differentiated using the chain rule. If the tensor is nonscalar (i.e. its data has more than one element) and requires gradient, the function additionally requires specifying gradient
. It should be a tensor of matching type and location, that contains the gradient of the differentiated function w.r.t. self
.
This function accumulates gradients in the leaves  you might need to zero .grad
attributes or set them to None
before calling it. See Default gradient layouts<defaultgradlayouts>
for details on the memory layout of accumulated gradients.
Note
If you run any forward ops, create gradient
, and/or call backward
in a userspecified CUDA stream context, see Stream semantics of backward passes<bwdcudastreamsemantics>
.
Note
When inputs
are provided and a given input is not a leaf, the current implementation will call its grad_fn (though it is not strictly needed to get this gradients). It is an implementation detail on which the user should not rely. See https://github.com/pytorch/pytorch/pull/60521#issuecomment867061780 for more details.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Returns a copy of input
.
Returns a copy of input
.
Attributes
 Note

This function is differentiable, so gradients will flow back from the result of this operation to
input
. To create a tensor without an autograd relationship toinput
seeTensor.detach
.  Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Copies the elements from src
into this tensor and returns this.
Copies the elements from src
into this tensor and returns this.
The src
tensor must be broadcastable with the self tensor. It may be of a different data type or reside on a different device.
Value parameters
 nonBlocking

if
true
and this copy is between CPU and GPU, the copy may occur asynchronously with respect to the host. For other cases, this argument has no effect.  src

the source tensor to copy from
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Returns a new tensor with the sine of the elements of this tensor.
Returns a new tensor with the sine of the elements of this tensor.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Returns a new Tensor, detached from the current graph.
Returns a new Tensor, detached from the current graph.
The result will never require gradient.
This method also affects forward mode AD gradients and the result will never have forward mode AD gradients.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Divides each element of this tensor by the corresponding element of other
. *
Divides each element of this tensor by the corresponding element of other
. *
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Computes elementwise equality
Computes elementwise equality
The argument can be a tensor whose shape is broadcastable with this tensor.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Computes elementwise equality
True if other
has the same size and elements as this tensor, false otherwise.
True if other
has the same size and elements as this tensor, false otherwise.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Compares the receiver object (this
) with the argument object (that
) for equivalence.
Compares the receiver object (this
) with the argument object (that
) for equivalence.
Any implementation of this method should be an equivalence relation:
 It is reflexive: for any instance
x
of typeAny
,x.equals(x)
should returntrue
.  It is symmetric: for any instances
x
andy
of typeAny
,x.equals(y)
should returntrue
if and only ify.equals(x)
returnstrue
.  It is transitive: for any instances
x
,y
, andz
of typeAny
ifx.equals(y)
returnstrue
andy.equals(z)
returnstrue
, thenx.equals(z)
should returntrue
.
If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is usually necessary to override hashCode
to ensure that objects which are "equal" (o1.equals(o2)
returns true
) hash to the same scala.Int. (o1.hashCode.equals(o2.hashCode)
).
Value parameters
 that

the object to compare against this object for equality.
Attributes
 Returns

true
if the receiver object is equivalent to the argument;false
otherwise.  Definition Classes

Tensor > Any
 Inherited from:
 Tensor
 Source
 Tensor.scala
Returns the tensor with elements exponentiated.
Returns the tensor with elements exponentiated.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Returns a new view of this tensor with singleton dimensions expanded to a larger size.
Returns a new view of this tensor with singleton dimensions expanded to a larger size.
Passing 1 as the size for a dimension means not changing the size of that dimension.
Tensor can be also expanded to a larger number of dimensions, and the new ones will be appended at the front. For the new dimensions, the size cannot be set to 1.
Expanding a tensor does not allocate new memory, but only creates a new view on the existing tensor where a dimension of size one is expanded to a larger size by setting the stride
to 0. Any dimension of size 1 can be expanded to an arbitrary value without allocating new memory.
Value parameters
 sizes

the desired expanded size
Attributes
 Note

More than one element of an expanded tensor may refer to a single memory location. As a result, inplace operations (especially ones that are vectorized) may result in incorrect behavior. If you need to write to the tensors, please clone them first.
 Example

val x = torch.tensor((Seq(Seq(1), Seq(2), Seq(3))) x.size // [3, 1] x.expand(3, 4) x.expand(1, 4) // 1 means not changing the size of that dimension
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Divides each element of this tensor by the corresponding element of other
and floors the result.
Divides each element of this tensor by the corresponding element of other
and floors the result.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Divides each element of this tensor by s
and floors the result.
Divides each element of this tensor by s
and floors the result.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
This function returns an undefined tensor by default and returns a defined tensor the first time a call to backward() computes gradients for this Tensor. The attribute will then contain the gradients computed and future calls to backward() will accumulate (add) gradients into it.
This function returns an undefined tensor by default and returns a defined tensor the first time a call to backward() computes gradients for this Tensor. The attribute will then contain the gradients computed and future calls to backward() will accumulate (add) gradients into it.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Returns the tensor with elements logged.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Accessing this property is equivalent to calling adjoint().
Accessing this property is equivalent to calling adjoint().
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Returns a view of this tensor with the last two dimensions transposed.
Returns a view of this tensor with the last two dimensions transposed.
x.mT
is equivalent to x.transpose(2, 1)
.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Fills elements of self tensor with value where mask is true
. The shape of mask must be broadcastable with the shape of the underlying tensor.
Fills elements of self tensor with value where mask is true
. The shape of mask must be broadcastable with the shape of the underlying tensor.
Value parameters
 mask

the boolean mask
 value

the value to fill in with
Attributes
 Returns

Tensor with masked elements set to
value
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Returns a tuple (values, indices)
where values
is the maximum value of each row of the input
tensor in the given dimension dim
. And indices
is the index location of each maximum value found (argmax).
Returns a tuple (values, indices)
where values
is the maximum value of each row of the input
tensor in the given dimension dim
. And indices
is the index location of each maximum value found (argmax).
If keepdim
is true
, the output tensors are of the same size as input
except in the dimension dim
where they are of size 1. Otherwise, dim
is squeezed (see :func:torch.squeeze
), resulting in the output tensors having 1 fewer dimension than input
.
Attributes
 Note

If there are multiple maximal values in a reduced row then the indices of the first maximal value are returned.
 Inherited from:
 Tensor
 Source
 Tensor.scala
Returns the maximum value of all elements of this tensor.
Returns the maximum value of all elements of this tensor.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 See also
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Returns a new tensor with the negative of the elements of this tensor.
Returns a new tensor with the negative of the elements of this tensor.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Returns the total number of elements in the input tensor.
Returns the total number of elements in the input tensor.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 See also
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 See also
 Inherited from:
 Tensor
 Source
 Tensor.scala
Repeats this tensor along the specified dimensions.
Repeats this tensor along the specified dimensions.
Unlike expand, this function copies the tensorâ€™s data.
Value parameters
 sizes

The number of times to repeat this tensor along each dimension
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Returns a new tensor with the sine of the elements of this tensor.
Returns a new tensor with the sine of the elements of this tensor.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Returns the sum of all elements of this tensor.
Returns the sum of all elements of this tensor.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Returns a summary of the contents of this tensor.
Returns a summary of the contents of this tensor.
Value parameters
 flattened

If
true
, the summary is flattened to one line. Otherwise, the summary may span multiple lines.  includeInfo

If
true
, the data type and the shape of the tensor are explicitly included in the summary. Otherwise, they are not.  maxEntries

Maximum number of entries to show for each axis/dimension. If the size of an axis exceeds
maxEntries
, the output of that axis will be shortened to the first and last three elements. Defaults to6
. Values below6
are ignored.
Attributes
 Returns

Tensor summary.
 Inherited from:
 Tensor
 Source
 Tensor.scala
Expects input
to be <= 2D tensor and transposes dimensions 0 and 1.
Expects input
to be <= 2D tensor and transposes dimensions 0 and 1.
0D and 1D tensors are returned as is. When input is a 2D tensor this is equivalent to transpose(input, 0, 1)
.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Performs Tensor dtype and/or device conversion.
Performs Tensor dtype and/or device conversion.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Returns a string representation of the object.
Returns a string representation of the object.
The default representation is platform dependent.
Attributes
 Returns

a string representation of the object.
 Definition Classes

Tensor > Any
 Inherited from:
 Tensor
 Source
 Tensor.scala
Returns the sum of the elements of the diagonal of the input 2D matrix.
Returns the sum of the elements of the diagonal of the input 2D matrix.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Returns a tensor that is a transposed version of input
(this Tensor). The given dimensions dim0
and dim1
are swapped.
Returns a tensor that is a transposed version of input
(this Tensor). The given dimensions dim0
and dim1
are swapped.
If input
is a strided tensor then the resulting out
tensor shares its underlying storage with the input
tensor, so changing the content of one would change the content of the other.
If input
is a sparse tensor then the resulting out
tensor does not share the underlying storage with the input tensor.
If input is a sparse tensor with compressed layout (SparseCSR, SparseBSR, SparseCSC or SparseBSC) the arguments dim0
and dim1
must be both batch dimensions, or must both be sparse dimensions. The batch dimensions of a sparse tensor are the dimensions preceding the sparse dimensions.
Value parameters
 dim0

the first dimension to be transposed
 dim1

the second dimension to be transposed
 input

the input tensor.
Attributes
 Returns

Tensor[D]
 See also
 Note

Transpositions which interchange the sparse dimensions of a SparseCSR or SparseCSC layout tensor will result in the layout changing between the two options. Transposition of the sparse dimensions of a
SparseBSR
orSparseBSC
layout tensor will likewise generate a result with the opposite layout.  Inherited from:
 Tensor
 Source
 Tensor.scala
Returns a new tensor with the negative of the elements of this tensor.
Returns a new tensor with the negative of the elements of this tensor.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Returns a new tensor with a dimension of size one inserted at the specified position.
Returns a new tensor with a dimension of size one inserted at the specified position.
The returned tensor shares the same underlying data with this tensor.
A dim
value within the range [input.dim()  1, input.dim() + 1)
can be used. Negative dim
will correspond to unsqueeze applied at dim
= dim + input.dim() + 1
.
Example:
val x = torch.Tensor(Seq(1, 2, 3, 4))
x.unsqueeze(0)
// [[1, 2, 3, 4]]
x.unsqueeze(1)
// [[1],
// [2],
// [3],
// [4]]
Value parameters
 dim

the index at which to insert the singleton dimension
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Set tensor value(s) at indices
Set tensor value(s) at indices
Attributes
 Example

val t = torch.zeros(Seq(2, 2)) // set first row to ones t(Seq(0)) = 1
 Inherited from:
 Tensor
 Source
 Tensor.scala
Calculates the variance of all elements of this tensor.
Calculates the variance of all elements of this tensor.
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala
Attributes
 Inherited from:
 Tensor
 Source
 Tensor.scala