Build grammer

This commit is contained in:
mcDandy
2026-08-08 23:57:46 +02:00
parent e91b29defb
commit d36cb04f91
19 changed files with 7225 additions and 6638 deletions
+4 -5
View File
@@ -419,11 +419,11 @@ func1:
/**
flow_angle(x) - computes the angle of optical flow (basically angle() but real and imaginery is separate in 2 dimensions)
*/
| FLOW_ANG LPAREN expr RPAREN # FlowAngFunc;
| FLOW_ANG LPAREN expr RPAREN # FlowAngFunc
/**
as_nested(x) - converts a list to a nested tensor (special object containing tensors of different shapes behaving like a tensor)
*/
| AS_NESTED LPAREN expr RPAREN # AsNestedFunc;
| AS_NESTED LPAREN expr RPAREN # AsNestedFunc
/**
svd(x) - computes the singular value decomposition of x. Returns a list of 3 tensors: U, S, V such that x = matmul(matmul(U, diagonal_matrix(S,shape(U))), V)
*/
@@ -604,8 +604,7 @@ func2:
/**
interpolate_nearest_exact(x, y) - performs nearest neighbor interpolation X. Assumes that dim 0 is batch and dim 1 = channel
*/
| INTERPOLATE_NEAREST LPAREN expr COMMA expr RPAREN # InterpolateNearestExactFunc
;
| INTERPOLATE_NEAREST LPAREN expr COMMA expr RPAREN # InterpolateNearestExactFunc;
func3:
@@ -724,7 +723,7 @@ func5:
/**
remap(v, i_min, i_max, o_min, o_max) - remaps values from input range to output range
*/
REMAP LPAREN expr COMMA expr COMMA expr COMMA expr COMMA expr RPAREN # RemapFunc;
REMAP LPAREN expr COMMA expr COMMA expr COMMA expr COMMA expr RPAREN # RemapFunc
/**
diagonal_matrix(x, shape, [offset], [dim1], [dim2]) - creates a diagonal matrix from x with specified shape. offset is the diagonal offset. dim1 and dim2 are the dimensions to place the diagonal on.
*/
File diff suppressed because one or more lines are too long
+139 -133
View File
@@ -139,87 +139,90 @@ INTERPOLATE_LINEAR=138
INTERPOLATE_AREA=139
INTERPOLATE_NEAREST=140
TEXT_IMAGE=141
IF=142
ELSE=143
WHILE=144
FOR=145
IN=146
BREAK=147
CONTINUE=148
RETURN=149
TIMESTAMP=150
SORT=151
ARGSORT=152
ARGMIN=153
ARGMAX=154
SOFTMAX=155
SOFTMIN=156
UNIQUE=157
FLIP=158
ROLL=159
COV=160
CORR=161
ENTROPY=162
CROP=163
NONE=164
NOISE=165
RAND=166
CAUCHY=167
EXPONENTIAL=168
LOGNORMAL=169
BERNOULLI=170
POISSON=171
GAMMADIST=172
BETADIST=173
LAPLACEDIST=174
GUMBELDIST=175
WEIBULLDIST=176
CHI2DIST=177
STUDENTTDIST=178
PERLIN=179
CELLULAR=180
PLASMA=181
RIDGED=182
DOMAIN_WARP=183
PLUS=184
MINUS=185
MULT=186
DIV=187
MOD=188
POW=189
LSHIFT=190
RSHIFT=191
GE=192
GT=193
LE=194
LT=195
EQ=196
EQUEALS=197
PLUS_EQ=198
MINUS_EQ=199
MULT_EQ=200
DIV_EQ=201
MOD_EQ=202
NE=203
PIPE=204
LPAREN=205
RPAREN=206
COMMA=207
SEMICOLON=208
ARROW=209
LBRACKET=210
RBRACKET=211
QUESTION=212
COLON=213
LBRACE=214
RBRACE=215
NUMBER=216
CONSTANT=217
STRING=218
VARIABLE=219
SL_COMMENT=220
ML_COMMENT=221
WS=222
AS_NESTED=142
SVD=143
DIAG=144
IF=145
ELSE=146
WHILE=147
FOR=148
IN=149
BREAK=150
CONTINUE=151
RETURN=152
TIMESTAMP=153
SORT=154
ARGSORT=155
ARGMIN=156
ARGMAX=157
SOFTMAX=158
SOFTMIN=159
UNIQUE=160
FLIP=161
ROLL=162
COV=163
CORR=164
ENTROPY=165
CROP=166
NONE=167
NOISE=168
RAND=169
CAUCHY=170
EXPONENTIAL=171
LOGNORMAL=172
BERNOULLI=173
POISSON=174
GAMMADIST=175
BETADIST=176
LAPLACEDIST=177
GUMBELDIST=178
WEIBULLDIST=179
CHI2DIST=180
STUDENTTDIST=181
PERLIN=182
CELLULAR=183
PLASMA=184
RIDGED=185
DOMAIN_WARP=186
PLUS=187
MINUS=188
MULT=189
DIV=190
MOD=191
POW=192
LSHIFT=193
RSHIFT=194
GE=195
GT=196
LE=197
LT=198
EQ=199
EQUEALS=200
PLUS_EQ=201
MINUS_EQ=202
MULT_EQ=203
DIV_EQ=204
MOD_EQ=205
NE=206
PIPE=207
LPAREN=208
RPAREN=209
COMMA=210
SEMICOLON=211
ARROW=212
LBRACKET=213
RBRACKET=214
QUESTION=215
COLON=216
LBRACE=217
RBRACE=218
NUMBER=219
CONSTANT=220
STRING=221
VARIABLE=222
SL_COMMENT=223
ML_COMMENT=224
WS=225
'sin'=1
'cos'=2
'tan'=3
@@ -332,55 +335,58 @@ WS=222
'interpolate_linear'=138
'interpolate_area'=139
'text_image'=141
'if'=142
'else'=143
'while'=144
'for'=145
'in'=146
'break'=147
'continue'=148
'return'=149
'sort'=151
'argsort'=152
'argmin'=153
'argmax'=154
'softmax'=155
'softmin'=156
'unique'=157
'flip'=158
'roll'=159
'cov'=160
'entropy'=162
'crop'=163
'+'=184
'-'=185
'*'=186
'/'=187
'%'=188
'^'=189
'<<'=190
'>>'=191
'>='=192
'>'=193
'<='=194
'<'=195
'=='=196
'='=197
'+='=198
'-='=199
'*='=200
'/='=201
'%='=202
'!='=203
'|'=204
'('=205
')'=206
','=207
';'=208
'->'=209
'['=210
']'=211
'?'=212
':'=213
'{'=214
'}'=215
'as_nested_tensor'=142
'svd'=143
'diagonal_matrix'=144
'if'=145
'else'=146
'while'=147
'for'=148
'in'=149
'break'=150
'continue'=151
'return'=152
'sort'=154
'argsort'=155
'argmin'=156
'argmax'=157
'softmax'=158
'softmin'=159
'unique'=160
'flip'=161
'roll'=162
'cov'=163
'entropy'=165
'crop'=166
'+'=187
'-'=188
'*'=189
'/'=190
'%'=191
'^'=192
'<<'=193
'>>'=194
'>='=195
'>'=196
'<='=197
'<'=198
'=='=199
'='=200
'+='=201
'-='=202
'*='=203
'/='=204
'%='=205
'!='=206
'|'=207
'('=208
')'=209
','=210
';'=211
'->'=212
'['=213
']'=214
'?'=215
':'=216
'{'=217
'}'=218
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+139 -133
View File
@@ -139,87 +139,90 @@ INTERPOLATE_LINEAR=138
INTERPOLATE_AREA=139
INTERPOLATE_NEAREST=140
TEXT_IMAGE=141
IF=142
ELSE=143
WHILE=144
FOR=145
IN=146
BREAK=147
CONTINUE=148
RETURN=149
TIMESTAMP=150
SORT=151
ARGSORT=152
ARGMIN=153
ARGMAX=154
SOFTMAX=155
SOFTMIN=156
UNIQUE=157
FLIP=158
ROLL=159
COV=160
CORR=161
ENTROPY=162
CROP=163
NONE=164
NOISE=165
RAND=166
CAUCHY=167
EXPONENTIAL=168
LOGNORMAL=169
BERNOULLI=170
POISSON=171
GAMMADIST=172
BETADIST=173
LAPLACEDIST=174
GUMBELDIST=175
WEIBULLDIST=176
CHI2DIST=177
STUDENTTDIST=178
PERLIN=179
CELLULAR=180
PLASMA=181
RIDGED=182
DOMAIN_WARP=183
PLUS=184
MINUS=185
MULT=186
DIV=187
MOD=188
POW=189
LSHIFT=190
RSHIFT=191
GE=192
GT=193
LE=194
LT=195
EQ=196
EQUEALS=197
PLUS_EQ=198
MINUS_EQ=199
MULT_EQ=200
DIV_EQ=201
MOD_EQ=202
NE=203
PIPE=204
LPAREN=205
RPAREN=206
COMMA=207
SEMICOLON=208
ARROW=209
LBRACKET=210
RBRACKET=211
QUESTION=212
COLON=213
LBRACE=214
RBRACE=215
NUMBER=216
CONSTANT=217
STRING=218
VARIABLE=219
SL_COMMENT=220
ML_COMMENT=221
WS=222
AS_NESTED=142
SVD=143
DIAG=144
IF=145
ELSE=146
WHILE=147
FOR=148
IN=149
BREAK=150
CONTINUE=151
RETURN=152
TIMESTAMP=153
SORT=154
ARGSORT=155
ARGMIN=156
ARGMAX=157
SOFTMAX=158
SOFTMIN=159
UNIQUE=160
FLIP=161
ROLL=162
COV=163
CORR=164
ENTROPY=165
CROP=166
NONE=167
NOISE=168
RAND=169
CAUCHY=170
EXPONENTIAL=171
LOGNORMAL=172
BERNOULLI=173
POISSON=174
GAMMADIST=175
BETADIST=176
LAPLACEDIST=177
GUMBELDIST=178
WEIBULLDIST=179
CHI2DIST=180
STUDENTTDIST=181
PERLIN=182
CELLULAR=183
PLASMA=184
RIDGED=185
DOMAIN_WARP=186
PLUS=187
MINUS=188
MULT=189
DIV=190
MOD=191
POW=192
LSHIFT=193
RSHIFT=194
GE=195
GT=196
LE=197
LT=198
EQ=199
EQUEALS=200
PLUS_EQ=201
MINUS_EQ=202
MULT_EQ=203
DIV_EQ=204
MOD_EQ=205
NE=206
PIPE=207
LPAREN=208
RPAREN=209
COMMA=210
SEMICOLON=211
ARROW=212
LBRACKET=213
RBRACKET=214
QUESTION=215
COLON=216
LBRACE=217
RBRACE=218
NUMBER=219
CONSTANT=220
STRING=221
VARIABLE=222
SL_COMMENT=223
ML_COMMENT=224
WS=225
'sin'=1
'cos'=2
'tan'=3
@@ -332,55 +335,58 @@ WS=222
'interpolate_linear'=138
'interpolate_area'=139
'text_image'=141
'if'=142
'else'=143
'while'=144
'for'=145
'in'=146
'break'=147
'continue'=148
'return'=149
'sort'=151
'argsort'=152
'argmin'=153
'argmax'=154
'softmax'=155
'softmin'=156
'unique'=157
'flip'=158
'roll'=159
'cov'=160
'entropy'=162
'crop'=163
'+'=184
'-'=185
'*'=186
'/'=187
'%'=188
'^'=189
'<<'=190
'>>'=191
'>='=192
'>'=193
'<='=194
'<'=195
'=='=196
'='=197
'+='=198
'-='=199
'*='=200
'/='=201
'%='=202
'!='=203
'|'=204
'('=205
')'=206
','=207
';'=208
'->'=209
'['=210
']'=211
'?'=212
':'=213
'{'=214
'}'=215
'as_nested_tensor'=142
'svd'=143
'diagonal_matrix'=144
'if'=145
'else'=146
'while'=147
'for'=148
'in'=149
'break'=150
'continue'=151
'return'=152
'sort'=154
'argsort'=155
'argmin'=156
'argmax'=157
'softmax'=158
'softmin'=159
'unique'=160
'flip'=161
'roll'=162
'cov'=163
'entropy'=165
'crop'=166
'+'=187
'-'=188
'*'=189
'/'=190
'%'=191
'^'=192
'<<'=193
'>>'=194
'>='=195
'>'=196
'<='=197
'<'=198
'=='=199
'='=200
'+='=201
'-='=202
'*='=203
'/='=204
'%='=205
'!='=206
'|'=207
'('=208
')'=209
','=210
';'=211
'->'=212
'['=213
']'=214
'?'=215
':'=216
'{'=217
'}'=218
@@ -1304,6 +1304,24 @@ class MathExprListener(ParseTreeListener):
pass
# Enter a parse tree produced by MathExprParser#AsNestedFunc.
def enterAsNestedFunc(self, ctx:MathExprParser.AsNestedFuncContext):
pass
# Exit a parse tree produced by MathExprParser#AsNestedFunc.
def exitAsNestedFunc(self, ctx:MathExprParser.AsNestedFuncContext):
pass
# Enter a parse tree produced by MathExprParser#SvdFunc.
def enterSvdFunc(self, ctx:MathExprParser.SvdFuncContext):
pass
# Exit a parse tree produced by MathExprParser#SvdFunc.
def exitSvdFunc(self, ctx:MathExprParser.SvdFuncContext):
pass
# Enter a parse tree produced by MathExprParser#PowFunc.
def enterPowFunc(self, ctx:MathExprParser.PowFuncContext):
pass
@@ -1943,6 +1961,15 @@ class MathExprListener(ParseTreeListener):
pass
# Enter a parse tree produced by MathExprParser#DiagonalMatrixFunc.
def enterDiagonalMatrixFunc(self, ctx:MathExprParser.DiagonalMatrixFuncContext):
pass
# Exit a parse tree produced by MathExprParser#DiagonalMatrixFunc.
def exitDiagonalMatrixFunc(self, ctx:MathExprParser.DiagonalMatrixFuncContext):
pass
# Enter a parse tree produced by MathExprParser#SMinFunc.
def enterSMinFunc(self, ctx:MathExprParser.SMinFuncContext):
pass
File diff suppressed because it is too large Load Diff
@@ -729,6 +729,16 @@ class MathExprVisitor(ParseTreeVisitor):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#AsNestedFunc.
def visitAsNestedFunc(self, ctx:MathExprParser.AsNestedFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#SvdFunc.
def visitSvdFunc(self, ctx:MathExprParser.SvdFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#PowFunc.
def visitPowFunc(self, ctx:MathExprParser.PowFuncContext):
return self.visitChildren(ctx)
@@ -1084,6 +1094,11 @@ class MathExprVisitor(ParseTreeVisitor):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#DiagonalMatrixFunc.
def visitDiagonalMatrixFunc(self, ctx:MathExprParser.DiagonalMatrixFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#SMinFunc.
def visitSMinFunc(self, ctx:MathExprParser.SMinFuncContext):
return self.visitChildren(ctx)
+4 -1
View File
@@ -6,7 +6,7 @@ INBUILT_CONSTANTS = {
'e', 'pi'
}
INBUILT_FUNCTIONS = {
'abs', 'acos', 'acosh', 'all', 'angle', 'any', 'append', 'argmax', 'argmin', 'argsort', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'band', 'batch_shuffle', 'bitcount', 'bitwise_and', 'bitwise_not', 'bitwise_or', 'bitwise_xor', 'blur', 'bnot', 'bor', 'botk', 'botk_ind', 'botk_indices', 'bxor', 'cat', 'ceil', 'cellular', 'cellular_noise', 'cielab_to_rgb', 'clamp', 'cnt', 'concat', 'concatenate', 'conv', 'convolution', 'corr', 'correlation', 'cos', 'cosh', 'cosine_similarity', 'cossim', 'count', 'cov', 'crop', 'cross', 'cubic', 'cubic_ease', 'cumprod', 'cumsum', 'dilate', 'dist', 'distance', 'domain_warp', 'domain_warp_noise', 'dot', 'edge', 'elastic', 'elastic_ease', 'entropy', 'erf', 'erfinv', 'erode', 'exp', 'ezconv', 'ezconvolution', 'fft', 'find', 'flatten', 'flip', 'float', 'floor', 'flow_ang', 'flow_angle', 'flow_apply', 'flow_mag', 'flow_magnitude', 'flow_to_image', 'fract', 'gamma', 'gaussian', 'gelu', 'get_value', 'hist', 'histogram', 'hsv_to_rgb', 'ifft', 'int', 'int_to_rgb', 'interpolate_area', 'interpolate_linear', 'interpolate_nearest', 'interpolate_nearest_exact', 'join', 'length', 'lerp', 'linspace', 'ln', 'log', 'logspace', 'lower', 'map', 'matmul', 'mean', 'median', 'mode', 'moment', 'morph_close', 'morph_open', 'motion_mask', 'nan_to_num', 'noise', 'now', 'nvl', 'oklab_to_rgb', 'overlay', 'pad', 'percentile', 'perlin', 'perlin_noise', 'perm', 'permute', 'pinv', 'plasma', 'plasma_noise', 'popcnt', 'popcount', 'pow', 'prcnt', 'print', 'print_shape', 'pshp', 'quantile', 'quartil', 'quartile', 'rand', 'randb', 'randbeta', 'randc', 'rande', 'randg', 'randgumbel', 'randchi2', 'randl', 'randln', 'randn', 'random_bernoulli', 'random_beta', 'random_cauchy', 'random_exponential', 'random_gamma', 'random_gumbel', 'random_chi2', 'random_laplace', 'random_log_normal', 'random_normal', 'random_poisson', 'random_studentt', 'random_uniform', 'random_weibull', 'randp', 'randt', 'randu', 'randw', 'range', 'relu', 'remap', 'replace', 'reshape', 'rgb_to_cielab', 'rgb_to_hsv', 'rgb_to_int', 'rgb_to_oklab', 'ridged', 'ridged_noise', 'rife', 'roll', 'round', 'rshp', 'select', 'shape', 'shuffle', 'sigm', 'sign', 'sin', 'sine', 'sine_ease', 'sinh', 'smax', 'smin', 'smootherstep', 'smoothstep', 'snorm', 'softmax', 'softmin', 'softplus', 'sort', 'split', 'sqrt', 'stack_clear', 'stack_get', 'stack_has', 'stack_pop', 'stack_push', 'std', 'step', 'substr', 'substring', 'sum', 'swap', 'tan', 'tanh', 'tensor', 'text_image', 'timestamp', 'tmax', 'tmin', 'tnorm', 'topk', 'topk_ind', 'topk_indices', 'trim', 'turbulence', 'unique', 'upper', 'var', 'voronoi', 'voronoi_noise', 'where', 'worley'
'abs', 'acos', 'acosh', 'all', 'angle', 'any', 'append', 'argmax', 'argmin', 'argsort', 'as_nested_tensor', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'band', 'batch_shuffle', 'bitcount', 'bitwise_and', 'bitwise_not', 'bitwise_or', 'bitwise_xor', 'blur', 'bnot', 'bor', 'botk', 'botk_ind', 'botk_indices', 'bxor', 'cat', 'ceil', 'cellular', 'cellular_noise', 'cielab_to_rgb', 'clamp', 'cnt', 'concat', 'concatenate', 'conv', 'convolution', 'corr', 'correlation', 'cos', 'cosh', 'cosine_similarity', 'cossim', 'count', 'cov', 'crop', 'cross', 'cubic', 'cubic_ease', 'cumprod', 'cumsum', 'diagonal_matrix', 'dilate', 'dist', 'distance', 'domain_warp', 'domain_warp_noise', 'dot', 'edge', 'elastic', 'elastic_ease', 'entropy', 'erf', 'erfinv', 'erode', 'exp', 'ezconv', 'ezconvolution', 'fft', 'find', 'flatten', 'flip', 'float', 'floor', 'flow_ang', 'flow_angle', 'flow_apply', 'flow_mag', 'flow_magnitude', 'flow_to_image', 'fract', 'gamma', 'gaussian', 'gelu', 'get_value', 'hist', 'histogram', 'hsv_to_rgb', 'ifft', 'int', 'int_to_rgb', 'interpolate_area', 'interpolate_linear', 'interpolate_nearest', 'interpolate_nearest_exact', 'join', 'length', 'lerp', 'linspace', 'ln', 'log', 'logspace', 'lower', 'map', 'matmul', 'mean', 'median', 'mode', 'moment', 'morph_close', 'morph_open', 'motion_mask', 'nan_to_num', 'noise', 'now', 'nvl', 'oklab_to_rgb', 'overlay', 'pad', 'percentile', 'perlin', 'perlin_noise', 'perm', 'permute', 'pinv', 'plasma', 'plasma_noise', 'popcnt', 'popcount', 'pow', 'prcnt', 'print', 'print_shape', 'pshp', 'quantile', 'quartil', 'quartile', 'rand', 'randb', 'randbeta', 'randc', 'rande', 'randg', 'randgumbel', 'randchi2', 'randl', 'randln', 'randn', 'random_bernoulli', 'random_beta', 'random_cauchy', 'random_exponential', 'random_gamma', 'random_gumbel', 'random_chi2', 'random_laplace', 'random_log_normal', 'random_normal', 'random_poisson', 'random_studentt', 'random_uniform', 'random_weibull', 'randp', 'randt', 'randu', 'randw', 'range', 'relu', 'remap', 'replace', 'reshape', 'rgb_to_cielab', 'rgb_to_hsv', 'rgb_to_int', 'rgb_to_oklab', 'ridged', 'ridged_noise', 'rife', 'roll', 'round', 'rshp', 'select', 'shape', 'shuffle', 'sigm', 'sign', 'sin', 'sine', 'sine_ease', 'sinh', 'smax', 'smin', 'smootherstep', 'smoothstep', 'snorm', 'softmax', 'softmin', 'softplus', 'sort', 'split', 'sqrt', 'stack_clear', 'stack_get', 'stack_has', 'stack_pop', 'stack_push', 'std', 'step', 'substr', 'substring', 'sum', 'svd', 'swap', 'tan', 'tanh', 'tensor', 'text_image', 'timestamp', 'tmax', 'tmin', 'tnorm', 'topk', 'topk_ind', 'topk_indices', 'trim', 'turbulence', 'unique', 'upper', 'var', 'voronoi', 'voronoi_noise', 'where', 'worley'
}
INBUILT_FUNCTION_META = {
@@ -20,6 +20,7 @@ INBUILT_FUNCTION_META = {
'argmax': {'min_args': 1, 'max_args': 1, 'snippet': 'argmax()', 'description': 'argmax(x) - returns the index of the maximum value in flattened x'},
'argmin': {'min_args': 1, 'max_args': 1, 'snippet': 'argmin()', 'description': 'argmin(x) - returns the index of the minimum value in flattened x'},
'argsort': {'min_args': 1, 'max_args': 2, 'snippet': 'argsort()', 'description': 'argsort(x, [desc]) - returns the indices that would sort x. defaults to ascending. Uses last dimension to sort'},
'as_nested_tensor': {'min_args': 1, 'max_args': 1, 'snippet': 'as_nested_tensor()', 'description': 'as_nested(x) - converts a list to a nested tensor (special object containing tensors of different shapes behaving like a tensor)'},
'asin': {'min_args': 1, 'max_args': 1, 'snippet': 'asin()', 'description': 'asin(x) - applies arcus sinus function to value or each element of value'},
'asinh': {'min_args': 1, 'max_args': 1, 'snippet': 'asinh()', 'description': 'asinh(x) - applies hyperbolic arcus sinus function to value or each element of value'},
'atan': {'min_args': 1, 'max_args': 1, 'snippet': 'atan()', 'description': 'atan(x) - applies arcus tangents function to value or each element of value'},
@@ -64,6 +65,7 @@ INBUILT_FUNCTION_META = {
'cubic_ease': {'min_args': 3, 'max_args': 3, 'snippet': 'cubic_ease()', 'description': 'cubic_ease(a, b, t) - cubic ease between a and b'},
'cumprod': {'min_args': 1, 'max_args': 1, 'snippet': 'cumprod()', 'description': 'cumprod(x) - computes the cumulative product over first dimension.'},
'cumsum': {'min_args': 1, 'max_args': 1, 'snippet': 'cumsum()', 'description': 'cumsum(x) - computes the cumulative sum over first dimension.'},
'diagonal_matrix': {'min_args': 4, 'max_args': 5, 'snippet': 'diagonal_matrix()', 'description': 'diagonal_matrix(x, shape, [offset], [dim1], [dim2]) - creates a diagonal matrix from x with specified shape. offset is the diagonal offset. dim1 and dim2 are the dimensions to place the diagonal on.'},
'dilate': {'min_args': 1, 'max_args': 2, 'snippet': 'dilate()', 'description': 'dilate(x, [kernel]) - applies dilation to x. kernel is optional.'},
'dist': {'min_args': 4, 'max_args': 4, 'snippet': 'dist()', 'description': 'distance(x1, y1, x2, y2) - computes Euclidean distance between (x1, y1) and (x2, y2)'},
'distance': {'min_args': 4, 'max_args': 4, 'snippet': 'distance()', 'description': 'distance(x1, y1, x2, y2) - computes Euclidean distance between (x1, y1) and (x2, y2)'},
@@ -223,6 +225,7 @@ INBUILT_FUNCTION_META = {
'substr': {'min_args': 2, 'max_args': 3, 'snippet': 'substr()', 'description': 'substring(s, start, [end]) - returns a substring of s from start to end. If end is not supplied, it uses end of string'},
'substring': {'min_args': 2, 'max_args': 3, 'snippet': 'substring()', 'description': 'substring(s, start, [end]) - returns a substring of s from start to end. If end is not supplied, it uses end of string'},
'sum': {'min_args': 1, 'max_args': 1, 'snippet': 'sum()', 'description': 'sum(x) - computes the sum of elements of x'},
'svd': {'min_args': 1, 'max_args': 1, 'snippet': 'svd()', 'description': 'svd(x) - computes the singular value decomposition of x. Returns a list of 3 tensors: U, S, V such that x = matmul(matmul(U, diagonal_matrix(S,shape(U))), V)'},
'swap': {'min_args': 4, 'max_args': 4, 'snippet': 'swap()', 'description': 'swap(x, dim, idx1, idx2) - swaps elements along dim between idx1 and idx2'},
'tan': {'min_args': 1, 'max_args': 1, 'snippet': 'tan()', 'description': 'tan(x) - applies tangents function to value or each element of value'},
'tanh': {'min_args': 1, 'max_args': 1, 'snippet': 'tanh()', 'description': 'tanh(x) - applies hyperbolic tangents function to value or each element of value'},
File diff suppressed because one or more lines are too long
+139 -133
View File
@@ -139,87 +139,90 @@ INTERPOLATE_LINEAR=138
INTERPOLATE_AREA=139
INTERPOLATE_NEAREST=140
TEXT_IMAGE=141
IF=142
ELSE=143
WHILE=144
FOR=145
IN=146
BREAK=147
CONTINUE=148
RETURN=149
TIMESTAMP=150
SORT=151
ARGSORT=152
ARGMIN=153
ARGMAX=154
SOFTMAX=155
SOFTMIN=156
UNIQUE=157
FLIP=158
ROLL=159
COV=160
CORR=161
ENTROPY=162
CROP=163
NONE=164
NOISE=165
RAND=166
CAUCHY=167
EXPONENTIAL=168
LOGNORMAL=169
BERNOULLI=170
POISSON=171
GAMMADIST=172
BETADIST=173
LAPLACEDIST=174
GUMBELDIST=175
WEIBULLDIST=176
CHI2DIST=177
STUDENTTDIST=178
PERLIN=179
CELLULAR=180
PLASMA=181
RIDGED=182
DOMAIN_WARP=183
PLUS=184
MINUS=185
MULT=186
DIV=187
MOD=188
POW=189
LSHIFT=190
RSHIFT=191
GE=192
GT=193
LE=194
LT=195
EQ=196
EQUEALS=197
PLUS_EQ=198
MINUS_EQ=199
MULT_EQ=200
DIV_EQ=201
MOD_EQ=202
NE=203
PIPE=204
LPAREN=205
RPAREN=206
COMMA=207
SEMICOLON=208
ARROW=209
LBRACKET=210
RBRACKET=211
QUESTION=212
COLON=213
LBRACE=214
RBRACE=215
NUMBER=216
CONSTANT=217
STRING=218
VARIABLE=219
SL_COMMENT=220
ML_COMMENT=221
WS=222
AS_NESTED=142
SVD=143
DIAG=144
IF=145
ELSE=146
WHILE=147
FOR=148
IN=149
BREAK=150
CONTINUE=151
RETURN=152
TIMESTAMP=153
SORT=154
ARGSORT=155
ARGMIN=156
ARGMAX=157
SOFTMAX=158
SOFTMIN=159
UNIQUE=160
FLIP=161
ROLL=162
COV=163
CORR=164
ENTROPY=165
CROP=166
NONE=167
NOISE=168
RAND=169
CAUCHY=170
EXPONENTIAL=171
LOGNORMAL=172
BERNOULLI=173
POISSON=174
GAMMADIST=175
BETADIST=176
LAPLACEDIST=177
GUMBELDIST=178
WEIBULLDIST=179
CHI2DIST=180
STUDENTTDIST=181
PERLIN=182
CELLULAR=183
PLASMA=184
RIDGED=185
DOMAIN_WARP=186
PLUS=187
MINUS=188
MULT=189
DIV=190
MOD=191
POW=192
LSHIFT=193
RSHIFT=194
GE=195
GT=196
LE=197
LT=198
EQ=199
EQUEALS=200
PLUS_EQ=201
MINUS_EQ=202
MULT_EQ=203
DIV_EQ=204
MOD_EQ=205
NE=206
PIPE=207
LPAREN=208
RPAREN=209
COMMA=210
SEMICOLON=211
ARROW=212
LBRACKET=213
RBRACKET=214
QUESTION=215
COLON=216
LBRACE=217
RBRACE=218
NUMBER=219
CONSTANT=220
STRING=221
VARIABLE=222
SL_COMMENT=223
ML_COMMENT=224
WS=225
'sin'=1
'cos'=2
'tan'=3
@@ -332,55 +335,58 @@ WS=222
'interpolate_linear'=138
'interpolate_area'=139
'text_image'=141
'if'=142
'else'=143
'while'=144
'for'=145
'in'=146
'break'=147
'continue'=148
'return'=149
'sort'=151
'argsort'=152
'argmin'=153
'argmax'=154
'softmax'=155
'softmin'=156
'unique'=157
'flip'=158
'roll'=159
'cov'=160
'entropy'=162
'crop'=163
'+'=184
'-'=185
'*'=186
'/'=187
'%'=188
'^'=189
'<<'=190
'>>'=191
'>='=192
'>'=193
'<='=194
'<'=195
'=='=196
'='=197
'+='=198
'-='=199
'*='=200
'/='=201
'%='=202
'!='=203
'|'=204
'('=205
')'=206
','=207
';'=208
'->'=209
'['=210
']'=211
'?'=212
':'=213
'{'=214
'}'=215
'as_nested_tensor'=142
'svd'=143
'diagonal_matrix'=144
'if'=145
'else'=146
'while'=147
'for'=148
'in'=149
'break'=150
'continue'=151
'return'=152
'sort'=154
'argsort'=155
'argmin'=156
'argmax'=157
'softmax'=158
'softmin'=159
'unique'=160
'flip'=161
'roll'=162
'cov'=163
'entropy'=165
'crop'=166
'+'=187
'-'=188
'*'=189
'/'=190
'%'=191
'^'=192
'<<'=193
'>>'=194
'>='=195
'>'=196
'<='=197
'<'=198
'=='=199
'='=200
'+='=201
'-='=202
'*='=203
'/='=204
'%='=205
'!='=206
'|'=207
'('=208
')'=209
','=210
';'=211
'->'=212
'['=213
']'=214
'?'=215
':'=216
'{'=217
'}'=218
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+139 -133
View File
@@ -139,87 +139,90 @@ INTERPOLATE_LINEAR=138
INTERPOLATE_AREA=139
INTERPOLATE_NEAREST=140
TEXT_IMAGE=141
IF=142
ELSE=143
WHILE=144
FOR=145
IN=146
BREAK=147
CONTINUE=148
RETURN=149
TIMESTAMP=150
SORT=151
ARGSORT=152
ARGMIN=153
ARGMAX=154
SOFTMAX=155
SOFTMIN=156
UNIQUE=157
FLIP=158
ROLL=159
COV=160
CORR=161
ENTROPY=162
CROP=163
NONE=164
NOISE=165
RAND=166
CAUCHY=167
EXPONENTIAL=168
LOGNORMAL=169
BERNOULLI=170
POISSON=171
GAMMADIST=172
BETADIST=173
LAPLACEDIST=174
GUMBELDIST=175
WEIBULLDIST=176
CHI2DIST=177
STUDENTTDIST=178
PERLIN=179
CELLULAR=180
PLASMA=181
RIDGED=182
DOMAIN_WARP=183
PLUS=184
MINUS=185
MULT=186
DIV=187
MOD=188
POW=189
LSHIFT=190
RSHIFT=191
GE=192
GT=193
LE=194
LT=195
EQ=196
EQUEALS=197
PLUS_EQ=198
MINUS_EQ=199
MULT_EQ=200
DIV_EQ=201
MOD_EQ=202
NE=203
PIPE=204
LPAREN=205
RPAREN=206
COMMA=207
SEMICOLON=208
ARROW=209
LBRACKET=210
RBRACKET=211
QUESTION=212
COLON=213
LBRACE=214
RBRACE=215
NUMBER=216
CONSTANT=217
STRING=218
VARIABLE=219
SL_COMMENT=220
ML_COMMENT=221
WS=222
AS_NESTED=142
SVD=143
DIAG=144
IF=145
ELSE=146
WHILE=147
FOR=148
IN=149
BREAK=150
CONTINUE=151
RETURN=152
TIMESTAMP=153
SORT=154
ARGSORT=155
ARGMIN=156
ARGMAX=157
SOFTMAX=158
SOFTMIN=159
UNIQUE=160
FLIP=161
ROLL=162
COV=163
CORR=164
ENTROPY=165
CROP=166
NONE=167
NOISE=168
RAND=169
CAUCHY=170
EXPONENTIAL=171
LOGNORMAL=172
BERNOULLI=173
POISSON=174
GAMMADIST=175
BETADIST=176
LAPLACEDIST=177
GUMBELDIST=178
WEIBULLDIST=179
CHI2DIST=180
STUDENTTDIST=181
PERLIN=182
CELLULAR=183
PLASMA=184
RIDGED=185
DOMAIN_WARP=186
PLUS=187
MINUS=188
MULT=189
DIV=190
MOD=191
POW=192
LSHIFT=193
RSHIFT=194
GE=195
GT=196
LE=197
LT=198
EQ=199
EQUEALS=200
PLUS_EQ=201
MINUS_EQ=202
MULT_EQ=203
DIV_EQ=204
MOD_EQ=205
NE=206
PIPE=207
LPAREN=208
RPAREN=209
COMMA=210
SEMICOLON=211
ARROW=212
LBRACKET=213
RBRACKET=214
QUESTION=215
COLON=216
LBRACE=217
RBRACE=218
NUMBER=219
CONSTANT=220
STRING=221
VARIABLE=222
SL_COMMENT=223
ML_COMMENT=224
WS=225
'sin'=1
'cos'=2
'tan'=3
@@ -332,55 +335,58 @@ WS=222
'interpolate_linear'=138
'interpolate_area'=139
'text_image'=141
'if'=142
'else'=143
'while'=144
'for'=145
'in'=146
'break'=147
'continue'=148
'return'=149
'sort'=151
'argsort'=152
'argmin'=153
'argmax'=154
'softmax'=155
'softmin'=156
'unique'=157
'flip'=158
'roll'=159
'cov'=160
'entropy'=162
'crop'=163
'+'=184
'-'=185
'*'=186
'/'=187
'%'=188
'^'=189
'<<'=190
'>>'=191
'>='=192
'>'=193
'<='=194
'<'=195
'=='=196
'='=197
'+='=198
'-='=199
'*='=200
'/='=201
'%='=202
'!='=203
'|'=204
'('=205
')'=206
','=207
';'=208
'->'=209
'['=210
']'=211
'?'=212
':'=213
'{'=214
'}'=215
'as_nested_tensor'=142
'svd'=143
'diagonal_matrix'=144
'if'=145
'else'=146
'while'=147
'for'=148
'in'=149
'break'=150
'continue'=151
'return'=152
'sort'=154
'argsort'=155
'argmin'=156
'argmax'=157
'softmax'=158
'softmin'=159
'unique'=160
'flip'=161
'roll'=162
'cov'=163
'entropy'=165
'crop'=166
'+'=187
'-'=188
'*'=189
'/'=190
'%'=191
'^'=192
'<<'=193
'>>'=194
'>='=195
'>'=196
'<='=197
'<'=198
'=='=199
'='=200
'+='=201
'-='=202
'*='=203
'/='=204
'%='=205
'!='=206
'|'=207
'('=208
')'=209
','=210
';'=211
'->'=212
'['=213
']'=214
'?'=215
':'=216
'{'=217
'}'=218
@@ -1304,6 +1304,24 @@ class MathExprListener(ParseTreeListener):
pass
# Enter a parse tree produced by MathExprParser#AsNestedFunc.
def enterAsNestedFunc(self, ctx:MathExprParser.AsNestedFuncContext):
pass
# Exit a parse tree produced by MathExprParser#AsNestedFunc.
def exitAsNestedFunc(self, ctx:MathExprParser.AsNestedFuncContext):
pass
# Enter a parse tree produced by MathExprParser#SvdFunc.
def enterSvdFunc(self, ctx:MathExprParser.SvdFuncContext):
pass
# Exit a parse tree produced by MathExprParser#SvdFunc.
def exitSvdFunc(self, ctx:MathExprParser.SvdFuncContext):
pass
# Enter a parse tree produced by MathExprParser#PowFunc.
def enterPowFunc(self, ctx:MathExprParser.PowFuncContext):
pass
@@ -1943,6 +1961,15 @@ class MathExprListener(ParseTreeListener):
pass
# Enter a parse tree produced by MathExprParser#DiagonalMatrixFunc.
def enterDiagonalMatrixFunc(self, ctx:MathExprParser.DiagonalMatrixFuncContext):
pass
# Exit a parse tree produced by MathExprParser#DiagonalMatrixFunc.
def exitDiagonalMatrixFunc(self, ctx:MathExprParser.DiagonalMatrixFuncContext):
pass
# Enter a parse tree produced by MathExprParser#SMinFunc.
def enterSMinFunc(self, ctx:MathExprParser.SMinFuncContext):
pass
File diff suppressed because one or more lines are too long
@@ -729,6 +729,16 @@ class MathExprVisitor(ParseTreeVisitor):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#AsNestedFunc.
def visitAsNestedFunc(self, ctx:MathExprParser.AsNestedFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#SvdFunc.
def visitSvdFunc(self, ctx:MathExprParser.SvdFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#PowFunc.
def visitPowFunc(self, ctx:MathExprParser.PowFuncContext):
return self.visitChildren(ctx)
@@ -1084,6 +1094,11 @@ class MathExprVisitor(ParseTreeVisitor):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#DiagonalMatrixFunc.
def visitDiagonalMatrixFunc(self, ctx:MathExprParser.DiagonalMatrixFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#SMinFunc.
def visitSMinFunc(self, ctx:MathExprParser.SMinFuncContext):
return self.visitChildren(ctx)
+4 -1
View File
@@ -9,7 +9,7 @@ export const CONSTANTS = new Set([
]);
export const FUNCTIONS = new Set([
"abs", "acos", "acosh", "all", "angle", "any", "append", "argmax", "argmin", "argsort", "asin", "asinh", "atan", "atan2", "atanh", "band", "batch_shuffle", "bitcount", "bitwise_and", "bitwise_not", "bitwise_or", "bitwise_xor", "blur", "bnot", "bor", "botk", "botk_ind", "botk_indices", "bxor", "cat", "ceil", "cellular", "cellular_noise", "cielab_to_rgb", "clamp", "cnt", "concat", "concatenate", "conv", "convolution", "corr", "correlation", "cos", "cosh", "cosine_similarity", "cossim", "count", "cov", "crop", "cross", "cubic", "cubic_ease", "cumprod", "cumsum", "dilate", "dist", "distance", "domain_warp", "domain_warp_noise", "dot", "edge", "elastic", "elastic_ease", "entropy", "erf", "erfinv", "erode", "exp", "ezconv", "ezconvolution", "fft", "find", "flatten", "flip", "float", "floor", "flow_ang", "flow_angle", "flow_apply", "flow_mag", "flow_magnitude", "flow_to_image", "fract", "gamma", "gaussian", "gelu", "get_value", "hist", "histogram", "hsv_to_rgb", "ifft", "int", "int_to_rgb", "interpolate_area", "interpolate_linear", "interpolate_nearest", "interpolate_nearest_exact", "join", "length", "lerp", "linspace", "ln", "log", "logspace", "lower", "map", "matmul", "mean", "median", "mode", "moment", "morph_close", "morph_open", "motion_mask", "nan_to_num", "noise", "now", "nvl", "oklab_to_rgb", "overlay", "pad", "percentile", "perlin", "perlin_noise", "perm", "permute", "pinv", "plasma", "plasma_noise", "popcnt", "popcount", "pow", "prcnt", "print", "print_shape", "pshp", "quantile", "quartil", "quartile", "rand", "randb", "randbeta", "randc", "rande", "randg", "randgumbel", "randchi2", "randl", "randln", "randn", "random_bernoulli", "random_beta", "random_cauchy", "random_exponential", "random_gamma", "random_gumbel", "random_chi2", "random_laplace", "random_log_normal", "random_normal", "random_poisson", "random_studentt", "random_uniform", "random_weibull", "randp", "randt", "randu", "randw", "range", "relu", "remap", "replace", "reshape", "rgb_to_cielab", "rgb_to_hsv", "rgb_to_int", "rgb_to_oklab", "ridged", "ridged_noise", "rife", "roll", "round", "rshp", "select", "shape", "shuffle", "sigm", "sign", "sin", "sine", "sine_ease", "sinh", "smax", "smin", "smootherstep", "smoothstep", "snorm", "softmax", "softmin", "softplus", "sort", "split", "sqrt", "stack_clear", "stack_get", "stack_has", "stack_pop", "stack_push", "std", "step", "substr", "substring", "sum", "swap", "tan", "tanh", "tensor", "text_image", "timestamp", "tmax", "tmin", "tnorm", "topk", "topk_ind", "topk_indices", "trim", "turbulence", "unique", "upper", "var", "voronoi", "voronoi_noise", "where", "worley"
"abs", "acos", "acosh", "all", "angle", "any", "append", "argmax", "argmin", "argsort", "as_nested_tensor", "asin", "asinh", "atan", "atan2", "atanh", "band", "batch_shuffle", "bitcount", "bitwise_and", "bitwise_not", "bitwise_or", "bitwise_xor", "blur", "bnot", "bor", "botk", "botk_ind", "botk_indices", "bxor", "cat", "ceil", "cellular", "cellular_noise", "cielab_to_rgb", "clamp", "cnt", "concat", "concatenate", "conv", "convolution", "corr", "correlation", "cos", "cosh", "cosine_similarity", "cossim", "count", "cov", "crop", "cross", "cubic", "cubic_ease", "cumprod", "cumsum", "diagonal_matrix", "dilate", "dist", "distance", "domain_warp", "domain_warp_noise", "dot", "edge", "elastic", "elastic_ease", "entropy", "erf", "erfinv", "erode", "exp", "ezconv", "ezconvolution", "fft", "find", "flatten", "flip", "float", "floor", "flow_ang", "flow_angle", "flow_apply", "flow_mag", "flow_magnitude", "flow_to_image", "fract", "gamma", "gaussian", "gelu", "get_value", "hist", "histogram", "hsv_to_rgb", "ifft", "int", "int_to_rgb", "interpolate_area", "interpolate_linear", "interpolate_nearest", "interpolate_nearest_exact", "join", "length", "lerp", "linspace", "ln", "log", "logspace", "lower", "map", "matmul", "mean", "median", "mode", "moment", "morph_close", "morph_open", "motion_mask", "nan_to_num", "noise", "now", "nvl", "oklab_to_rgb", "overlay", "pad", "percentile", "perlin", "perlin_noise", "perm", "permute", "pinv", "plasma", "plasma_noise", "popcnt", "popcount", "pow", "prcnt", "print", "print_shape", "pshp", "quantile", "quartil", "quartile", "rand", "randb", "randbeta", "randc", "rande", "randg", "randgumbel", "randchi2", "randl", "randln", "randn", "random_bernoulli", "random_beta", "random_cauchy", "random_exponential", "random_gamma", "random_gumbel", "random_chi2", "random_laplace", "random_log_normal", "random_normal", "random_poisson", "random_studentt", "random_uniform", "random_weibull", "randp", "randt", "randu", "randw", "range", "relu", "remap", "replace", "reshape", "rgb_to_cielab", "rgb_to_hsv", "rgb_to_int", "rgb_to_oklab", "ridged", "ridged_noise", "rife", "roll", "round", "rshp", "select", "shape", "shuffle", "sigm", "sign", "sin", "sine", "sine_ease", "sinh", "smax", "smin", "smootherstep", "smoothstep", "snorm", "softmax", "softmin", "softplus", "sort", "split", "sqrt", "stack_clear", "stack_get", "stack_has", "stack_pop", "stack_push", "std", "step", "substr", "substring", "sum", "svd", "swap", "tan", "tanh", "tensor", "text_image", "timestamp", "tmax", "tmin", "tnorm", "topk", "topk_ind", "topk_indices", "trim", "turbulence", "unique", "upper", "var", "voronoi", "voronoi_noise", "where", "worley"
]);
export const FUNCTION_META = {
@@ -23,6 +23,7 @@ export const FUNCTION_META = {
argmax: { minArgs: 1, maxArgs: 1, snippet: "argmax()", description: "argmax(x) - returns the index of the maximum value in flattened x" },
argmin: { minArgs: 1, maxArgs: 1, snippet: "argmin()", description: "argmin(x) - returns the index of the minimum value in flattened x" },
argsort: { minArgs: 1, maxArgs: 2, snippet: "argsort()", description: "argsort(x, [desc]) - returns the indices that would sort x. defaults to ascending. Uses last dimension to sort" },
as_nested_tensor: { minArgs: 1, maxArgs: 1, snippet: "as_nested_tensor()", description: "as_nested(x) - converts a list to a nested tensor (special object containing tensors of different shapes behaving like a tensor)" },
asin: { minArgs: 1, maxArgs: 1, snippet: "asin()", description: "asin(x) - applies arcus sinus function to value or each element of value" },
asinh: { minArgs: 1, maxArgs: 1, snippet: "asinh()", description: "asinh(x) - applies hyperbolic arcus sinus function to value or each element of value" },
atan: { minArgs: 1, maxArgs: 1, snippet: "atan()", description: "atan(x) - applies arcus tangents function to value or each element of value" },
@@ -67,6 +68,7 @@ export const FUNCTION_META = {
cubic_ease: { minArgs: 3, maxArgs: 3, snippet: "cubic_ease()", description: "cubic_ease(a, b, t) - cubic ease between a and b" },
cumprod: { minArgs: 1, maxArgs: 1, snippet: "cumprod()", description: "cumprod(x) - computes the cumulative product over first dimension." },
cumsum: { minArgs: 1, maxArgs: 1, snippet: "cumsum()", description: "cumsum(x) - computes the cumulative sum over first dimension." },
diagonal_matrix: { minArgs: 4, maxArgs: 5, snippet: "diagonal_matrix()", description: "diagonal_matrix(x, shape, [offset], [dim1], [dim2]) - creates a diagonal matrix from x with specified shape. offset is the diagonal offset. dim1 and dim2 are the dimensions to place the diagonal on." },
dilate: { minArgs: 1, maxArgs: 2, snippet: "dilate()", description: "dilate(x, [kernel]) - applies dilation to x. kernel is optional." },
dist: { minArgs: 4, maxArgs: 4, snippet: "dist()", description: "distance(x1, y1, x2, y2) - computes Euclidean distance between (x1, y1) and (x2, y2)" },
distance: { minArgs: 4, maxArgs: 4, snippet: "distance()", description: "distance(x1, y1, x2, y2) - computes Euclidean distance between (x1, y1) and (x2, y2)" },
@@ -226,6 +228,7 @@ export const FUNCTION_META = {
substr: { minArgs: 2, maxArgs: 3, snippet: "substr()", description: "substring(s, start, [end]) - returns a substring of s from start to end. If end is not supplied, it uses end of string" },
substring: { minArgs: 2, maxArgs: 3, snippet: "substring()", description: "substring(s, start, [end]) - returns a substring of s from start to end. If end is not supplied, it uses end of string" },
sum: { minArgs: 1, maxArgs: 1, snippet: "sum()", description: "sum(x) - computes the sum of elements of x" },
svd: { minArgs: 1, maxArgs: 1, snippet: "svd()", description: "svd(x) - computes the singular value decomposition of x. Returns a list of 3 tensors: U, S, V such that x = matmul(matmul(U, diagonal_matrix(S,shape(U))), V)" },
swap: { minArgs: 4, maxArgs: 4, snippet: "swap()", description: "swap(x, dim, idx1, idx2) - swaps elements along dim between idx1 and idx2" },
tan: { minArgs: 1, maxArgs: 1, snippet: "tan()", description: "tan(x) - applies tangents function to value or each element of value" },
tanh: { minArgs: 1, maxArgs: 1, snippet: "tanh()", description: "tanh(x) - applies hyperbolic tangents function to value or each element of value" },