Primitive Operations Reference

Type Conversion Operations

OperationKey AssertionsNotes
parse_booleanOutput maintains input shapeConverts any input type to boolean
parse_decimalOutput maintains input shapeConverts to floating point values
parse_integerOutput maintains input shapeDecimals are rounded down
parse_textOutput maintains input shapeConverts to string representation

Shape & Dimension Operations

OperationKey AssertionsNotes
broadcast_to_shapeTarget shape size must be ≥ input shape size
Target dimension sizes must be ≥ corresponding input sizes
Broadcasting follows numpy/PyTorch rules
deduplicate_to_vectorInput must be arrayReturns 1D array with unique elements
expand_one_dimensionNew dimension index must be validAdds a dimension of size 1 at specified position
get_dimension_sizeDimension index must be validReturns scalar integer
get_shapeInput must be an arrayReturns 1D tensor of shape dimensions
reduce_one_dimensionDimension index & selected index must be validReduces array by one dimension
reduce_one_dimension_with_element_wise_selected_indicesSelected indices shape must match reduced shapeAllows different selection indices for each element
reshapeNew shape must have same total elementsTotal element count must match
swap_dimensionsArray must have > 1 dimension
Indices must be different
Swaps two dimensions of array

Indexing & Selection Operations

OperationKey AssertionsNotes
argwhereInput must be booleanReturns indices where input is true
argument_maximumDimension index must be valid
Array must be numeric
Returns indices of max values
argument_minimumDimension index must be valid
Array must be numeric
Returns indices of min values
gatherIndex array must be integer & ≥ 0
Index array dims must match input
Gathers values at indices along dimension
get_sub_arraysSelected indices must be validExtracts sub-arrays at indices
sliceStart index must be ≥ 0 & < end index
Start index must be < array size at dimension
Extracts slice from array
slice_with_multiple_indicesStart indices must be ≥ 0 & < end indicesAllows different start/end for each slice
top_kArray must be numeric
k must be > 0 & ≤ dimension size
Returns top k values and indices

Mathematical Operations

OperationKey AssertionsNotes
absolute_valueInput must be numericReturns absolute values
addOperands must have same shape & typeElement-wise addition
cumulative_sumArray must be numeric
Dimension index must be valid
Computes running sum along dimension
divideOperands must have same shape & type
Right operand must be non-zero
Element-wise division
element_wise_exponentiateBase & exponent must be decimalRaises base to power of exponent
element_wise_logarithmBase & argument must be decimalComputes logarithm of argument with given base
element_wise_multiplyArrays must have same shape & typeElement-wise multiplication
maximumArray must be numeric
Dimension index must be valid
Returns maximum values along dimension
meanArray must be numeric
Dimension index must be valid
Returns mean along dimension
minimumArray must be numeric
Dimension index must be valid
Returns minimum values along dimension
moduloOperands must be integerReturns remainder of division
multiplyOperands must have compatible shapesMatrix multiplication
productArray must be numeric
Dimension index must be valid
Returns product along dimension
subtractOperands must have same shape & typeElement-wise subtraction
sumArray must be numeric
Dimension index must be valid
Returns sum along dimension

Logical & Comparison Operations

OperationKey AssertionsNotes
conditional_filterCondition must be boolean
Data arrays must have same shape & type
Selects between two arrays based on condition
containTarget & check_against must have same type
Check_against must be array
Checks if values are in array
contain_combinationArrays must be integer
Target must be 2D
Checks if combinations are contained
contain_seqArrays must be integerChecks if sequences are contained
count_occurrencesArrays must have same typeCounts occurrences of values
equalOperands must have same shape & typeElement-wise equality check
greater_thanOperands must be numeric & same shapeElement-wise greater than check
id_to_one_hotID array must be integer
Num classes must be ≥ 1
Converts IDs to one-hot vectors
less_thanOperands must be numeric & same shapeElement-wise less than check
logical_andConditions must be boolean & same shapeElement-wise AND
logical_notCondition must be booleanElement-wise NOT
logical_orConditions must be boolean & same shapeElement-wise OR
is_scalarNo specific constraintsChecks if input is scalar
is_nanInput must be decimalChecks for NaN values

Array Manipulation Operations

OperationKey AssertionsNotes
concatenateArrays must have same number of dimensions
Dimension sizes must match except at concatenation dimension
Joins arrays along specified dimension
filterCondition must be boolean
Dimension index must be valid
Filters array along dimension based on condition
reverse_orderArray must be array
Dimension index must be valid
Reverses array along dimension
scatterArrays must have same dimensions
Indices must be valid
Updates values at indices
scatter_addDimension index must be valid
Indices must be integer
Adds values at indices
setInput and values must have same type
Coordinates must be integer
Sets values at coordinates
splitArray must be array
Element index must be valid
Splits array into two parts at specified index
swap_elementsIndices must be different & valid
Dimension index must be valid
Swaps elements within array

Randomness & Sampling Operations

OperationKey AssertionsNotes
argument_multinomialProbabilities must be decimal
Number samples must be > 0
Samples indices from probability distribution
generate_combinationsArray must be 1D
Samples must be integer
Generates combinations
generate_combinations_batchArray must be 1D
Samples and batch size must be integer
Generates batches of combinations
generate_uniform_random_numberShape must be > 0
Seed must be integer
Generates random numbers
rangeStart/end/step must be numeric
Start must not equal end
Step must be compatible with direction
Generates range of values
sample_by_stepStep value must be > 0Samples at regular intervals
shuffleArray must be array
Dimension index must be valid
Randomly reorders elements along dimension

Text Operations

OperationKey AssertionsNotes
concatenate_textInputs must be text & same shapeElement-wise text concatenation
contain_textInputs must be text
Search regex must be valid
Checks if regex matches text
get_text_lengthInput must be textReturns length of each text element
index_textText must be text
Vocabulary must be 1D
Converts text to indices
index_text_to_condensed_one_hotText must be text
Vocabulary must be 1D
Creates condensed one-hot encoding
index_text_to_one_hotText must be text
Vocabulary must be 1D
Creates one-hot encoding
insert_textInputs must be text
Search regex must be valid
Inserts text at regex matches
join_textText must be array
Separator must be text
Joins text elements with separator
lower_upper_case_textText & is_lower_case must have same shapeConverts text case based on boolean
replace_textInputs must be text
Search regex must be valid
Replaces regex matches
slice_textText must be text
Indices must be integer
Extracts substring between indices
split_subwords_longest_match_firstArrays must be textTokenizes words into subwords
split_textText must be text
Regex must be valid
Splits text by regex pattern

File Operations

OperationKey AssertionsNotes
delete_folderPath must be textDeletes folder if exists
exist_in_filesPaths must be textChecks if file exists
read_from_filePaths must be text
File must exist
Reads data from file
read_sub_arrays_from_filePaths must be text
File must exist
Indices must be ≥ 0
Reads specific indices from file
write_to_filePaths must be text
Overwrite flag must be boolean
Writes data to file

Special Operations

OperationKey AssertionsNotes
bilinear_interpolateInput must be decimal & multi-dimensional
Scale factor must be 2-element array
Applies bilinear interpolation
conv2dInput must be 4D decimal
Kernel must match input channels
Applies 2D convolution
conv2d_transposeInput must be 4D decimal
Kernel must match input channels
Applies transposed 2D convolution
diagonalInput must be 2DSets diagonal elements to value
differentiateInput/output must be decimalComputes derivative
dropoutArray must be decimal
Probability must be between 0-1
Applies dropout with rescaling
eigenInput must be square matrixReturns eigenvalues and eigenvectors
error_functionInput must be decimalComputes error function (erf)
identityNo specific constraintsReturns input unchanged
max_pooling2dInput must be 4D decimalApplies 2D max pooling
sineInput must be decimalComputes sine of input
cosineInput must be decimalComputes cosine of input