Class UniversalTensor
java.lang.Object
com.linkedin.feathr.common.tensorbuilder.UniversalTensor
- All Implemented Interfaces:
TensorData
Implements a tensor from pre-allocated arrays.
The keys (int and long) and the values are stored in parallel arrays to float values.
Multiple keys of a certain type can be associated to a value, in that case the key
array size will be a multiple of the value array size.
-
Constructor Summary
ConstructorsConstructorDescriptionUniversalTensor(int[] intArray, long[] longArray, float[] floatArray, Representable[] columnTypes) Deprecated.UniversalTensor(int[] intArray, long[] longArray, String[] stringArray, double[] doubleArray, Representable[] columnTypes) Deprecated.UniversalTensor(int[] intArray, long[] longArray, String[] stringArray, float[] floatArray, double[] doubleArray, ColumnUtils utils) Deprecated.UniversalTensor(int[] intArray, long[] longArray, String[] stringArray, float[] floatArray, double[] doubleArray, Representable[] columnTypes) Deprecated.UniversalTensor(int[] intArray, long[] longArray, String[] stringArray, float[] floatArray, double[] doubleArray, Object[] bytesArray, ColumnUtils utils) Deprecated.UniversalTensor(int[] intArray, long[] longArray, String[] stringArray, float[] floatArray, Representable[] columnTypes) Deprecated.UniversalTensor(int intArity, int longArity, int floatArity, int[] intArray, long[] longArray, float[] floatArray, Representable[] columnTypes, boolean sort, int... columnIndex) Deprecated.UniversalTensor(int intArity, int longArity, int floatArity, int[] intArray, long[] longArray, float[] floatArray, Representable[] columnTypes, int... columnIndex) Deprecated.UniversalTensor(int intArity, int longArity, int floatArity, int[] intArray, long[] longArray, float[] floatArray, Representable[] columnTypes, int size, boolean sort, int... columnIndex) Deprecated.UniversalTensor(int intArity, int longArity, int stringArity, int floatArity, int[] intArray, long[] longArray, String[] stringArray, float[] floatArray, Representable[] columnTypes, boolean sort, int... columnIndex) Deprecated.UniversalTensor(int intArity, int longArity, int stringArity, int floatArity, int[] intArray, long[] longArray, String[] stringArray, float[] floatArray, Representable[] columnTypes, int... columnIndex) Deprecated.UniversalTensor(int intArity, int longArity, int stringArity, int floatArity, int doubleArity, int[] intArray, long[] longArray, String[] stringArray, float[] floatArray, double[] doubleArray, Representable[] columnTypes, boolean sort, int... columnIndex) Deprecated.UniversalTensor(int intArity, int longArity, int stringArity, int floatArity, int doubleArity, int[] intArray, long[] longArray, String[] stringArray, float[] floatArray, double[] doubleArray, Representable[] columnTypes, int size, boolean sort, int... columnIndex) Deprecated.UniversalTensor(int intArity, int longArity, int stringArity, int floatArity, int doubleArity, int booleanArity, int valueArity, int[] intArray, long[] longArray, String[] stringArray, float[] floatArray, double[] doubleArray, boolean[] booleanArray, Representable[] columnTypes, int size, boolean sort, int... columnIndex) Universal Tensor constructors should ideally not be used to create a UniversalTensor.UniversalTensor(int intArity, int longArity, int stringArity, int floatArity, int doubleArity, int booleanArity, int bytesArity, int valueArity, int[] intArray, long[] longArray, String[] stringArray, float[] floatArray, double[] doubleArray, boolean[] booleanArray, Object[] bytesArray, Representable[] columnTypes, int size, boolean sort, int... columnIndex) Universal Tensor constructors should ideally not be used to create a UniversalTensor. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.linkedin.feathr.common.tensor.TensorData
getShape
-
Constructor Details
-
UniversalTensor
@Deprecated public UniversalTensor(int intArity, int longArity, int floatArity, int[] intArray, long[] longArray, float[] floatArray, Representable[] columnTypes, int... columnIndex) Deprecated. -
UniversalTensor
@Deprecated public UniversalTensor(int intArity, int longArity, int floatArity, int[] intArray, long[] longArray, float[] floatArray, Representable[] columnTypes, int size, boolean sort, int... columnIndex) Deprecated. -
UniversalTensor
@Deprecated public UniversalTensor(int intArity, int longArity, int floatArity, int[] intArray, long[] longArray, float[] floatArray, Representable[] columnTypes, boolean sort, int... columnIndex) Deprecated. -
UniversalTensor
@Deprecated public UniversalTensor(int intArity, int longArity, int stringArity, int floatArity, int[] intArray, long[] longArray, String[] stringArray, float[] floatArray, Representable[] columnTypes, int... columnIndex) Deprecated. -
UniversalTensor
@Deprecated public UniversalTensor(int intArity, int longArity, int stringArity, int floatArity, int[] intArray, long[] longArray, String[] stringArray, float[] floatArray, Representable[] columnTypes, boolean sort, int... columnIndex) Deprecated. -
UniversalTensor
@Deprecated public UniversalTensor(int intArity, int longArity, int stringArity, int floatArity, int doubleArity, int[] intArray, long[] longArray, String[] stringArray, float[] floatArray, double[] doubleArray, Representable[] columnTypes, boolean sort, int... columnIndex) Deprecated. -
UniversalTensor
@Deprecated public UniversalTensor(int[] intArray, long[] longArray, float[] floatArray, Representable[] columnTypes) Deprecated.Generate arities and columns from types, assuming sequential ordering within types. -
UniversalTensor
@Deprecated public UniversalTensor(int[] intArray, long[] longArray, String[] stringArray, float[] floatArray, Representable[] columnTypes) Deprecated. -
UniversalTensor
@Deprecated public UniversalTensor(int[] intArray, long[] longArray, String[] stringArray, double[] doubleArray, Representable[] columnTypes) Deprecated. -
UniversalTensor
@Deprecated public UniversalTensor(int[] intArray, long[] longArray, String[] stringArray, float[] floatArray, double[] doubleArray, Representable[] columnTypes) Deprecated. -
UniversalTensor
@Deprecated public UniversalTensor(int[] intArray, long[] longArray, String[] stringArray, float[] floatArray, double[] doubleArray, ColumnUtils utils) Deprecated. -
UniversalTensor
@Deprecated public UniversalTensor(int[] intArray, long[] longArray, String[] stringArray, float[] floatArray, double[] doubleArray, Object[] bytesArray, ColumnUtils utils) Deprecated. -
UniversalTensor
@Deprecated public UniversalTensor(int intArity, int longArity, int stringArity, int floatArity, int doubleArity, int[] intArray, long[] longArray, String[] stringArray, float[] floatArray, double[] doubleArray, Representable[] columnTypes, int size, boolean sort, int... columnIndex) Deprecated. -
UniversalTensor
public UniversalTensor(int intArity, int longArity, int stringArity, int floatArity, int doubleArity, int booleanArity, int valueArity, int[] intArray, long[] longArray, String[] stringArray, float[] floatArray, double[] doubleArray, boolean[] booleanArray, Representable[] columnTypes, int size, boolean sort, int... columnIndex) Universal Tensor constructors should ideally not be used to create a UniversalTensor. Universal Tensors should be created by using the UniversalTensorBuilder. The other constructors are deprecated as they only support FLOAT/DOUBLE values.- Parameters:
intArity- number of int columns in a tensor row (includes dimensions and values)longArity- number of long columns in a tensor row (includes dimensions and values)stringArity- number of string columns in a tensor row (includes dimensions and values)floatArity- number of float columns in a tensor row (includes dimensions and values)doubleArity- number of double columns in a tensor row (includes dimensions and values)booleanArity- number of boolean columns in a tensor row (includes dimensions and values)valueArity- number of value columns in a tensor row. This value is needed as it's possible for UniversalTensors to have more than one value dimensionintArray- array corresponding to the int dimensions/valueslongArray- array corresponding to the long dimensions/valuesstringArray- array corresponding to the string dimensionsfloatArray- array corresponding to the float values. Floats can not be a dimensiondoubleArray- array corresponding to the double values. Doubles can not be a dimensionbooleanArray- array corresponding to the boolean dimensions/valuescolumnTypes- columnTypes representing the tensorsize- size of the tensor. (Number of rows).sort- sorts the tensor by the dimension if truecolumnIndex- columnIndices
-
UniversalTensor
public UniversalTensor(int intArity, int longArity, int stringArity, int floatArity, int doubleArity, int booleanArity, int bytesArity, int valueArity, int[] intArray, long[] longArray, String[] stringArray, float[] floatArray, double[] doubleArray, boolean[] booleanArray, Object[] bytesArray, Representable[] columnTypes, int size, boolean sort, int... columnIndex) Universal Tensor constructors should ideally not be used to create a UniversalTensor. Universal Tensors should be created by using the UniversalTensorBuilder. The other constructors are deprecated as they only support FLOAT/DOUBLE values.- Parameters:
intArity- number of int columns in a tensor row (includes dimensions and values)longArity- number of long columns in a tensor row (includes dimensions and values)stringArity- number of string columns in a tensor row (includes dimensions and values)floatArity- number of float columns in a tensor row (includes dimensions and values)doubleArity- number of double columns in a tensor row (includes dimensions and values)booleanArity- number of boolean columns in a tensor row (includes dimensions and values)bytesArity- number of bytes columns in a tensor row (includes dimensions and values)valueArity- number of value columns in a tensor row. This value is needed as it's possible for UniversalTensors to have more than one value dimensionintArray- array corresponding to the int dimensions/valueslongArray- array corresponding to the long dimensions/valuesstringArray- array corresponding to the string dimensionsfloatArray- array corresponding to the float values. Floats can not be a dimensiondoubleArray- array corresponding to the double values. Doubles can not be a dimensionbooleanArray- array corresponding to the boolean dimensions/valuesbytesArray- array corresponding to the bytes dimensions/valuescolumnTypes- columnTypes representing the tensorsize- size of the tensor. (Number of rows).sort- sorts the tensor by the dimension if truecolumnIndex- columnIndices
-
-
Method Details
-
getArity
public int getArity()- Specified by:
getArityin interfaceTensorData- Returns:
- the arity, which is the total number of columns. As columns are dimensions plus a value, arity is by one greater than dimensionality.
-
getTypes
- Specified by:
getTypesin interfaceTensorData- Returns:
- the types of all dimensions and the value as a single array.
-
estimatedCardinality
public int estimatedCardinality()- Specified by:
estimatedCardinalityin interfaceTensorData- Returns:
- conservative estimate of number of entries in the mapping from dimensions to values. Can be cheaper to evaluate than the exact one.
-
cardinality
public int cardinality()- Specified by:
cardinalityin interfaceTensorData- Returns:
- exact number of entries in the mapping from dimensions to values.
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceTensorData
-
iterator
- Specified by:
iteratorin interfaceTensorData- Returns:
- an iterator over entries in the mapping from dimensions to the value.
-
getIntArray
public int[] getIntArray() -
getIntArity
public int getIntArity() -
getLongArray
public long[] getLongArray() -
getLongArity
public int getLongArity() -
getStringArray
-
getStringArity
public int getStringArity() -
getFloatArray
public float[] getFloatArray() -
getFloatArity
public int getFloatArity() -
getDoubleArray
public double[] getDoubleArray() -
getDoubleArity
public int getDoubleArity() -
getBooleanArray
public boolean[] getBooleanArray() -
getBooleanArity
public int getBooleanArity() -
getBytesArray
-
getBytesArity
public int getBytesArity() -
getValueArity
public int getValueArity() -
getColumnIndex
public int[] getColumnIndex()
-
UniversalTensorBuilder