Int64Tensor

torch.Int64Tensor
sealed class Int64Tensor(native: Tensor) extends Tensor[Int64]

Attributes

Source
Tensor.scala
Graph
Supertypes
class Tensor[Int64]
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def dtype: Int64

Attributes

Definition Classes
Source
Tensor.scala

Inherited methods

def *[D2 <: DType](other: Tensor[D2]): Tensor[Promoted[D, D2]]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def *[S <: ScalaType](s: S): Tensor[Promoted[D, ScalaToDType[S]]]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def *=[S <: ScalaType](s: S): Tensor.this.type

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def *=[D2 <: DType](other: Tensor[D2]): Tensor.this.type

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def +[D2 <: DType](other: Tensor[D2]): Tensor[Promoted[D, D2]]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def +[S <: ScalaType](s: S): Tensor[Promoted[D, ScalaToDType[S]]]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def +=[S <: ScalaType](s: S): Tensor.this.type

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def +=[D2 <: DType](other: Tensor[D2]): Tensor.this.type

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def -[D2 <: DType](other: Tensor[D2]): Tensor[Promoted[D, D2]]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def -[S <: ScalaType](s: S): Tensor[Promoted[D, ScalaToDType[S]]]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def -=[S <: ScalaType](s: S): Tensor.this.type

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def -=[D2 <: DType](other: Tensor[D2]): Tensor.this.type

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def /[D2 <: DType](other: Tensor[D2]): Tensor[Div[D, D2]]

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
def /[S <: ScalaType](s: S): Tensor[Div[D, ScalaToDType[S]]]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def /=[S <: ScalaType](s: S)(using Int64 <:< FloatNN): Tensor.this.type

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def /=[D2 <: DType](other: Tensor[D2])(using Int64 <:< FloatNN): Tensor.this.type

Attributes

Inherited from:
Tensor
Source
Tensor.scala

Attributes

Inherited from:
Tensor
Source
Tensor.scala

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def ==(other: Tensor[_]): Tensor[Bool]

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
def `@`[D2 <: DType](u: Tensor[D2]): Tensor[Promoted[D, D2]]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def abs: Tensor[D]

Computes the absolute value of each element.

Computes the absolute value of each element.

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def acos: Tensor[D]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def add[D2 <: DType](other: Tensor[D2]): Tensor[Promoted[D, D2]]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def add[S <: ScalaType](s: S): Tensor[Promoted[D, ScalaToDType[S]]]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def adjoint: Tensor[D]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def all: Tensor[Bool]

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
def any: Tensor[Bool]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def apply[T <: Boolean | Long : ClassTag](indices: Slice | Int | Long | Tensor[Bool] | Tensor[UInt8] | Tensor[Int64] | Seq[T] | None.type | Ellipsis*): Tensor[D]

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
def backward(): Unit

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 non-scalar (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<default-grad-layouts> for details on the memory layout of accumulated gradients.

Note

If you run any forward ops, create gradient, and/or call backward in a user-specified CUDA stream context, see Stream semantics of backward passes<bwd-cuda-stream-semantics>.

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#issuecomment-867061780 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 to input see Tensor.detach.

Inherited from:
Tensor
Source
Tensor.scala
def contiguous: Tensor[D]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def copy_(src: Tensor[_], nonBlocking: Boolean): Tensor.this.type

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
def detach(): Tensor[D]

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
def device: Device

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def dim: Int

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def div[D2 <: DType](other: Tensor[D2]): Tensor[Div[D, D2]]

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
def div[S <: ScalaType](s: S): Tensor[Div[D, ScalaToDType[S]]]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def eq(other: Tensor[_]): Tensor[Bool]

Computes element-wise equality

Computes element-wise equality

The argument can be a tensor whose shape is broadcastable with this tensor.

Attributes

Inherited from:
Tensor
Source
Tensor.scala

Computes element-wise equality

Computes element-wise equality

Attributes

Inherited from:
Tensor
Source
Tensor.scala

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
override def equals(that: Any): Boolean

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 type Any, x.equals(x) should return true.
  • It is symmetric: for any instances x and y of type Any, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any instances x, y, and z of type Any if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.

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
def exp: Tensor[D]

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, in-place 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
def flatten: Tensor[D]

Attributes

Inherited from:
Tensor
Source
Tensor.scala

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def floorDivide[D2 <: DType](other: Tensor[D2]): Tensor[Div[D, D2]]

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

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def grad: Option[Tensor[D]]

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
def index[T <: Boolean | Long : ClassTag](indices: Slice | Int | Long | Tensor[Bool] | Tensor[UInt8] | Tensor[Int64] | Seq[T] | None.type | Ellipsis*): Tensor[D]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def info: String

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
def isnan: Tensor[Bool]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def item: DTypeToScala[D]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def layout: Layout

Attributes

Inherited from:
Tensor
Source
Tensor.scala

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def log: Tensor[D]

Returns the tensor with elements logged.

Returns the tensor with elements logged.

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def long: Tensor[Int64]

Attributes

Inherited from:
Tensor
Source
Tensor.scala

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def mH: Tensor[D]

Accessing this property is equivalent to calling adjoint().

Accessing this property is equivalent to calling adjoint().

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def mT: Tensor[D]

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
def matmul[D2 <: DType](u: Tensor[D2]): Tensor[Promoted[D, D2]]

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
def max(): Tensor[D]

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
def maximum[D2 <: DType](other: Tensor[D2]): Tensor[Promoted[D, D2]]

Attributes

Inherited from:
Tensor
Source
Tensor.scala

Attributes

See also
Inherited from:
Tensor
Source
Tensor.scala
def mean: Tensor[D]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def min(): Tensor[Int64]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def minimum[D2 <: DType](other: Tensor[D2]): Tensor[Promoted[D, D2]]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def mul[D2 <: DType](other: Tensor[D2]): Tensor[Promoted[D, D2]]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def mul[S <: ScalaType](s: S): Tensor[Promoted[D, ScalaToDType[S]]]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def neg: Tensor[D]

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
def numel: Long

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
def permute(dims: Int*): Tensor[D]

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
def prod[D <: DType](dtype: D): Tensor[DType]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def repeat(sizes: Int*): Tensor[D]

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
def reshape(shape: Int*): Tensor[D]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def shape: Seq[Int]

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
def size: Seq[Int]

Attributes

Inherited from:
Tensor
Source
Tensor.scala

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def split(splitSize: Int | Seq[Int], dim: Int): Seq[Tensor[D]]

Attributes

Inherited from:
Tensor
Source
Tensor.scala

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def squeeze: Tensor[D]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def std: Tensor[D]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def sub[D2 <: DType](other: Tensor[D2]): Tensor[Promoted[D, D2]]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def sub[S <: ScalaType](s: S): Tensor[Promoted[D, ScalaToDType[S]]]

Attributes

Inherited from:
Tensor
Source
Tensor.scala

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def sum: Tensor[Sum[D]]

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 to 6. Values below 6 are ignored.

Attributes

Returns

Tensor summary.

Inherited from:
Tensor
Source
Tensor.scala
def t: Tensor[D]

Expects input to be <= 2-D tensor and transposes dimensions 0 and 1.

Expects input to be <= 2-D tensor and transposes dimensions 0 and 1.

0-D and 1-D tensors are returned as is. When input is a 2-D tensor this is equivalent to transpose(input, 0, 1).

Attributes

Inherited from:
Tensor
Source
Tensor.scala

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def takeAlongDim(indices: Tensor[Int64], dim: Int): Tensor

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
def to[U <: DType](dtype: U): Tensor[U]

Attributes

Inherited from:
Tensor
Source
Tensor.scala

Attributes

Inherited from:
Tensor
Source
Tensor.scala

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def toBuffer: TypedBuffer[DTypeToScala[D]]

Attributes

Inherited from:
Tensor
Source
Tensor.scala

Attributes

Inherited from:
Tensor
Source
Tensor.scala
override def toString: String

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
def trace: Tensor[D]

Returns the sum of the elements of the diagonal of the input 2-D matrix.

Returns the sum of the elements of the diagonal of the input 2-D 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 or SparseBSC layout tensor will likewise generate a result with the opposite layout.

Inherited from:
Tensor
Source
Tensor.scala
def unary_-: Tensor[D]

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
def unsqueeze(dim: Int): Tensor[D]

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
def view(shape: Int*): Tensor[D]

Attributes

Inherited from:
Tensor
Source
Tensor.scala
def zero_(): Tensor.this.type

Attributes

Inherited from:
Tensor
Source
Tensor.scala