case class STen extends Product with Serializable
Memory managed, off-heap 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:
- 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.
- Alphabetic
- By Inheritance
- STen
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def *[S](other: Double)(implicit arg0: Sc[S]): STen
Multiplication
- def *[S](other: Tensor)(implicit arg0: Sc[S]): STen
Multiplication
- def *[S](other: STen)(implicit arg0: Sc[S]): STen
Multiplication
- def *=(other: Double): Unit
In place multiplication.
- def *=(other: STen): Unit
In place multiplication.
- def +[S](other: Double)(implicit arg0: Sc[S]): STen
Adds a scalar to all elements.
- def +[S](other: STen)(implicit arg0: Sc[S]): STen
Adds to tensors.
- def +=(other: Double): Unit
In place add.
- def +=(other: STen): Unit
In place add.
- def -[S](other: STen)(implicit arg0: Sc[S]): STen
Subtracts other.
- def -=(other: STen): Unit
Subtracts other in place.
- def /[S](other: Double)(implicit arg0: Sc[S]): STen
Division.
- def /[S](other: Tensor)(implicit arg0: Sc[S]): STen
Division.
- def /[S](other: STen)(implicit arg0: Sc[S]): STen
Division.
- def /=(other: STen): Unit
In place division.
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def abs[S](implicit arg0: Sc[S]): STen
- def abs_(): Unit
- def acos[S](implicit arg0: Sc[S]): STen
- def acos_(): Unit
- def add[S](other: Double, alpha: Double)(implicit arg0: Sc[S]): STen
Adds a value multipled by a scalar
(a + alpha * b)
. - def add[S](other: STen, alpha: Double)(implicit arg0: Sc[S]): STen
Adds an other tensor multipled by a scalar
(a + alpha * b)
. - def addcmul[S](tensor1: STen, tensor2: STen, alpha: Double)(implicit arg0: Sc[S]): STen
Elementwise
this + alpha * tensor1 * tensor2
- def addcmulSelf(tensor1: STen, tensor2: Tensor, alpha: Double): Unit
Elementwise in place
this + alpha * tensor1 * tensor2
- def addcmulSelf(tensor1: STen, tensor2: STen, alpha: Double): Unit
Elementwise in place
this + alpha * tensor1 * tensor2
- def addmm[S](mat1: STen, mat2: STen, beta: Double, alpha: Double)(implicit arg0: Sc[S]): STen
beta * this + alpha * (mat1 matmul mat2)
- def argmax[S](dim: Long, keepDim: Boolean)(implicit arg0: Sc[S]): STen
Reduces the given dimension with the index of its maximum element.
Reduces the given dimension with the index of its maximum element.
- keepDim
if true then the reduced dimension is kept with size 1
- def argmin[S](dim: Long, keepDim: Boolean)(implicit arg0: Sc[S]): STen
Reduces the given dimension with the index of its minimum element.
Reduces the given dimension with the index of its minimum element.
- keepDim
if true then the reduced dimension is kept with size 1
- def argsort[S](dim: Int, descending: Boolean)(implicit arg0: Sc[S]): 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.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def asin[S](implicit arg0: Sc[S]): STen
- def asin_(): Unit
- def atan[S](implicit arg0: Sc[S]): STen
- def atan_(): Unit
- def baddbmm[S](batch1: STen, batch2: STen, beta: Double, alpha: Double)(implicit arg0: Sc[S]): STen
Batched add mm.
- def bmm[S](other: STen)(implicit arg0: Sc[S]): STen
Batched matrix multiplication.
Batched matrix multiplication. Maps to Aten.bmm.
Performs the same matrix multiplication along multiple batches. Batch dimensions do not broadcast.
- def castToByte[S](implicit arg0: Sc[S]): STen
Casts to byte
- def castToChar[S](implicit arg0: Sc[S]): STen
Casts to char
- def castToDouble[S](implicit arg0: Sc[S]): STen
Casts to double
- def castToFloat[S](implicit arg0: Sc[S]): STen
Casts to float
- def castToLong[S](implicit arg0: Sc[S]): STen
Casts to long
- def cat[S](other: STen, dim: Long)(implicit arg0: Sc[S]): STen
Concatenates two tensors along the given dimension.
Concatenates two tensors along the given dimension. Other dimensions must conform.
- def ceil[S](implicit arg0: Sc[S]): STen
- def ceil_(): Unit
- def cholesky[S](upper: Boolean)(implicit arg0: Sc[S]): STen
- def choleskyInverse[S](input2: STen, upper: Boolean)(implicit arg0: Sc[S]): STen
- def choleskyInverse[S](upper: Boolean)(implicit arg0: Sc[S]): STen
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def cloneTensor[S](implicit arg0: Sc[S]): STen
Returns a copy of this tensor
- def coalesce[S](implicit arg0: Sc[S]): STen
- def colSum[S](implicit arg0: Sc[S]): STen
Sum over the first dimension
- def copyFrom(source: STen): Unit
Overwrites the contents of this tensor with the contents of an other.
Overwrites the contents of this tensor with the contents of an other. Must conform.
- def copyFrom(source: Tensor): Unit
Overwrites the contents of this tensor with the contents of an other.
Overwrites the contents of this tensor with the contents of an other. Must conform.
- def copyTo[S](options: STenOptions)(implicit arg0: Sc[S]): STen
Returns a copy of this tensor adapted to the given options
- def copyToDevice(device: Device)(implicit scope: Scope): STen
Returns a copy of this tensor on the given device
- def cos[S](implicit arg0: Sc[S]): STen
- def cos_(): Unit
- def det[S](implicit arg0: Sc[S]): STen
- def deviceIndex: Int
Returns the device index.
Returns the device index. Only for Cuda tensors.
- def dot[S](other: STen)(implicit arg0: Sc[S]): STen
- def dropout_(p: Double, training: Boolean): Unit
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equ[S](other: Long)(implicit arg0: Sc[S]): STen
Returns a boolean tensors of the same shape, indicating equality with the other value.
- def equ[S](other: Double)(implicit arg0: Sc[S]): STen
Returns a boolean tensors of the same shape, indicating equality with the other value.
- def equ[S](other: STen)(implicit arg0: Sc[S]): STen
Returns a boolean tensors of the same shape, indicating equality with the other tensor.
- def equalDeep(input2: STen): Boolean
Return a boolean tensor indicating element-wise equality.
Return a boolean tensor indicating element-wise equality. Maps to Aten.equal
- def exp[S](implicit arg0: Sc[S]): STen
- def exp_(): Unit
- def expandAs[S](other: STen)(implicit arg0: Sc[S]): STen
- def expm1[S](implicit arg0: Sc[S]): STen
- def fill_(v: STen): Unit
In place fills with the given tensor.
- def fill_(v: Double): Unit
In place fills the tensors with the given value
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def flatten[S](startDim: Long, endDim: Long)(implicit arg0: Sc[S]): STen
Flattens between the given dimensions.
Flattens between the given dimensions. Inclusive.
- def floor[S](implicit arg0: Sc[S]): STen
- def floor_(): Unit
- def frobeniusNorm[S](implicit arg0: Sc[S]): STen
- def gather[S](dim: Long, index: STen)(implicit arg0: Sc[S]): STen
- def gather[S](dim: Long, index: Tensor)(implicit arg0: Sc[S]): STen
- def ge[S](other: Double)(implicit arg0: Sc[S]): STen
Return a boolean tensor indicating element-wise greater-or-equal.
- def ge[S](other: STen)(implicit arg0: Sc[S]): STen
Return a boolean tensor indicating element-wise greater-or-equal.
- def gelu[S](implicit arg0: Sc[S]): STen
Gaussian Error Linear Unit
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def gt[S](other: Double)(implicit arg0: Sc[S]): STen
Return a boolean tensor indicating element-wise greater-than.
- def gt[S](other: STen)(implicit arg0: Sc[S]): STen
Return a boolean tensor indicating element-wise greater-than.
- def index[S](indices: STen*)(implicit arg0: Sc[S]): STen
Indexes with the given tensors along multiple dimensions.
- def indexAdd[S](dim: Long, index: Tensor, source: STen)(implicit arg0: Sc[S]): STen
- def indexAdd[S](dim: Long, index: STen, source: STen)(implicit arg0: Sc[S]): STen
- def indexCopy[S](dim: Int, index: STen, source: STen)(implicit arg0: Sc[S]): STen
- def indexFill[S](dim: Long, index: Tensor, source: Double)(implicit arg0: Sc[S]): STen
- def indexFill[S](dim: Long, index: STen, source: Double)(implicit arg0: Sc[S]): STen
- def indexFill[S](dim: Long, index: STen, source: STen)(implicit arg0: Sc[S]): STen
- def indexPut[S](indices: List[STen], values: STen, accumulate: Boolean)(implicit arg0: Sc[S]): STen
- def indexSelect[S](dim: Long, index: Tensor)(implicit arg0: Sc[S]): STen
Selects along the given dimension with indices in the supplied long tensor.
- def indexSelect[S](dim: Long, index: STen)(implicit arg0: Sc[S]): STen
Selects along the given dimension with indices in the supplied long tensor.
- def index_copy_(dim: Int, index: STen, source: STen): Unit
- def indices[S](implicit arg0: Sc[S]): STen
Returns indices.
Returns indices. Only for sparse tensors
- def isCPU: Boolean
Returns true if device is CPU
- def isCuda: Boolean
Returns true if device is Cuda
- def isDouble: Boolean
Returns true if data type is double
- def isFloat: Boolean
Returns true if data type is float
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isLong: Boolean
Returns true if data type is long
- def isSparse: Boolean
Returns true if this is sparse tensor
- def isfinite[S](implicit arg0: Sc[S]): STen
Return a boolean tensor indicating element-wise is-finite.
- def isnan[S](implicit arg0: Sc[S]): STen
Return a boolean tensor indicating element-wise is-nan.
- def le[S](other: Double)(implicit arg0: Sc[S]): STen
Return a boolean tensor indicating element-wise less-or-equal.
- def le[S](other: STen)(implicit arg0: Sc[S]): STen
Return a boolean tensor indicating element-wise less-or-equal.
- def leakyRelu[S](negativeSlope: Double)(implicit arg0: Sc[S]): STen
Leaky rectified linear unit
- def leakyRelu_(negativeSlope: Double): Unit
In place leaky rectified linear unit
- def log[S](implicit arg0: Sc[S]): STen
- def log10[S](implicit arg0: Sc[S]): STen
- def log1p[S](implicit arg0: Sc[S]): STen
- def log1p_(): Unit
- def logSoftMax[S](dim: Int)(implicit arg0: Sc[S]): STen
Reduces the given dimension with the log-softmax of its elements.
- def log_(): Unit
- def lt[S](other: Double)(implicit arg0: Sc[S]): STen
Return a boolean tensor indicating element-wise greater-than.
- def lt[S](other: STen)(implicit arg0: Sc[S]): STen
Return a boolean tensor indicating element-wise less-than.
- def maskFill[S](mask: STen, fill: Double)(implicit arg0: Sc[S]): STen
Fills the tensor with the given
fill
value in the locations indicated by themask
boolean mask. - def maskedFill[S](mask: Tensor, fill: Double)(implicit arg0: Sc[S]): STen
Fills with the given value according to the boolean mask.
- def maskedFill[S](mask: STen, fill: Double)(implicit arg0: Sc[S]): STen
Fills with the given value according to the boolean mask.
- def maskedScatter[S](mask: STen, src: STen)(implicit arg0: Sc[S]): STen
- def maskedSelect[S](mask: Tensor)(implicit arg0: Sc[S]): STen
Selects the elements according to the boolean mask.
Selects the elements according to the boolean mask. Returns a 1D tensor.
- def maskedSelect[S](mask: STen)(implicit arg0: Sc[S]): STen
Selects the elements according to the boolean mask.
Selects the elements according to the boolean mask. Returns a 1D tensor.
- def matmul[S](other: STen)(implicit arg0: Sc[S]): STen
- def matrixPower[S](n: Int)(implicit arg0: Sc[S]): STen
- def matrixRank[S](tol: Double, symmetric: Boolean)(implicit arg0: Sc[S]): STen
- def max[S](dim: Int, keepDim: Boolean)(implicit arg0: Sc[S]): (STen, STen)
Reduces the given dimension with its max.
- def max[S](other: STen)(implicit arg0: Sc[S]): STen
Return a boolean tensor indicating elementwise max.
- def max[S](implicit arg0: Sc[S]): STen
- def mean[S](dim: Int, keepDim: Boolean)(implicit arg0: Sc[S]): STen
- def mean[S](dim: Seq[Int], keepDim: Boolean)(implicit arg0: Sc[S]): STen
Reduces the given dimensions with their mean.
- def mean[S](implicit arg0: Sc[S]): STen
- def median[S](dim: Int, keepDim: Boolean)(implicit arg0: Sc[S]): (STen, STen)
Reduces the given dimension with its median.
- def median[S](implicit arg0: Sc[S]): STen
- def min[S](dim: Int, keepDim: Boolean)(implicit arg0: Sc[S]): (STen, STen)
Reduces the given dimension with its max.
- def min[S](other: STen)(implicit arg0: Sc[S]): STen
Return a boolean tensor indicating elementwise min.
- def min[S](implicit arg0: Sc[S]): STen
- def mm[S](other: STen)(implicit arg0: Sc[S]): STen
Matrix multiplication.
Matrix multiplication. Maps to Aten.mm.
- def mode[S](dim: Int, keepDim: Boolean)(implicit arg0: Sc[S]): (STen, STen)
Reduces the given dimension with its mode.
- def narrow[S](dim: Int, start: STen, length: Long)(implicit arg0: Sc[S]): STen
- def narrow[S](dim: Int, start: Long, length: Long)(implicit arg0: Sc[S]): 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
tostart+length
along the given dimension.No copy is made, storage is shared.
- def ne[S](other: Double)(implicit arg0: Sc[S]): STen
Return a boolean tensor indicating element-wise less-or-equal.
- def ne[S](other: STen)(implicit arg0: Sc[S]): STen
Return a boolean tensor indicating element-wise not-equal.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def neg[S](implicit arg0: Sc[S]): STen
Returns the negation.
- def norm2[S](dim: Seq[Int], keepDim: Boolean)(implicit arg0: Sc[S]): STen
Reduces the given dimensions with their L2 norm.
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def numel: Long
Returns the number of elements in the tensor
- def oneHot[S](numClasses: Int)(implicit arg0: Sc[S]): STen
- def options[S](implicit arg0: Sc[S]): STenOptions
Returns the associated STenOptions
- def pinverse[S](rcond: Double)(implicit arg0: Sc[S]): STen
- def pow[S](exponent: STen)(implicit arg0: Sc[S]): STen
- def pow[S](exponent: Double)(implicit arg0: Sc[S]): STen
- def pow_(exponent: Double): Unit
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def reciprocal[S](implicit arg0: Sc[S]): STen
- def reciprocal_(): Unit
- def relu[S](implicit arg0: Sc[S]): STen
Rectified linear unit
- def relu_(): Unit
In place rectified linear unit
- def remainder[S](other: Double)(implicit arg0: Sc[S]): STen
- def remainder[S](other: STen)(implicit arg0: Sc[S]): STen
- def repeat[S](dims: List[Long])(implicit arg0: Sc[S]): STen
- def repeatInterleave[S](implicit arg0: Sc[S]): STen
- def repeatInterleave[S](repeats: Long, dim: Int)(implicit arg0: Sc[S]): STen
- def repeatInterleave[S](repeats: STen, dim: Int)(implicit arg0: Sc[S]): STen
- def reshape[S](dims: Long*)(implicit arg0: Sc[S]): STen
Returns a tensor with a new shape.
Returns a tensor with a new shape. May copy.
- def round[S](implicit arg0: Sc[S]): STen
- def rowSum[S](implicit arg0: Sc[S]): STen
Sum over the second dimension
- def scalarTypeByte: Byte
Returns the byte representation of the data type
Returns the byte representation of the data type
The mapping is:
- 4 for Long
- 6 for Float
- 7 for Double
- def scatter[S](dim: Long, index: STen, source: Double)(implicit arg0: Sc[S]): STen
- def scatter[S](dim: Long, index: STen, source: STen)(implicit arg0: Sc[S]): STen
- def scatterAdd[S](dim: Long, index: STen, source: STen)(implicit arg0: Sc[S]): STen
- def select[S](dim: Long, index: Long)(implicit arg0: Sc[S]): STen
Selects a scalar element or a tensor in the given dimension and index.
- def shape: List[Long]
Returns the shape of the tensor
- def sigmoid[S](implicit arg0: Sc[S]): STen
Sigmoid funtion
- def sigmoid_(): Unit
In place sigmoid funtion
- def sign[S](implicit arg0: Sc[S]): STen
- def sign_(): Unit
- def sin[S](implicit arg0: Sc[S]): STen
- def sin_(): Unit
- def sizes: List[Long]
Returns the shape of the tensor
- def slice[S](dim: Long, start: Long, end: Long, step: Long)(implicit arg0: Sc[S]): STen
Returns a slice over the selected dimension
- def slice[S](dim: Int, start: Long, end: Long, step: Long)(implicit arg0: Sc[S]): STen
Returns a slice over the selected dimension
- def sort[S](dim: Int, descending: Boolean)(implicit arg0: Sc[S]): (STen, STen)
- def sqrt[S](implicit arg0: Sc[S]): STen
- def sqrt_(): Unit
- def square[S](implicit arg0: Sc[S]): STen
- def square_(): Unit
- def squeeze[S](implicit arg0: Sc[S]): STen
Removes dimensions of size=1 from the shape
- def squeeze[S](dim: Int)(implicit arg0: Sc[S]): STen
Removes dimensions of size=1 from the shape
- def std[S](dim: Int, unbiased: Boolean, keepDim: Boolean)(implicit arg0: Sc[S]): STen
- def std[S](dim: Seq[Int], unbiased: Boolean, keepDim: Boolean)(implicit arg0: Sc[S]): STen
Reduces the given dimensions with their standard deviation.
- def std[S](unbiased: Boolean)(implicit arg0: Sc[S]): STen
- def stdAndMean[S](dim: Seq[Int], unbiased: Boolean, keepDim: Boolean)(implicit arg0: Sc[S]): (STen, STen)
- def stdAndMean[S](unbiased: Boolean)(implicit arg0: Sc[S]): (STen, STen)
- def sub[S](other: Double, alpha: Double)(implicit arg0: Sc[S]): STen
Subtracts other after multiplying with a number.
- def sub[S](other: STen, alpha: Double)(implicit arg0: Sc[S]): STen
Subtracts other after multiplying with a number.
- def sum[S](dim: Int, keepDim: Boolean)(implicit arg0: Sc[S]): STen
- def sum[S](dim: Seq[Int], keepDim: Boolean)(implicit arg0: Sc[S]): STen
Reduces the given dimensions with the sum of their elements.
Reduces the given dimensions with the sum of their elements.
- keepDim
if true then the reduced dimensions are kept with size 1
- def sum[S](implicit arg0: Sc[S]): STen
- def svd[S](implicit arg0: Sc[S]): (STen, STen, STen)
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def t[S](implicit arg0: Sc[S]): STen
Transposes the first two dimensions.
- def tan[S](implicit arg0: Sc[S]): STen
- def tan_(): Unit
- def tanh[S](implicit arg0: Sc[S]): STen
- def tanh_(): Unit
- def toFloatMat: Mat[Float]
Converts to a Mat[Float].
Converts to a Mat[Float].
Copies to CPU if needed. Fails if dtype is not float. Fails if shape does not conform a matrix.
- def toFloatVec: Vec[Float]
Converts to a Vec[Float].
Converts to a Vec[Float].
Copies to CPU if needed. Fails if dtype is not float. Flattens the shape.
- def toLongMat: Mat[Long]
Converts to a Mat[Long].
Converts to a Mat[Long].
Copies to CPU if needed. Fails if dtype is not long. Fails if shape does not conform a matrix.
- def toLongVec: Vec[Long]
Converts to a Vec[Long].
Converts to a Vec[Long].
Copies to CPU if needed. Fails if dtype is not long. Flattens the shape.
- def toMat: Mat[Double]
Converts to a Mat[Double].
Converts to a Mat[Double].
Copies to CPU if needed. Fails if dtype is not float or double. Fails if shape does not conform a matrix.
- def toString(): String
- Definition Classes
- STen → AnyRef → Any
- def toVec: Vec[Double]
Converts to a Vec[Double].
Converts to a Vec[Double].
Copies to CPU if needed. Fails if dtype is not float or double. Flattens the shape.
- def topk[S](k: Int, dim: Int, largest: Boolean, sorted: Boolean)(implicit arg0: Sc[S]): (STen, STen)
Selects the top k elements along the given dimension
Selects the top k elements along the given dimension
- k
How many elements to select
- dim
which dimension to select in
- largest
if true, then the highest k element is selected
- sorted
if true, the selected elements are further sorted
- 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](implicit arg0: Sc[S]): STen
- def transpose[S](dim1: Int, dim2: Int)(implicit arg0: Sc[S]): STen
Transposes the given dimensions.
- def unbroadcast[S](sizes: Seq[Long])(implicit arg0: Sc[S]): STen
- def unique[S](dim: Int, sorted: Boolean, returnInverse: Boolean, returnCounts: Boolean)(implicit arg0: Sc[S]): (STen, STen, STen)
- def unique[S](sorted: Boolean, returnInverse: Boolean, returnCounts: Boolean)(implicit arg0: Sc[S]): (STen, STen, STen)
- def unique[S](sorted: Boolean, returnInverse: Boolean)(implicit arg0: Sc[S]): (STen, STen)
- def uniqueConsecutive[S](dim: Int, returnInverse: Boolean = false, returnCounts: Boolean = false)(implicit arg0: Sc[S]): (STen, STen, STen)
- def unsqueeze[S](dim: Int)(implicit arg0: Sc[S]): STen
Inserts a dimension of size=1 in the given position
- val value: Tensor
- def values[S](implicit arg0: Sc[S]): STen
Returns values.
Returns values. Only for sparse tensors
- def varAndMean[S](dim: Seq[Int], unbiased: Boolean, keepDim: Boolean)(implicit arg0: Sc[S]): (STen, STen)
- def varAndMean[S](unbiased: Boolean)(implicit arg0: Sc[S]): (STen, STen)
- def variance[S](dim: Int, unbiased: Boolean, keepDim: Boolean)(implicit arg0: Sc[S]): STen
- def variance[S](dim: Seq[Int], unbiased: Boolean, keepDim: Boolean)(implicit arg0: Sc[S]): STen
Reduces the given dimensions with their variance.
- def variance[S](unbiased: Boolean)(implicit arg0: Sc[S]): STen
- def view[S](dims: Long*)(implicit arg0: Sc[S]): 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.
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def where[S](implicit arg0: Sc[S]): List[STen]
Returns the indices of non-zero values
- def zero_(): Unit
In place fills with zeros.