expr library

Extensions

ListVarpExtension on List<VARP>
VARPFormatting on VARP
Extension methods for VARP formatting

Functions

abs(VARP x) VARP
Computes the absolute value of a variable. Given a variable of integer or floating-point values, this operation returns a variable of the same type, where each element contains the absolute value of the corresponding element in the input.
acos(VARP x) VARP
Computes acos of x element-wise.
acosh(VARP x) VARP
Computes acosh of x element-wise.
add(VARP x, VARP y) VARP
Returns x + y element-wise.
argMax(VARP x, int axis) VARP
Returns the index with the largest value across axes of a tensor.
argMin(VARP x, int axis) VARP
Returns the index with the smallest value across axes of a tensor. Args:
array2string(List<num> data, List<int> shape, {PrintOptions options = const PrintOptions(), String separator = ', ', String prefix = '', String suffix = ''}) String
asin(VARP x) VARP
Computes the trignometric inverse sine of x element-wise.
asinh(VARP x) VARP
Computes asinh of x element-wise.
atan(VARP x) VARP
Computes the trignometric inverse tangent of x element-wise.
atan2(VARP x, VARP y) VARP
Computes arctangent of y/x element-wise, respecting signs of the arguments.
atanh(VARP x) VARP
Computes atanh of x element-wise.
avgPool(VARP x, List<int> kernal, {PaddingMode pad = PaddingMode.VALID, List<int> stride = const [1, 1], List<int> pads = const [0, 0]}) VARP
batchMatMul(VARP x, VARP y, {bool adjX = false, bool adjY = false}) VARP
Multiplies slices of two variable in batches
batchToSpaceND(VARP input, VARP blockShape, VARP crops) VARP
BatchToSpace for N-D variables
biasAdd(VARP x, VARP y) VARP
Adds bias to value.
bitwiseAnd(VARP x, VARP y) VARP
Returns the truth value of x & y element-wise.
bitwiseOr(VARP x, VARP y) VARP
Returns the truth value of x | y element-wise.
bitwiseXor(VARP x, VARP y) VARP
Returns the truth value of x ^ y element-wise.
broadcastTo(VARP x, VARP shape) VARP
calcColumnWidths(List<num> data, List<int> shape, PrintOptions options) List<int>
cast<T extends SizedNativeType>(VARP x, {HalideType? dtype}) VARP
Casts a variable to a new type.
ceil(VARP x) VARP
Returns element-wise smallest integer not less than x.
changeInputFormat(VARP x, DimensionFormat format) VARP
Convert a variable to another format(possibily added before input).
channelShuffle(VARP x, int group) VARP
clone(VARP x, {bool deepCopy = false}) VARP
concat(List<VARP> values, int axis) VARP
Concatenates variables along one dimension.
constant<T extends SizedNativeType>(Iterable<num> data, Iterable<int> shape, {DimensionFormat format = DimensionFormat.NHWC}) VARP
create a constant variable.
conv(VARP x, VARP weight, {VARP? bias, PaddingMode pad = PaddingMode.VALID, List<int> stride = const [1, 1], List<int> dilatie = const [1, 1], int group = 1, List<int> pads = const [0, 0]}) VARP
conv2d(VARP x, VARP weight, {VARP? bias, PaddingMode pad = PaddingMode.VALID, List<int> stride = const [1, 1], List<int> dilatie = const [1, 1], int group = 1, List<int> pads = const [0, 0]}) VARP
conv2dTranspose(VARP x, VARP weight, {VARP? bias, PaddingMode pad = PaddingMode.VALID, List<int> stride = const [1, 1], List<int> dilatie = const [1, 1], int group = 1, List<int> pads = const [0, 0]}) VARP
convert(VARP input, DimensionFormat format) VARP
Convert a variable to another format(possibily added after input).
cos(VARP x) VARP
Computes cos of x element-wise.
cosh(VARP x) VARP
Computes cosh of x element-wise.
CosineSimilarity(VARP input0, VARP input1, VARP inputDim) VARP
crop(VARP images, VARP size, int axis, List<int> offset) VARP
Crop images.
cropAndResize(VARP image, VARP boxes, VARP boxInd, VARP cropSize, InterpolationMethod method, {double extrapolationValue = 0.0}) VARP
Extracts crops from the input image variable and resizes them using bilinear sampling or nearest neighbor sampling (possibly with aspect ratio change) to a common output size specified by crop_size.
cumProd(VARP x, int axis) VARP
cumSum(VARP x, int axis, {bool exclusive = false, bool reverse = false}) VARP
deconv(VARP x, VARP weight, {VARP? bias, PaddingMode pad = PaddingMode.VALID, List<int> stride = const [1, 1], List<int> dilatie = const [1, 1], int group = 1, List<int> pads = const [0, 0]}) VARP
depthToSpace(VARP input, int blockSize) VARP
Rearranges data from depth into blocks of spatial data.
divide(VARP x, VARP y) VARP
Computes Python style division of x by y.
elu(VARP features, {double alpha = 1.0}) VARP
Computes exponential linear: alpha * (exp(features) - 1) if < 0, features otherwise.
equal(VARP x, VARP y) VARP
Returns the truth value of (x == y) element-wise.
erf(VARP x) VARP
Computes the Gauss error function of x element-wise.
erfc(VARP x) VARP
Computes the complementary error function of x element-wise.
erfinv(VARP x) VARP
Computes the inverse function for erf, for x element-wise.
exp(VARP x) VARP
Computes exponential of x element-wise.
expandDims(VARP x, int axis) VARP
Returns a variable with an additional dimension inserted at index axis.
expandDims1(VARP x, VARP axis) VARP
expm1(VARP x) VARP
Computes ((exponential of x) - 1) element-wise.
fill(VARP dims, VARP value) VARP
Creates a variable filled with a scalar value.
floatToInt8(VARP x, VARP scale, {int minvalue = -127, int maxValue = 127, int? zeroPoint}) VARP
floor(VARP x) VARP
Returns element-wise largest integer not greater than x.
floorDiv(VARP x, VARP y) VARP
Returns the value of (x // y) element-wise.
floorMod(VARP x, VARP y) VARP
Returns element-wise remainder of division
formatAligned(num v, int width, PrintOptions options) String
formatFloat(num x, int precision, bool suppress) String
formatInt(int x) String
gather(VARP input, VARP indices) VARP
Gather slices from params according to indices.
gatherElements(VARP params, VARP indices, {VARP? axis}) VARP
gatherND(VARP params, VARP indices) VARP
Gather slices from params into a variable with shape specified by indices.
gatherV2(VARP input, VARP indices, VARP axis) VARP
Gather slices from params axis according to indices.
gelu(VARP x) VARP
Computes Gelu of x element-wise.
greater(VARP x, VARP y) VARP
Returns the truth value of (x > y) element-wise.
greaterEqual(VARP x, VARP y) VARP
Returns the truth value of (x >= y) element-wise.
GridSample(VARP input, VARP grid, {InterpolationMethod mode = InterpolationMethod.BILINEAR, GridSamplePaddingMode paddingMode = GridSamplePaddingMode.GRID_SAMPLE_PADDING_ZEROS, bool alignCorners = false}) VARP
hardswish(VARP x) VARP
Computes Hardswish of x element-wise.
histogram(VARP x, int bin, int min, int max, {int channel = -1}) VARP
input<T extends SizedNativeType>(List<int> shape, {DimensionFormat dataFormat = DimensionFormat.NC4HW4}) VARP
create a input variable.
int8ToFloat(VARP x, VARP scale, {int? zeroPoint}) VARP
interp(List<VARP> xs, double widthScale, double heightScale, int outputWidth, int outputHeight, int resizeType, bool alignCorners) VARP
less(VARP x, VARP y) VARP
Returns the truth value of (x < y) element-wise.
lessEqual(VARP x, VARP y) VARP
Returns the truth value of (x <= y) element-wise.
linSpace(VARP start, VARP stop, VARP num) VARP
log(VARP x) VARP
Computes natural logarithm of x element-wise.
log1p(VARP x) VARP
Computes natural logarithm of (1 + x) element-wise.
logicalOr(VARP x, VARP y) VARP
Returns the truth value of x OR y element-wise.
matMul(VARP x, VARP y, {bool transposeA = false, bool transposeB = false}) VARP
Multiply the matrix "a" by the matrix "b".
matrixBandPart(VARP input, VARP lower, VARP upper) VARP
Copies a variable setting everything outside a central band in each innermost matrix.
max(VARP x, VARP y, {List<double> coeff = const []}) VARP
Compute the element-wise max
maximum(VARP x, VARP y) VARP
Returns the max of x and y (i.e. x > y ? x : y) element-wise.
maxPool(VARP x, List<int> kernal, {PaddingMode pad = PaddingMode.VALID, List<int> stride = const [1, 1], List<int> pads = const [0, 0]}) VARP
minimum(VARP x, VARP y) VARP
Returns the min of x and y (i.e. x < y ? x : y) element-wise.
mod(VARP x, VARP y) VARP
moments(VARP x, List<int> axis, VARP shift, bool keepDims) List<VARP>
Calculates the mean and variance of x.
multiply(VARP x, VARP y) VARP
Returns x * y element-wise.
negative(VARP x) VARP
Computes numerical negative value element-wise.
nms(VARP boxes, VARP scores, int maxDetections, {double iouThreshold = -1.0, double scoreThreshold = -1.0}) VARP
normalize(VARP x, int acrossSpatial, int channelShared, double eps, List<double> scale) VARP
notEqual(VARP x, VARP y) VARP
Returns the truth value of x != y element-wise.
oneHot(VARP indices, VARP depth, {VARP? onValue, VARP? offValue, int axis = -1}) VARP
pad(VARP x, VARP paddings, {PadValueMode mode = PadValueMode.CONSTANT}) VARP
Pads a variable.
Permute(VARP input, List<int> dims) VARP
SSD network's permute layer.
pow(VARP x, VARP y) VARP
Computes the power of one value to another.
PReLU(VARP x, List<double> slopes) VARP
Given an input value x, it computes the output as x if x > 0 and slopes * x if x <= 0.
prod(VARP x, VARP y, {List<double> coeff = const []}) VARP
Compute the element-wise prod
randomUniform<T extends SizedNativeType>(VARP shape, {double low = 0.0, double high = 1.0, int seed0 = 0, int seed1 = 0}) VARP
range(VARP start, VARP limit, VARP delta) VARP
Creates a sequence of numbers.
rank(VARP input) VARP
Returns the rank of a variable.
reciprocal(VARP x) VARP
Computes the reciprocal of x element-wise.
reduceAll(VARP x, {List<int> axis = const [], bool keepDims = false}) VARP
Computes the "logical and" of elements across dimensions of a variable.
reduceAllMutable(VARP x, {VARP? axis, bool keepDims = false}) VARP
reduceAny(VARP x, {List<int> axis = const [], bool keepDims = false}) VARP
Computes the "logical or" of elements across dimensions of a variable.
reduceAnyMutable(VARP x, {VARP? axis, bool keepDims = false}) VARP
reduceMax(VARP x, {List<int> axis = const [], bool keepDims = false}) VARP
Computes the maximum of elements across dimensions of a variable.
reduceMaxMutable(VARP x, {VARP? axis, bool keepDims = false}) VARP
reduceMean(VARP x, {List<int> axis = const [], bool keepDims = false}) VARP
Computes the mean of elements across dimensions of a variable.
reduceMeanMutable(VARP x, {VARP? axis, bool keepDims = false}) VARP
reduceMin(VARP x, {List<int> axis = const [], bool keepDims = false}) VARP
Computes the minimum of elements across dimensions of a variable.
reduceMinMutable(VARP x, {VARP? axis, bool keepDims = false}) VARP
reduceProd(VARP x, {List<int> axis = const [], bool keepDims = false}) VARP
Computes the product of elements across dimensions of a variable.
reduceProdMutable(VARP x, {VARP? axis, bool keepDims = false}) VARP
reduceSum(VARP x, {List<int> axis = const [], bool keepDims = false}) VARP
Computes the sum of elements across dimensions of a variable
reduceSumMutable(VARP x, {VARP? axis, bool keepDims = false}) VARP
reduceVariance(VARP x, {List<int> axis = const [], bool keepDims = false}) VARP
Computes the variance of elements across dimensions of a variable.
ReLU(VARP x, {double slope = 0.0}) VARP
Given an input value x, it computes the output as x if x > 0 and slope * x if x <= 0.
ReLU6(VARP x, {double minValue = 0.0, double maxValue = 6.0}) VARP
Given an input value x, it computes Rectified Linear 6: min(max(x, 0), 6).
reshape(VARP x, List<int> shape, {DimensionFormat format = DimensionFormat.NCHW}) VARP
Reshapes a variable.
resize(VARP images, double xScale, double yScale) VARP
Resize images.
reverse(VARP x, VARP axis) VARP
reverseSequence(VARP x, VARP y, int batchDim, int seqDim) VARP
round(VARP x) VARP
Returns element-wise rounded integer not less than x.
rsqrt(VARP x) VARP
Computes reciprocal of square root of x element-wise.
scalar<T extends SizedNativeType>(num value, {HalideType? dtype}) VARP
scale(VARP x, int channels, List<double> scales, List<double> biases) VARP
scatterElements(VARP data, VARP indices, VARP updates, {VARP? axis, int reduction = -1}) VARP
scatterND(VARP indices, VARP updates, VARP shape, {VARP? input, int? reduction}) VARP
select(VARP select, VARP input0, VARP input1) VARP
selu(VARP features, double scale, double alpha) VARP
Computes scaled exponential linear: scale * alpha * (exp(features) - 1) if < 0, scale * features otherwise.
setDiff1D(VARP x, VARP y) VARP
Computes the difference between two lists of numbers or strings.
shape(VARP input, {bool nchw = false}) VARP
Returns the shape of a variable.
sigmoid(VARP x) VARP
Computes sigmoid of x element-wise.
sign(VARP x) VARP
Computes sign of x eltment-wise
silu(VARP x) VARP
Computes sigmoid of x element-wise.
sin(VARP x) VARP
Computes sine of x element-wise.
sinh(VARP x) VARP
Computes sinh of x element-wise.
size(VARP input) VARP
Computes the size of the variable
slice(VARP x, VARP starts, VARP sizes) VARP
softMax(VARP logits, {int axis = -1}) VARP
Computes softmax activations.
softPlus(VARP features) VARP
Computes softplus: log(exp(features) + 1).
softSign(VARP features) VARP
Computes softsign: features / (abs(features) + 1).
sort(VARP x, {int axis = -1, bool arg = false, bool descend = false}) VARP
spaceToBatchND(VARP input, VARP blockShape, VARP paddings) VARP
This operation divides "spatial" dimensions 1, ..., M of the input into a grid of blocks of shape block_shape, and interleaves these blocks with the "batch" dimension such that in the output, the spatial dimensions 1, ..., M correspond to the position within the grid, and the batch dimension combines both the position within a spatial block and the original batch position.
spaceToDepth(VARP input, int blockSize) VARP
Rearranges blocks of spatial data, into depth.
split(VARP value, List<int> sizeSplits, {int axis = 0}) List<VARP>
Splits a variable value into a list of sub variables.
sqrt(VARP x) VARP
Computes square root of x element-wise.
square(VARP x) VARP
Computes square of x element-wise.
squaredDifference(VARP x, VARP y) VARP
Returns the value of (x - y)(x - y) element-wise.
squeeze(VARP input, {List<int> axis = const []}) VARP
Removes dimensions of size 1 from the shape of a variable.
stack(List<VARP> values, {int axis = 0}) VARP
Stacks a list of rank-R variables into one rank-(R+1) variable.
stridedSlice(VARP input, VARP begin, VARP end, VARP strided, int beginMask, int endMask, int ellipsisMask, int newAxisMask, int shrinkAxisMask) VARP
stridedSliceWrite(VARP input, VARP begin, VARP end, VARP strided, VARP write, int beginMask, int endMask, int ellipsisMask, int newAxisMask, int shrinkAxisMask) VARP
sub(VARP x, VARP y, {List<double> coeff = const []}) VARP
Compute the element-wise sub
subtract(VARP x, VARP y) VARP
Returns x - y element-wise.
sum(VARP x, VARP y, {List<double> coeff = const []}) VARP
Compute the element-wise sum
svd(VARP x) List<VARP>
tan(VARP x) VARP
Computes tan of x element-wise.
tanh(VARP x) VARP
Computes hyperbolic tangent of x element-wise.
threshold(VARP features, {double alpha = 1.0}) VARP
Given an input value x, it computes the output as 1.0 if x > threshold and 0.0 if x <= threshold.
tile(VARP input, VARP multiples) VARP
Constructs a variable by tiling a given variable.
transpose(VARP x, List<int> perm) VARP
Transposes x.
transpose1(VARP x, VARP perm) VARP
unravelIndex(VARP indices, VARP dims) VARP
unsqueeze(VARP input, {List<int> axis = const []}) VARP
unstack(VARP input, {int axis = 0}) List<VARP>
Unpacks the given dimension of a rank-R tensor into rank-(R-1) variable.
where(VARP x) VARP
zeroGrad(VARP input) VARP
zerosLike(VARP input) VARP
Creates a variable with all elements set to zero.