package ops
- Alphabetic
- Public
- All
Type Members
- class All[T] extends Operation[Table, Tensor[Boolean], T]
- class Any[T] extends Operation[Table, Tensor[Boolean], T]
- class ApproximateEqual[T] extends Compare[T]
- class ArgMax[T] extends Operation[Table, Tensor[Int], T]
-
class
BatchMatMul[T, D] extends Operation[Table, Tensor[D], T]
Multiplies all slices of
Tensorxandy(each slice can be viewed as an element of a batch), and arranges the individual results in a single output tensor of the same batch size.Multiplies all slices of
Tensorxandy(each slice can be viewed as an element of a batch), and arranges the individual results in a single output tensor of the same batch size. Each of the individual slices can optionally be adjointed (to adjoint a matrix means to transpose and conjugate it) before multiplication by setting theadj_xoradj_yflag toTrue, which are by defaultFalse. -
class
BucketizedCol[T] extends Operation[Tensor[T], Tensor[Int], T]
BucketizedCol operation represents discretized dense input.
BucketizedCol operation represents discretized dense input.
The Operation can handle single or multi feature column, as long as the boundaries is same between feature columns.
Buckets include the left boundary, and exclude the right boundary. Namely, boundaries=Array(0, 1, 10) generates buckets (-inf,0),[0,1),[1,10),[10,+inf)
For example, boundaries = Array(0, 10, 100) and input tensor is an 2D 3x2 DenseTensor: -1, 1 101, 10 5, 100
the output tensor should be an 2D 3x2 DenseTensor 0, 1 3, 2 1, 3
- T
Numeric type. Parameter tensor numeric type. Only support float/double now
-
class
Cast[T, D] extends Operation[Tensor[_], Tensor[D], T]
Casts a tensor to a new type.
Casts a tensor to a new type.
- T
Parameter tensor numeric type. Only support float/double now
- D
A new type was cast to
-
class
CategoricalColHashBucket[T] extends Operation[Tensor[String], Tensor[Int], T]
CategoricalColHashBucket operation can convert feature string to a Sparse/Dense Tensor
CategoricalColHashBucket operation can convert feature string to a Sparse/Dense Tensor
SparseTensor if isSparse = true DenseTensor if isSparse = false
the input is a Tensor[String] with shape batch * 1.
This operation distributes your inputs into a finite number of buckets by hashing
The Operation support the feature column with single-value or multi-value
The output_id = Hash(input_feature_string) % hashBucketSize, ranging 0 to hashBucketSize-1
The missing values in input Tensor can be represented by -1 for int and ' for string
- T
Numeric type. Parameter tensor numeric type. Only support float/double now
-
class
CategoricalColVocaList[T] extends Operation[Tensor[String], Tensor[Int], T]
CategoricalColVocaList operation having an vocabulary mapping feature string to Integer ID
CategoricalColVocaList operation having an vocabulary mapping feature string to Integer ID
By default, out-of-vocabulary values are ignored. Use either (but not both) of num_oov_buckets and default_value to specify how to include out-of-vocabulary values.
if isSetDefault=false && num_oov_buckets=0 the out-of-vocabulary values will be filtered. if isSetDefault enabled, the defalut value len(vocabulary_list) will be set. if num_oov_buckets enabled, all out-of-vocabulary inputs will be assigned IDs in the range [len(vocabulary_list), len(vocabulary_list)+num_oov_buckets) based on a hash of the input value
A positive num_oov_buckets can not be specified with default_value.
the input Tensor[String] can be 1-D or 2-D Tensor.
The Operation support the feature column with single-value or multi-value
The missing values in input Tensor can be represented by -1 for int and ' for string
- T
Numeric type. Parameter tensor numeric type. Only support float/double now
- class Ceil[T, D] extends Operation[Tensor[D], Tensor[D], T]
- abstract class Compare[T] extends Operation[Table, Tensor[Boolean], T]
-
class
CrossCol[T] extends Operation[Table, Tensor[Int], T]
CrossCol operation preforms crosses of categorical features.
CrossCol operation preforms crosses of categorical features.
The transformation can be thought of as Hash(cartesian product of features) % hashBucketSize)
The input Table contains more than or equal to 2 Tensor[String]. Each Tensor[String] represents a categorical feature column. Each row in Tensor[String] represents the string of value, which supports single-value and multi-value joined by strDelimiter.
As for the SparseTensor, it should be transformed to Tensor[String] before feeding into the Operation
For example, if the two input tensors with size=3 are: "A,D", "B", "A,C" "1", "2", "3,4"
the output tensor should be an 2D 3 x maxLength SparseTensor: [0, 0]: Hash32("1", Hash32("D")) % hashBucketSize [0, 1]: Hash32("1", Hash32("A")) % hashBucketSize [1, 0]: Hash32("2", Hash32("B")) % hashBucketSize [2, 0]: Hash32("3", Hash32("C")) % hashBucketSize [2, 1]: Hash32("4", Hash32("C")) % hashBucketSize [2, 2]: Hash32("3", Hash32("A")) % hashBucketSize [2, 3]: Hash32("4", Hash32("A")) % hashBucketSize
- T
Numeric type. Parameter tensor numeric type. Only support float/double now
-
class
CrossEntropy[T] extends Operation[Table, Table, T]
Compute the cross entropy loss and the gradients.
Compute the cross entropy loss and the gradients.
- T
Numeric type. Only support float/double now
- class DepthwiseConv2D[T] extends Operation[Table, Tensor[T], T]
- class Digamma[T, D] extends Operation[Tensor[D], Tensor[D], T]
-
class
Dilation2D[T, D] extends Operation[Table, Tensor[D], T]
Computes the grayscale dilation of 4-D
inputand 3-Dfiltertensors.Computes the grayscale dilation of 4-D
inputand 3-Dfiltertensors.This layer takes a Table of two tensors as inputs, namely
inputandfilter. Theinputtensor has shape[batch, in_height, in_width, depth]and thefiltertensor has shape[filter_height, filter_width, depth], i.e., each input channel is processed independently of the others with its own structing fucntion. Theoutputtensor has shape[batch, out_height, out_width, depth]. The spatial dimensions of the output tensor depend on thepaddingalgorithm. We currently only support the "NHWC" DataFormat.In detail, the grayscale morphological 2-D dilation is the max-sum correlation
output[b, y, x, c] = max_{dy, dx} input[b, strides[1] * y + rates[1] * dy, strides[2] * x + rates[2] * dx, c] + filter[dy, dx, c]
Max-pooling is a special case when the filter has size equal to the pooling kernel size and contains all zeros.
Note on duality: The dilation of
inputby thefilteris equal to the negation of the erosion of-inputby the reflectedfilter. - class Equal[T] extends Compare[T]
- class Erf[T, D] extends Operation[Tensor[D], Tensor[D], T]
- class Erfc[T, D] extends Operation[Tensor[D], Tensor[D], T]
- class Exp[T, D] extends Operation[Tensor[D], Tensor[D], T]
- class Expm1[T, D] extends Operation[Tensor[D], Tensor[D], T]
- class Floor[T] extends Operation[Tensor[_], Tensor[_], T]
- class FloorDiv[T, D] extends Operation[Table, Tensor[D], T]
- class FloorMod[T, D] extends Operation[Table, Tensor[D], T]
-
class
Gather[T, D] extends Operation[Table, Tensor[D], T]
Gather slices from first input tensor according to the second input tensor.
Gather slices from first input tensor according to the second input tensor. Input should be two tensors, the first one is the tensor which to gather values; the second one is Index tensor.
- class Greater[T] extends Compare[T]
- class GreaterEqual[T] extends Compare[T]
- class InTopK[T] extends Operation[Table, Tensor[Boolean], T]
-
class
IndicatorCol[T] extends Operation[Tensor[Int], Tensor[T], T]
Indicator operation represents multi-hot representation of given Tensor.
Indicator operation represents multi-hot representation of given Tensor.
The Input Tensor should be a 2-D Sparse Tensor. And used to transform the output tensor of CategoricalCol* ops.
The output tensor should be a DenseTensor with shape (batch, feaLen).
For example, A input SparseTensor as follows: indices(0) = Array(0, 0, 1, 2, 2) indices(1) = Array(0, 3, 1, 1, 2) values = Array(1, 2, 2, 3, 3) shape = Array(3, 4)
the output tensor should be an 2D 3x4 DenseTensor with isCount = true 0.0, 1.0, 1.0, 0.0 0.0, 0.0, 1.0, 0.0 0.0, 0.0, 0.0, 2.0
- T
Numeric type. Parameter tensor numeric type. Only support float/double now
- class Inv[T, D] extends Operation[Tensor[D], Tensor[D], T]
- class IsFinite[T, D] extends Operation[Tensor[D], Tensor[Boolean], T]
- class IsInf[T, D] extends Operation[Tensor[D], Tensor[Boolean], T]
- class IsNan[T, D] extends Operation[Tensor[D], Tensor[Boolean], T]
-
class
Kv2Tensor[T, D] extends Operation[Table, Tensor[D], T]
Kv2Tensor operation convert a kv feature column to a SparseTensor or DenseTensor
Kv2Tensor operation convert a kv feature column to a SparseTensor or DenseTensor
DenseTensor if transType = 0 SparseTensor if transType = 1
The input contains 2 elements which are
kvTensor,feaLen: kvTensor shape will be batch*1 and element is a kv string, only support one feature now depth: the length of the value set of the featurethe output shape will be batch*feaLen if transType = 0 the output shape will be a SparseTensor with dense shape batch*feaLen if transType = 1
- T
Numeric type. Parameter tensor numeric type. Only support float/double now
- D
Numeric type. Output tensor numeric type. Only support float/double now
- class L2Loss[T] extends Operation[Tensor[_], Tensor[_], T]
- class Less[T] extends Compare[T]
- class LessEqual[T] extends Compare[T]
- class Lgamma[T, D] extends Operation[Tensor[D], Tensor[D], T]
- class LogicalAnd[T] extends Operation[Table, Tensor[Boolean], T]
- class LogicalNot[T] extends Operation[Tensor[Boolean], Tensor[Boolean], T]
- class LogicalOr[T] extends Operation[Table, Tensor[Boolean], T]
-
class
Max[T, D] extends Operation[Table, Tensor[D], T]
Computes the maximum of elements across dimensions of a tensor.
Computes the maximum of elements across dimensions of a tensor. The input of Max should be two tensor, the first one is data, the second one is the dimension to compute maximum.
- class Maximum[T, D] extends Operation[Table, Tensor[D], T]
- class Minimum[T, D] extends Operation[Table, Tensor[D], T]
-
class
MkString[T] extends Operation[Tensor[_], Tensor[String], T]
MkString operation converts a SparseTensor/DenseTensor to a Dense Tensor[String]
MkString operation converts a SparseTensor/DenseTensor to a Dense Tensor[String]
the output shape will be 1-D Tensor[String].
- T
Numeric type. Parameter tensor numeric type. Only support float/double now
- class Mod[T, D] extends Operation[Table, Tensor[D], T]
-
class
ModuleToOperation[T] extends Operation[Activity, Activity, T]
Wrap a nn module to an Operation
Wrap a nn module to an Operation
- T
Numeric type. Only support float/double now
- class NotEqual[T] extends Operation[Table, Tensor[Boolean], T]
-
class
OneHot[T, D] extends Operation[Table, Tensor[D], T]
OneHot operation returns a one-hot tensor
OneHot operation returns a one-hot tensor
The input contains 4 elements which are
indices,depth,onValueandoffValue*[]:The locations represented by indices in
indicestake valueonValue, while all other locations take valueoffValue.onValueandoffValuemust have matching data types. If dtype is also provided, they must be the same data type as specified byD.If on_value is not provided, it will default to the value 1 with type dtype
If off_value is not provided, it will default to the value 0 with type dtype
If the input indices is rank N, the output will have rank N+1. The new axis is created at dimension axis (default: the new axis is appended at the end).
If indices is a scalar the output shape will be a vector of length depth
If indices is a vector of length features, the output shape will be: features x depth if axis == -1 depth x features if axis == 0
If indices is a matrix (batch) with shape [batch, features], the output shape will be:
batch x features x depth if axis == -1 batch x depth x features if axis == 1 depth x batch x features if axis == 0
- T
Numeric type. Parameter tensor numeric type. Only support float/double now
- D
Numeric type. Output tensor numeric type. Only support float/double now
-
abstract
class
Operation[A <: Activity, B <: Activity, T] extends AbstractModule[A, B, T]
Operation is an abstract class which represents a forward only layer.
Operation is an abstract class which represents a forward only layer. An operations has only forward functions and without backward functions. An operations should be only used in graph and make sure the backward graph won't contain operations.
- A
Input data type
- T
Numeric type. Only support float/double now
- class Pad[T, D] extends Operation[Table, Tensor[D], T]
- class Pow[T] extends Operation[Table, Tensor[_], T]
- class Prod[T] extends Operation[Tensor[_], Tensor[_], T]
- class RandomUniform[T, D] extends Operation[Tensor[Int], Tensor[D], T] with RandomNode
- class RangeOps[T, D] extends Operation[Table, Tensor[D], T]
- class Rank[T] extends Operation[Tensor[_], Tensor[Int], T]
- class ResizeBilinearOps[T] extends Operation[Activity, Tensor[T], T]
- class Rint[T] extends Operation[Tensor[Float], Tensor[Float], T]
- class Round[T, D] extends Operation[Tensor[D], Tensor[D], T]
-
class
SegmentSum[T] extends Operation[Table, Tensor[T], T]
Computes the sum along segments of a tensor.
-
class
Select[T] extends Operation[Table, Activity, T]
Selects elements from input, depending on given condition.
Selects elements from input, depending on given condition. The input is a table (condition, t, e)
- T
Numeric type. Only support float/double now
-
class
SelectTensor[T] extends Operation[Table, Tensor[T], T]
Select and copy a Tensor from a Table with a key.
Select and copy a Tensor from a Table with a key. And do tensor transformation if transformer is defined. If isTensorKey is
false, the real key is the value of keyTensor. Otherwise, the real key is keyTensor.- T
Numeric type
- class Sign[T, D] extends Operation[Tensor[D], Tensor[D], T]
-
class
Slice[T] extends Operation[Tensor[_], Tensor[_], T]
This operation extracts a slice of size size from a tensor input starting at the location specified by begin.
This operation extracts a slice of size size from a tensor input starting at the location specified by begin. The slice size is represented as a tensor shape, where size[i] is the number of elements of the 'i'th dimension of input that you want to slice The starting location (begin) for the slice is represented as an offset in each dimension of input. In other words, begin[i] is the offset into the 'i'th dimension of input that you want to slice from.
- T
Numeric type. Only support float/double now
-
class
SquaredDifference[T] extends Operation[Table, Tensor[_], T]
Returns (x - y)(x - y) element-wise.
- class Substr[T] extends Operation[Table, Tensor[ByteString], T]
- class Sum[T, D] extends Operation[Table, Tensor[D], T]
-
class
TensorOp[T] extends Operation[Tensor[T], Tensor[T], T]
TensorOp is an Operation with
Tensor[T]-formattedinput and output, which provides shortcuts to build Operations fortensor transformationby closures.TensorOp is an Operation with
Tensor[T]-formattedinput and output, which provides shortcuts to build Operations fortensor transformationby closures.
TensorOp will make a deep copy of input Tensor before transformation, so transformation will take no side effect. For now,SparseTensorsare not supported.
Chained feature is supported in TensorOp. And common tensor actions are provided with a chained style.
For instance:one case: val (transformer1, transformer2, transformer3) = ... val (op1, op2, op3) = (TensorOp[Float](transformer1), .., ..) val op = op1 -> op2 -> op3 `equals` val op = TensorOp[Float]((t: Tensor[Float], ev: TensorNumeric[Float]) => { transformer3(transformer2(transformer1(t, ev), ev), ev) }) another case: val op = (TensorOp[Float]() * 2.3f + 1.23f) / 1.11f - 0.66f `equals` val transformer = (t: Tensor[T], _) => t.mul(2.3f).add(1.23f).div(1.11f).sub(0.66f) val op = TensorOp[Float](transformer)
- T
Numeric type
-
class
Tile[T] extends Operation[Table, Tensor[_], T]
This operation creates a new tensor by replicating input multiples times.
This operation creates a new tensor by replicating input multiples times. The output tensor's i'th dimension has input.dims(i) * multiples[i] elements, and the values of input are replicated multiples[i] times along the 'i'th dimension.
For example, tiling [a b c d] by [1, 2] produces [a b c d a b c d].
- T
Numeric type. Only support float/double now
- class TopK[T, D] extends Operation[Tensor[D], Table, T]
- class TruncateDiv[T, D] extends Operation[Table, Tensor[D], T]
- class TruncatedNormal[T, DataType] extends Operation[Tensor[Int], Tensor[DataType], T]
Value Members
- object All extends Serializable
- object Any extends Serializable
- object ApproximateEqual extends Serializable
- object ArgMax extends Serializable
- object BatchMatMul extends Serializable
- object BucketizedCol extends Serializable
- object Cast extends Serializable
- object CategoricalColHashBucket extends Serializable
- object CategoricalColVocaList extends Serializable
- object Ceil extends Serializable
- object CrossCol extends Serializable
- object CrossEntropy extends Serializable
- object DepthwiseConv2D extends Serializable
- object Digamma extends Serializable
- object Dilation2D extends Serializable
- object Equal extends Serializable
- object Erf extends Serializable
- object Erfc extends Serializable
- object Exp extends Serializable
- object Expm1 extends Serializable
- object Floor extends Serializable
- object FloorDiv extends Serializable
- object FloorMod extends Serializable
- object Gather extends Serializable
- object Greater extends Serializable
- object GreaterEqual extends Serializable
- object InTopK extends Serializable
- object IndicatorCol extends Serializable
- object Inv extends Serializable
- object IsFinite extends Serializable
- object IsInf extends Serializable
- object IsNan extends Serializable
- object Kv2Tensor extends Serializable
- object L2Loss extends Serializable
- object Less extends Serializable
- object LessEqual extends Serializable
- object Lgamma extends Serializable
- object LogicalAnd extends Serializable
- object LogicalNot extends Serializable
- object LogicalOr extends Serializable
- object Max extends Serializable
- object Maximum extends Serializable
- object Minimum extends Serializable
- object MkString extends Serializable
- object Mod extends Serializable
- object ModuleToOperation extends Serializable
- object NotEqual extends Serializable
- object OneHot extends Serializable
- object Pad extends Serializable
- object Pow extends Serializable
- object Prod extends Serializable
- object RandomUniform extends ModuleSerializable with Serializable
- object RangeOps extends Serializable
- object Rank extends Serializable
- object ResizeBilinearOps extends Serializable
- object Rint extends Serializable
- object Round extends Serializable
- object SegmentSum extends Serializable
- object Select extends Serializable
- object SelectTensor extends Serializable
- object Sign extends Serializable
- object Slice extends Serializable
- object SquaredDifference extends Serializable
- object Substr extends Serializable
- object Sum extends Serializable
- object TensorOp extends Serializable
- object Tile extends Serializable
- object TopK extends Serializable
- object TruncateDiv extends Serializable
- object TruncatedNormal extends Serializable