STen

lamp.STen
See theSTen companion object
case class STen

Memory managed, off-heap, GPU and CPU compatible N-dimensional array.

This class is a wrapper around aten.Tensor providing a more convenient API. All allocating operations require an implicit lamp.Scope.

STen instances are associated with a device which determines where the memory is allocated, and where the operations are performed. Operations on multiple tensors expect that all the arguments reside on the same device.

lamp.STen.options returns a lamp.STenOptions which describes the device, shape, data type and storage layout of a tensor. Most factory methods in the companion object in turn require a lamp.STenOptions to specify the device, data types and storage layout.

Naming convention of most operations follows libtorch. Operations return their result in a copy, i.e. not in place. These operations need a lamp.Scope. Operations whose name ends with an underscore are in place. Operations whose name contains out will write their results into the specified output tensor, these are in the companion object. Some operations are exempt from this naming rule, e.g. +=, -=, *= etc.

Semantics of operations follow those of libtorch with the same name. Many of the operations broadcasts. See https://numpy.org/doc/stable/user/basics.broadcasting.html#general-broadcasting-rules for broadcasting rules. In short:

  1. shapes are aligned from the right, extending with ones to the left as needed. 2. If two aligned dimensions are not matching but one of them is 1, then it is expanded to the size of the other dimension, pretending a copy of all its values. If two aligned dimension are not matching and neither of them is 1, then the operation fails. =Examples=
Scope.root { implicit scope =>
   val sum = Scope { implicit scope =>
   val ident = STen.eye(3, STenOptions.d)
   val ones = STen.ones(List(3, 3), STenOptions.d)
   ident + ones
   }
   assert(sum.toMat == mat.ones(3, 3) + mat.ident(3))
}

===Broadcasting examples===

// successful
3 x 4 x 6 A
   4 x 6 B
3 x 4 x 6 Result // B is repeated 3 times first dimensions

// successful
3 x 4 x 6 A
3 x 1 x 6 B
3 x 4 x 6 Result // B's second dimension is repeated 4 times

// fail
3 x 4 x 6 A
3 x 2 x 6 B
3 x 4 x 6 Result // 2 != 4

The companion object contains various factories which copy data from the JVM memory to STen tensors.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def *[S : Sc](other: STen): STen

Multiplication

Multiplication

Attributes

def *[S : Sc](other: Long): STen
def *[S : Sc](other: Tensor): STen

Multiplication

Multiplication

Attributes

def *[S : Sc](other: Double): STen

Multiplication

Multiplication

Attributes

def *=(other: STen): Unit

In place multiplication.

In place multiplication.

Attributes

def *=(other: Double): Unit

In place multiplication.

In place multiplication.

Attributes

def *=(other: Long): Unit

In place multiplication.

In place multiplication.

Attributes

def +[S : Sc](other: STen): STen

Adds to tensors.

Adds to tensors.

Attributes

def +[S : Sc](other: Double): STen

Adds a scalar to all elements.

Adds a scalar to all elements.

Attributes

def +[S : Sc](other: Long): STen

Adds a scalar to all elements.

Adds a scalar to all elements.

Attributes

def +=(other: STen): Unit

In place add.

In place add.

Attributes

def +=(other: Double): Unit

In place add.

In place add.

Attributes

def +=(other: Long): Unit

In place add.

In place add.

Attributes

def -[S : Sc](other: STen): STen

Subtracts other.

Subtracts other.

Attributes

def -=(other: STen): Unit

Subtracts other in place.

Subtracts other in place.

Attributes

def /[S : Sc](other: STen): STen

Division.

Division.

Attributes

def /[S : Sc](other: Tensor): STen

Division.

Division.

Attributes

def /[S : Sc](other: Double): STen

Division.

Division.

Attributes

def /[S : Sc](other: Long): STen

Division.

Division.

Attributes

def /=(other: STen): Unit

In place division.

In place division.

Attributes

def abs[S : Sc]: STen
def abs_(): Unit
def acos[S : Sc]: STen
def acos_(): Unit
def add[S : Sc](other: STen, alpha: Double): STen

Adds an other tensor multipled by a scalar (a + alpha * b).

Adds an other tensor multipled by a scalar (a + alpha * b).

Attributes

def add[S : Sc](other: Double, alpha: Double): STen

Adds a value multipled by a scalar (a + alpha * b).

Adds a value multipled by a scalar (a + alpha * b).

Attributes

def add_l[S : Sc](other: STen): STen

Adds to tensors.

Adds to tensors.

Attributes

def addcmul[S : Sc](tensor1: STen, tensor2: STen, alpha: Double): STen

Elementwise this + alpha * tensor1 * tensor2

Elementwise this + alpha * tensor1 * tensor2

Attributes

def addcmulSelf(tensor1: STen, tensor2: STen, alpha: Double): Unit

Elementwise in place this + alpha * tensor1 * tensor2

Elementwise in place this + alpha * tensor1 * tensor2

Attributes

def addcmulSelf(tensor1: STen, tensor2: Tensor, alpha: Double): Unit

Elementwise in place this + alpha * tensor1 * tensor2

Elementwise in place this + alpha * tensor1 * tensor2

Attributes

def addmm[S : Sc](mat1: STen, mat2: STen, beta: Double, alpha: Double): STen

beta * this + alpha * (mat1 matmul mat2)

beta * this + alpha * (mat1 matmul mat2)

Attributes

def all[S : Sc]: STen

Return a boolean scalar tensor indicating that all of the elements are true

Return a boolean scalar tensor indicating that all of the elements are true

Attributes

def all[S : Sc](dim: Int, keepDim: Boolean): STen

Return a boolean tensor indicating that all of the elements are true in the respective dimension

Return a boolean tensor indicating that all of the elements are true in the respective dimension

Attributes

def any[S : Sc]: STen

Return a boolean scalar tensor indicating that any of the elements is true

Return a boolean scalar tensor indicating that any of the elements is true

Attributes

def any[S : Sc](dim: Int, keepDim: Boolean): STen

Return a boolean tensor indicating that any of the elements true in the respective dimension

Return a boolean tensor indicating that any of the elements true in the respective dimension

Attributes

def argmax[S : Sc](dim: Long, keepDim: Boolean): STen

Reduces the given dimension with the index of its maximum element.

Reduces the given dimension with the index of its maximum element.

Value parameters

keepDim

if true then the reduced dimension is kept with size 1

Attributes

def argmin[S : Sc](dim: Long, keepDim: Boolean): STen

Reduces the given dimension with the index of its minimum element.

Reduces the given dimension with the index of its minimum element.

Value parameters

keepDim

if true then the reduced dimension is kept with size 1

Attributes

def argsort[S : Sc](stable: Boolean, dim: Int, descending: Boolean): STen

Returns a long tensors with the argsort of the given dimension.

Returns a long tensors with the argsort of the given dimension.

Indexing the given dimension by the returned tensor would result in a sorted order.

Attributes

def asin[S : Sc]: STen
def asin_(): Unit
def atan[S : Sc]: STen
def atan_(): Unit
def baddbmm[S : Sc](batch1: STen, batch2: STen, beta: Double, alpha: Double): STen

Batched add mm.

Batched add mm.

Attributes

def bincount[S : Sc](weights: Option[STen], minLength: Int): STen
def bmm[S : Sc](other: STen): STen

Batched matrix multiplication. Maps to Aten.bmm.

Batched matrix multiplication. Maps to Aten.bmm.

Performs the same matrix multiplication along multiple batches. Batch dimensions do not broadcast.

Attributes

def castToBool[S : Sc]: STen

Casts to bool

Casts to bool

Attributes

def castToByte[S : Sc]: STen

Casts to byte. signed 8-bit integer (like Scala's Byte) This is called Char in libtorch

Casts to byte. signed 8-bit integer (like Scala's Byte) This is called Char in libtorch

Attributes

def castToDouble[S : Sc]: STen

Casts to double

Casts to double

Attributes

def castToFloat[S : Sc]: STen

Casts to float

Casts to float

Attributes

def castToHalf[S : Sc]: STen

Casts to half

Casts to half

Attributes

def castToInt[S : Sc]: STen

Casts to int

Casts to int

Attributes

def castToLong[S : Sc]: STen

Casts to long

Casts to long

Attributes

def castToShort[S : Sc]: STen

Casts to short

Casts to short

Attributes

def castToType[S : Sc](scalarType: Byte): STen
def cat[S : Sc](other: STen, dim: Long): STen

Concatenates two tensors along the given dimension. Other dimensions must conform.

Concatenates two tensors along the given dimension. Other dimensions must conform.

Attributes

def ceil[S : Sc]: STen
def ceil_(): Unit
def cholesky[S : Sc](upper: Boolean): STen
def choleskyInverse[S : Sc](upper: Boolean): STen
def choleskyLower[S : Sc]: STen
def choleskySolve[S : Sc](choleskyFactor: STen, upper: Boolean): STen
def cloneTensor[S : Sc]: STen

Returns a copy of this tensor

Returns a copy of this tensor

Attributes

def coalesce[S : Sc]: STen
def colSum[S : Sc]: STen

Sum over the first dimension

Sum over the first dimension

Attributes

def cond[S : Sc](norm: String): STen
def copyFrom(source: Tensor, nonBlocking: Boolean): Unit

Overwrites the contents of this tensor with the contents of an other. Must conform.

Overwrites the contents of this tensor with the contents of an other. Must conform.

Attributes

def copyFrom(source: STen): Unit

Overwrites the contents of this tensor with the contents of an other. Must conform. non blocking is true

Overwrites the contents of this tensor with the contents of an other. Must conform. non blocking is true

Attributes

def copyFrom(source: STen, nonBlocking: Boolean): Unit

Overwrites the contents of this tensor with the contents of an other. Must conform.

Overwrites the contents of this tensor with the contents of an other. Must conform.

Attributes

def copyTo[S : Sc](options: STenOptions): STen

Returns a copy of this tensor adapted to the given options

Returns a copy of this tensor adapted to the given options

Attributes

def copyToDevice(device: Device)(implicit scope: Scope): STen

Returns a copy of this tensor on the given device

Returns a copy of this tensor on the given device

Attributes

def cos[S : Sc]: STen
def cos_(): Unit
def cross[S : Sc](other: STen, dim: Int): STen
def det[S : Sc]: STen
def device: Device

Returns the Device this tensor resides on

Returns the Device this tensor resides on

Attributes

def deviceIndex: Int

Returns the device index. Only for Cuda tensors.

Returns the device index. Only for Cuda tensors.

Attributes

def diag[S : Sc](diagonal: Long): STen
def diagonalView[S : Sc](offset: Int, dim1: Int, dim2: Int): STen
def dot[S : Sc](other: STen): STen
def dropout_(p: Double, training: Boolean): Unit
def eigh[S : Sc](uplo: String): (STen, STen)
def eigvalsh[S : Sc](uplo: String): STen
def elementSize: Long
def equ[S : Sc](other: STen): STen

Returns a boolean tensors of the same shape, indicating equality with the other tensor.

Returns a boolean tensors of the same shape, indicating equality with the other tensor.

Attributes

def equ[S : Sc](other: Double): STen

Returns a boolean tensors of the same shape, indicating equality with the other value.

Returns a boolean tensors of the same shape, indicating equality with the other value.

Attributes

def equ[S : Sc](other: Long): STen

Returns a boolean tensors of the same shape, indicating equality with the other value.

Returns a boolean tensors of the same shape, indicating equality with the other value.

Attributes

def equalDeep(input2: STen): Boolean

Return a boolean tensor indicating element-wise equality. Maps to Aten.equal

Return a boolean tensor indicating element-wise equality. Maps to Aten.equal

Attributes

def exp[S : Sc]: STen
def exp_(): Unit
def expand(shape: List[Long])(implicit scope: Scope): STen
def expandAs[S : Sc](other: STen): STen
def expm1[S : Sc]: STen
def fill_(v: Double): Unit

In place fills the tensors with the given value

In place fills the tensors with the given value

Attributes

def fill_(v: STen): Unit

In place fills with the given tensor.

In place fills with the given tensor.

Attributes

def flatten[S : Sc](startDim: Long, endDim: Long): STen

Flattens between the given dimensions. Inclusive.

Flattens between the given dimensions. Inclusive.

Attributes

def floor[S : Sc]: STen
def floor_(): Unit
def frobeniusNorm[S : Sc](dim: Seq[Int], keepDim: Boolean): STen
def gather[S : Sc](dim: Long, index: Tensor): STen
def gather[S : Sc](dim: Long, index: STen): STen
def ge[S : Sc](other: STen): STen

Return a boolean tensor indicating element-wise greater-or-equal.

Return a boolean tensor indicating element-wise greater-or-equal.

Attributes

def ge[S : Sc](other: Double): STen

Return a boolean tensor indicating element-wise greater-or-equal.

Return a boolean tensor indicating element-wise greater-or-equal.

Attributes

def gelu[S : Sc]: STen

Gaussian Error Linear Unit

Gaussian Error Linear Unit

Attributes

def gt[S : Sc](other: STen): STen

Return a boolean tensor indicating element-wise greater-than.

Return a boolean tensor indicating element-wise greater-than.

Attributes

def gt[S : Sc](other: Double): STen

Return a boolean tensor indicating element-wise greater-than.

Return a boolean tensor indicating element-wise greater-than.

Attributes

def hardSwish[S : Sc]: STen
def index[S : Sc](indices: STen*): STen

Indexes with the given tensors along multiple dimensions.

Indexes with the given tensors along multiple dimensions.

Attributes

def indexAdd[S : Sc](dim: Long, index: STen, source: STen): STen
def indexAdd[S : Sc](dim: Long, index: Tensor, source: STen): STen
def indexCopy[S : Sc](dim: Int, index: STen, source: STen): STen
def indexFill[S : Sc](dim: Long, index: STen, source: STen): STen
def indexFill[S : Sc](dim: Long, index: STen, source: Double): STen
def indexFill[S : Sc](dim: Long, index: Tensor, source: Double): STen
def indexPut[S : Sc](indices: List[STen], values: STen, accumulate: Boolean): STen
def indexSelect[S : Sc](dim: Long, index: STen): STen

Selects along the given dimension with indices in the supplied long tensor.

Selects along the given dimension with indices in the supplied long tensor.

Attributes

def indexSelect[S : Sc](dim: Long, index: Tensor): STen

Selects along the given dimension with indices in the supplied long tensor.

Selects along the given dimension with indices in the supplied long tensor.

Attributes

def indices[S : Sc]: STen

Returns indices. Only for sparse tensors

Returns indices. Only for sparse tensors

Attributes

def inner[S : Sc](other: STen): STen
def inv[S : Sc]: STen
def isCPU: Boolean

Returns true if device is CPU

Returns true if device is CPU

Attributes

def isCuda: Boolean

Returns true if device is Cuda

Returns true if device is Cuda

Attributes

def isDouble: Boolean

Returns true if data type is double

Returns true if data type is double

Attributes

def isFloat: Boolean

Returns true if data type is float

Returns true if data type is float

Attributes

def isInt: Boolean

Returns true if data type is int

Returns true if data type is int

Attributes

def isLong: Boolean

Returns true if data type is long

Returns true if data type is long

Attributes

def isPinned: Boolean
def isShort: Boolean

Returns true if data type is short

Returns true if data type is short

Attributes

def isSparse: Boolean

Returns true if this is sparse tensor

Returns true if this is sparse tensor

Attributes

def isfinite[S : Sc]: STen

Return a boolean tensor indicating element-wise is-finite.

Return a boolean tensor indicating element-wise is-finite.

Attributes

def isnan[S : Sc]: STen

Return a boolean tensor indicating element-wise is-nan.

Return a boolean tensor indicating element-wise is-nan.

Attributes

def le[S : Sc](other: STen): STen

Return a boolean tensor indicating element-wise less-or-equal.

Return a boolean tensor indicating element-wise less-or-equal.

Attributes

def le[S : Sc](other: Double): STen

Return a boolean tensor indicating element-wise less-or-equal.

Return a boolean tensor indicating element-wise less-or-equal.

Attributes

def leakyRelu[S : Sc](negativeSlope: Double): STen

Leaky rectified linear unit

Leaky rectified linear unit

Attributes

def leakyRelu_(negativeSlope: Double): Unit

In place leaky rectified linear unit

In place leaky rectified linear unit

Attributes

def log[S : Sc]: STen
def log10[S : Sc]: STen
def log1p[S : Sc]: STen
def log1p_(): Unit
def logSoftMax[S : Sc](dim: Int): STen

Reduces the given dimension with the log-softmax of its elements.

Reduces the given dimension with the log-softmax of its elements.

Attributes

def log_(): Unit
def logicalAnd[S : Sc](other: STen): STen

Return a boolean tensor with element-wise logical and.

Return a boolean tensor with element-wise logical and.

Attributes

def logicalNot[S : Sc]: STen

Return a boolean tensor with element-wise logical not.

Return a boolean tensor with element-wise logical not.

Attributes

def logicalOr[S : Sc](other: STen): STen

Return a boolean tensor with element-wise logical or.

Return a boolean tensor with element-wise logical or.

Attributes

def logicalXor[S : Sc](other: STen): STen

Return a boolean tensor with element-wise logical xor.

Return a boolean tensor with element-wise logical xor.

Attributes

def lt[S : Sc](other: STen): STen

Return a boolean tensor indicating element-wise less-than.

Return a boolean tensor indicating element-wise less-than.

Attributes

def lt[S : Sc](other: Double): STen

Return a boolean tensor indicating element-wise greater-than.

Return a boolean tensor indicating element-wise greater-than.

Attributes

def maskFill[S : Sc](mask: STen, fill: Double): STen

Fills the tensor with the given fill value in the locations indicated by the mask boolean mask.

Fills the tensor with the given fill value in the locations indicated by the mask boolean mask.

Attributes

def maskFill[S : Sc](mask: STen, fill: Long): STen

Fills the tensor with the given fill value in the locations indicated by the mask boolean mask.

Fills the tensor with the given fill value in the locations indicated by the mask boolean mask.

Attributes

def maskedFill[S : Sc](mask: STen, fill: Double): STen

Fills with the given value according to the boolean mask.

Fills with the given value according to the boolean mask.

Attributes

def maskedFill[S : Sc](mask: Tensor, fill: Double): STen

Fills with the given value according to the boolean mask.

Fills with the given value according to the boolean mask.

Attributes

def maskedScatter[S : Sc](mask: STen, src: STen): STen
def maskedSelect[S : Sc](mask: STen): STen

Selects the elements according to the boolean mask. Returns a 1D tensor.

Selects the elements according to the boolean mask. Returns a 1D tensor.

Attributes

def maskedSelect[S : Sc](mask: Tensor): STen

Selects the elements according to the boolean mask. Returns a 1D tensor.

Selects the elements according to the boolean mask. Returns a 1D tensor.

Attributes

def matmul[S : Sc](other: STen): STen
def matrixPower[S : Sc](n: Int): STen
def matrixRank[S : Sc](tol: STen, symmetric: Boolean): STen
def matrixRank[S : Sc](hermitian: Boolean): STen
def max[S : Sc]: STen
def max[S : Sc](other: STen): STen

Return the elementwise max.

Return the elementwise max.

Attributes

def max[S : Sc](dim: Int, keepDim: Boolean): (STen, STen)

Reduces the given dimension with its max.

Reduces the given dimension with its max.

Attributes

def mean[S : Sc]: STen
def mean[S : Sc](dim: Seq[Int], keepDim: Boolean): STen

Reduces the given dimensions with their mean.

Reduces the given dimensions with their mean.

Attributes

def mean[S : Sc](dim: Int, keepDim: Boolean): STen
def median[S : Sc]: STen
def median[S : Sc](dim: Int, keepDim: Boolean): (STen, STen)

Reduces the given dimension with its median.

Reduces the given dimension with its median.

Attributes

def min[S : Sc]: STen
def min[S : Sc](other: STen): STen

Return the elementwise minimum.

Return the elementwise minimum.

Attributes

def min[S : Sc](dim: Int, keepDim: Boolean): (STen, STen)

Reduces the given dimension with its max.

Reduces the given dimension with its max.

Attributes

def mm[S : Sc](other: STen): STen

Matrix multiplication. Maps to Aten.mm.

Matrix multiplication. Maps to Aten.mm.

Attributes

def mode[S : Sc](dim: Int, keepDim: Boolean): (STen, STen)

Reduces the given dimension with its mode.

Reduces the given dimension with its mode.

Attributes

def multiply[S : Sc](other: Long): STen
def nanToNum[S : Sc]: STen

Replaces NaNs with zeros

Replaces NaNs with zeros

Attributes

def narrow[S : Sc](dim: Int, start: Long, length: Long): STen

Returns a tensor with a subset of its elements.

Returns a tensor with a subset of its elements.

The returned tensor includes elements from start to start+length along the given dimension.

No copy is made, storage is shared.

Attributes

def narrow[S : Sc](dim: Int, start: STen, length: Long): STen
def ne[S : Sc](other: STen): STen

Return a boolean tensor indicating element-wise not-equal.

Return a boolean tensor indicating element-wise not-equal.

Attributes

def ne[S : Sc](other: Double): STen

Return a boolean tensor indicating element-wise less-or-equal.

Return a boolean tensor indicating element-wise less-or-equal.

Attributes

def neg[S : Sc]: STen

Returns the negation (not applicable for Boolean).

Returns the negation (not applicable for Boolean).

Attributes

def norm2[S : Sc](dim: Seq[Int], keepDim: Boolean): STen

Reduces the given dimensions with their L2 norm.

Reduces the given dimensions with their L2 norm.

Attributes

def not[S : Sc]: STen

Returns the logical negation (applicable for Boolean).

Returns the logical negation (applicable for Boolean).

Attributes

def numBytes: Long
def numel: Long

Returns the number of elements in the tensor

Returns the number of elements in the tensor

Attributes

def oneHot[S : Sc](numClasses: Int): STen
def options[S : Sc]: STenOptions

Returns the associated STenOptions

Returns the associated STenOptions

Attributes

def outer[S : Sc](other: STen): STen
def pin[S : Sc]: STen
def pinv[S : Sc](hermitian: Boolean): STen
def pinverse[S : Sc](rcond: Double): STen
def pow[S : Sc](exponent: Double): STen
def pow[S : Sc](exponent: STen): STen
def pow_(exponent: Double): Unit
def put[S : Sc](index: STen, values: STen, accumulate: Boolean): STen
def qr[S : Sc](mode: String): (STen, STen)
def reciprocal[S : Sc]: STen
def reciprocal_(): Unit
def relu[S : Sc]: STen

Rectified linear unit

Rectified linear unit

Attributes

def relu_(): Unit

In place rectified linear unit

In place rectified linear unit

Attributes

def remainder[S : Sc](other: STen): STen
def remainder[S : Sc](other: Double): STen
def repeat[S : Sc](dims: List[Long]): STen
def repeatInterleave[S : Sc](repeats: STen, dim: Int): STen
def repeatInterleave[S : Sc](repeats: Long, dim: Int): STen
def reshape[S : Sc](dims: Long*): STen

Returns a tensor with a new shape. May copy.

Returns a tensor with a new shape. May copy.

Attributes

def round[S : Sc]: STen
def rowSum[S : Sc]: STen

Sum over the second dimension

Sum over the second dimension

Attributes

def scalarTypeByte: Byte

Returns the byte representation of the data type

Returns the byte representation of the data type

The mapping is:

  • 1 for Byte
  • 2 for Short
  • 3 for Int
  • 4 for Long
  • 5 for Half
  • 6 for Float
  • 7 for Double

Attributes

def scatter[S : Sc](dim: Long, index: STen, source: STen): STen
def scatter[S : Sc](dim: Long, index: STen, source: Double): STen
def scatterAdd[S : Sc](dim: Long, index: STen, source: STen): STen
def select[S : Sc](dim: Long, index: Long): STen

Selects a scalar element or a tensor in the given dimension and index.

Selects a scalar element or a tensor in the given dimension and index.

Attributes

def shape: List[Long]

Returns the shape of the tensor

Returns the shape of the tensor

Attributes

def sigmoid[S : Sc]: STen

Sigmoid funtion

Sigmoid funtion

Attributes

def sigmoid_(): Unit

In place sigmoid funtion

In place sigmoid funtion

Attributes

def sign[S : Sc]: STen
def sign_(): Unit
def sin[S : Sc]: STen
def sin_(): Unit
def sizes: List[Long]

Returns the shape of the tensor

Returns the shape of the tensor

Attributes

def slice[S : Sc](dim: Int, start: Long, end: Long, step: Long): STen

Returns a slice over the selected dimension

Returns a slice over the selected dimension

Attributes

def slice[S : Sc](dim: Long, start: Long, end: Long, step: Long): STen

Returns a slice over the selected dimension

Returns a slice over the selected dimension

Attributes

def slogdet[S : Sc]: (STen, STen)
def softplus[S : Sc](beta: Double, threshold: Double): STen
def solve[S : Sc](other: Tensor): STen
def sort[S : Sc](dim: Int, descending: Boolean): (STen, STen)
def sqrt[S : Sc]: STen
def sqrt_(): Unit
def square[S : Sc]: STen
def square_(): Unit
def squeeze[S : Sc](dim: Int): STen

Removes dimensions of size=1 from the shape

Removes dimensions of size=1 from the shape

Attributes

def squeeze[S : Sc]: STen

Removes dimensions of size=1 from the shape

Removes dimensions of size=1 from the shape

Attributes

def std[S : Sc](unbiased: Boolean): STen
def std[S : Sc](dim: Seq[Int], unbiased: Boolean, keepDim: Boolean): STen

Reduces the given dimensions with their standard deviation.

Reduces the given dimensions with their standard deviation.

Attributes

def std[S : Sc](dim: Int, unbiased: Boolean, keepDim: Boolean): STen
def stdAndMean[S : Sc](unbiased: Boolean): (STen, STen)
def stdAndMean[S : Sc](dim: Seq[Int], unbiased: Boolean, keepDim: Boolean): (STen, STen)
def sub[S : Sc](other: STen, alpha: Double): STen

Subtracts other after multiplying with a number.

Subtracts other after multiplying with a number.

Attributes

def sub[S : Sc](other: Double, alpha: Double): STen

Subtracts other after multiplying with a number.

Subtracts other after multiplying with a number.

Attributes

def sub_l[S : Sc](other: STen): STen

Subtracts other.

Subtracts other.

Attributes

def sum[S : Sc]: STen
def sum[S : Sc](dim: Seq[Int], keepDim: Boolean): STen

Reduces the given dimensions with the sum of their elements.

Reduces the given dimensions with the sum of their elements.

Value parameters

keepDim

if true then the reduced dimensions are kept with size 1

Attributes

def sum[S : Sc](dim: Int, keepDim: Boolean): STen
def svd[S : Sc](fullMatrices: Boolean): (STen, STen, STen)

Value parameters

fullMatrices

whether to return reduced or full matrices (in case of non-square input)

Attributes

Returns

(U,S,Vh) , Vh being the conjugate transpose of V ; input = U diag(S) Vh

def t[S : Sc]: STen

Transposes the first two dimensions.

Transposes the first two dimensions.

Attributes

def tan[S : Sc]: STen
def tan_(): Unit
def tanh[S : Sc]: STen
def tanh_(): Unit
def tensordot[S : Sc](other: STen, dims: List[Int], dimsOther: List[Int]): STen
def tensorinv[S : Sc](int: Int): STen
def tensorsolve[S : Sc](other: Tensor): STen
def to[S : Sc](options: STenOptions, nonBlocking: Boolean, copy: Boolean): STen
def toByteArray: Array[Byte]
def toDense[S : Sc]: STen
def toDoubleArray: Array[Double]
def toFloatArray: Array[Float]
def toIntArray: Array[Int]
def toLongArray: Array[Long]
def toShortArray: Array[Short]
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
Any
def topk[S : Sc](k: Int, dim: Int, largest: Boolean, sorted: Boolean): (STen, STen)

Selects the top k elements along the given dimension

Selects the top k elements along the given dimension

Value parameters

dim

which dimension to select in

k

How many elements to select

largest

if true, then the highest k element is selected

sorted

if true, the selected elements are further sorted

Attributes

Returns

a pair of (value,index) tensors where value holds the selected elements and index holds the indices of the selected elements

def trace[S : Sc]: STen
def transpose[S : Sc](dim1: Int, dim2: Int): STen

Transposes the given dimensions.

Transposes the given dimensions.

Attributes

def tril[S : Sc](diagonal: Int): STen
def tril_(diagonal: Int): Unit
def unbroadcast[S : Sc](sizes: Seq[Long]): STen
def unique[S : Sc](sorted: Boolean, returnInverse: Boolean): (STen, STen)
def unique[S : Sc](sorted: Boolean, returnInverse: Boolean, returnCounts: Boolean): (STen, STen, STen)
def unique[S : Sc](dim: Int, sorted: Boolean, returnInverse: Boolean, returnCounts: Boolean): (STen, STen, STen)
def uniqueConsecutive[S : Sc](dim: Int, returnInverse: Boolean, returnCounts: Boolean): (STen, STen, STen)
def unsqueeze[S : Sc](dim: Int): STen

Inserts a dimension of size=1 in the given position

Inserts a dimension of size=1 in the given position

Attributes

def values[S : Sc]: STen

Returns values. Only for sparse tensors

Returns values. Only for sparse tensors

Attributes

def varAndMean[S : Sc](unbiased: Boolean): (STen, STen)
def varAndMean[S : Sc](dim: Seq[Int], unbiased: Boolean, keepDim: Boolean): (STen, STen)
def variance[S : Sc](unbiased: Boolean): STen
def variance[S : Sc](dim: Seq[Int], unbiased: Boolean, keepDim: Boolean): STen

Reduces the given dimensions with their variance.

Reduces the given dimensions with their variance.

Attributes

def variance[S : Sc](dim: Int, unbiased: Boolean, keepDim: Boolean): STen
def view[S : Sc](dims: Long*): STen

Returns a tensor with a new shape.

Returns a tensor with a new shape.

No data is copied. The new shape must be compatible with the number of elements and the stride of the tensor.

Attributes

def where[S : Sc]: List[STen]

Returns the indices of non-zero values

Returns the indices of non-zero values

Attributes

def zero_(): Unit

In place fills with zeros.

In place fills with zeros.

Attributes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product