ai: erfc,sinc

This commit is contained in:
mcDandy
2026-10-14 16:14:27 +02:00
parent 28fe274826
commit b47e2e90cc
22 changed files with 13460 additions and 13090 deletions
+3 -1
View File
@@ -110,6 +110,7 @@ You can also get the node from comfy manager under the name of More math.
- `log1p(x)`: numerically stable `ln(1 + x)`.
- `expm1(x)`: numerically stable `exp(x) - 1`.
- `logaddexp(x, y)`: numerically stable `ln(exp(x) + exp(y))`, element-wise.
- `sinc(x)`: normalized sinc, `sin(πx)/(πx)`; returns `1` at zero.
- `cbrt(x)`: real cube root, including for negative values.
- `reciprocal(x)`: element-wise `1 / x`.
- `isnan(x)`: per-element NaN test.
@@ -159,6 +160,7 @@ You can also get the node from comfy manager under the name of More math.
- `softmax(x, [dim])`: softmax normalization.
- `softmin(x, [dim])`: softmin normalization.
- `erf(x)`: error function.
- `erfc(x)`: complementary error function, `1 - erf(x)`, evaluated directly for better tail accuracy.
- `erfinv(x)`: inverse error function.
- `group_norm(x, groups, [weight], [bias], [eps])`: PyTorch GroupNorm for channel-first tensors shaped `[N, C, ...]`; `groups` must divide `C`, affine parameters are optional vectors of length `C`, and `eps` defaults to `1e-5`.
@@ -169,7 +171,7 @@ You can also get the node from comfy manager under the name of More math.
#### 1.6 Interpolation & Remap
- `lerp(a, b, t)`: linear interpolation.
- `slerp(a, b, t, [dim])`: spherical interpolation of vector directions with linearly interpolated magnitudes. `dim` selects the axis containing each vector's components; all other axes identify independent vectors. It defaults to the last axis (for `[batch, features]`, use `dim=1`), and `t` may be scalar or broadcast over the other axes.
- `slerp(a, b, t, [dim])`: spherical interpolation of vector directions with linearly interpolated magnitudes. Without `dim`, all elements form one vector. Set `dim` to select an axis of vector components; all other axes identify independent vectors, and `t` may be scalar or broadcast over those axes.
- `smoothstep(x, e0, e1)`: 3rd-order smooth transition.
- `smootherstep(x, e0, e1)`: 5th-order smoother transition.
- `cubic_ease(a, b, t)` / `cubic`: cubic easing interpolation.
+11 -1
View File
@@ -217,6 +217,10 @@ func1:
expm1(x) - applies exp(x)-1 accurately for values near zero
*/
| EXPM1 LPAREN expr RPAREN # Expm1Func
/**
sinc(x) - computes the normalized sinc function sin(pi*x)/(pi*x), with sinc(0)=1
*/
| SINC LPAREN expr RPAREN # SincFunc
/**
cbrt(x) - computes the real cube root of each value, including negative values
*/
@@ -441,6 +445,10 @@ func1:
erf(x) - computes the error function (torch.erf)
*/
| ERF LPAREN expr RPAREN # ErfFunc
/**
erfc(x) - computes the complementary error function (torch.special.erfc)
*/
| ERFC LPAREN expr RPAREN # ErfcFunc
/**
erfinv(x) - computes the inverse error function (torch.erfinv)
*/
@@ -973,7 +981,7 @@ funcN:
*/
NORM LPAREN expr (COMMA expr (COMMA expr)?)? RPAREN # NormFunc
/**
slerp(a, b, t, [dim]) - interpolates vector directions spherically and magnitudes linearly. dim selects the vector-component axis; other axes identify independent vectors. Defaults to the last dimension.
slerp(a, b, t, [dim]) - interpolates vector directions spherically and magnitudes linearly. Without dim, all elements form one vector; dim selects a vector-component axis and other axes identify independent vectors.
*/
| SLERP LPAREN expr COMMA expr COMMA expr (COMMA expr)? RPAREN # SlerpFunc
/**
@@ -1154,6 +1162,7 @@ LOG2: 'log2';
EXP: 'exp';
LOG1P: 'log1p';
EXPM1: 'expm1';
SINC: 'sinc';
CBRT: 'cbrt';
RECIPROCAL: 'reciprocal';
LOGADDEXP: 'logaddexp';
@@ -1233,6 +1242,7 @@ QUANTILE: 'quantile';
DOT: 'dot';
MOMENT: 'moment';
ERF: 'erf';
ERFC: 'erfc';
ERFINV: 'erfinv';
ANY: 'any';
+19 -2
View File
@@ -1048,6 +1048,12 @@ class UnifiedMathVisitor(MathExprVisitor):
def visitExpm1Func(self, ctx):
return self._unary_op((yield ctx.expr()), torch.expm1, math.expm1)
def visitSincFunc(self, ctx):
def scalar_sinc(x):
return 1.0 if x == 0 else math.sin(math.pi * x) / (math.pi * x)
return self._unary_op((yield ctx.expr()), torch.sinc, scalar_sinc)
def visitCbrtFunc(self, ctx):
return self._unary_op((yield ctx.expr()), lambda x: torch.sign(x) * torch.abs(x).pow(1.0 / 3.0), lambda x: math.copysign(abs(x) ** (1.0 / 3.0), x))
@@ -1577,8 +1583,13 @@ class UnifiedMathVisitor(MathExprVisitor):
except RuntimeError as exc:
raise ValueError(f"{ctx.start.line}:{ctx.start.column}: slerp inputs must be broadcastable") from exc
dim = -1
if len(ctx.expr()) > 3:
default_dim = len(ctx.expr()) <= 3
if default_dim:
output_shape = a.shape
a = a.reshape(-1)
b = b.reshape(-1)
dim = 0
else:
dims = self._normalize_dims((yield ctx.expr(3)), a.ndim, ctx, "slerp dimension")
if len(dims) != 1:
raise ValueError(f"{ctx.start.line}:{ctx.start.column}: slerp expects one vector dimension")
@@ -1632,6 +1643,8 @@ class UnifiedMathVisitor(MathExprVisitor):
direction = torch.where(regular, spherical, fallback_direction)
magnitude = (1.0 - t) * norm_a + t * norm_b
result = (direction * magnitude).movedim(-1, dim)
if default_dim:
result = result.reshape(output_shape)
return result.to(dtype=output_dtype).contiguous()
def _lerp_helper(self, a, b, w):
@@ -5674,6 +5687,10 @@ class UnifiedMathVisitor(MathExprVisitor):
x = self._promote_to_tensor((yield ctx.expr()))
return torch.erf(x)
def visitErfcFunc(self, ctx):
"""erfc(x) - complementary error function"""
return self._unary_op((yield ctx.expr()), torch.special.erfc, math.erfc)
def visitErfinvFunc(self, ctx):
"""erfinv(x) - inverse error function"""
x = self._promote_to_tensor((yield ctx.expr()))
File diff suppressed because one or more lines are too long
+475 -471
View File
@@ -19,278 +19,280 @@ LOG2=18
EXP=19
LOG1P=20
EXPM1=21
CBRT=22
RECIPROCAL=23
LOGADDEXP=24
LOGSUMEXP=25
NORM=26
NORMALIZE=27
GROUP_NORM=28
OUTER=29
TRACE=30
DET=31
RFFT=32
IRFFT=33
ISNAN=34
ISINF=35
ISFINITE=36
SMIN=37
SMAX=38
TMIN=39
TMAX=40
TNORM=41
SNORM=42
FLOOR=43
CEIL=44
ROUND=45
GAMMA=46
POWE=47
SIGM=48
CLAMP=49
SFFT=50
SIFFT=51
ANGL=52
PRNT=53
PRINT_SHAPE=54
NVL=55
LERP=56
SLERP=57
STEP=58
SMOOTHSTEP=59
FRACT=60
RELU=61
SOFTSIGN=62
LEAKY_RELU=63
SOFTPLUS=64
GELU=65
SILU=66
SIGN=67
DEGREES=68
RADIANS=69
LOGICAL_NOT=70
LOGICAL_AND=71
LOGICAL_OR=72
HYPOT=73
MAP=74
EZCONV=75
CONV=76
SWAP=77
TRANSPOSE=78
PERM=79
RESHAPE=80
RANGE=81
LINSPACE=82
LOGSPACE=83
TOPK=84
BOTK=85
PINV=86
INV=87
SUM=88
MEAN=89
STD=90
VAR=91
PROD=92
ISCLOSE=93
ALLCLOSE=94
QUARTILE=95
PERCENTILE=96
QUANTILE=97
DOT=98
MOMENT=99
ERF=100
ERFINV=101
ANY=102
ALL=103
EDGE=104
GAUSSIAN=105
MEDIAN=106
MODE=107
CUMSUM=108
CUMPROD=109
TOPK_IND=110
BOTK_IND=111
CUBIC_EASE=112
ELASTIC_EASE=113
SINE_EASE=114
SMOOTHERSTEP=115
DIST=116
REMAP=117
COSSIM=118
COUNT=119
KEYS=120
ENABLE_TRACKING=121
DISABLE_TRACKING=122
RESET_TRACKING=123
GET_CHANGED_KEYS=124
GET_ADDED_KEYS=125
GET_REMOVED_KEYS=126
GET_UNCHANGED_KEYS=127
REPEAT=128
FLATTEN=129
APPEND=130
GET_VALUE=131
FLOW_APPLY=132
BATCH_SHUFFLE=133
MOTION_MASK=134
FLOW_TO_IMAGE=135
FLOW_MAG=136
FLOW_ANG=137
WHERE=138
HISTOGRAM=139
OVERLAY=140
PAD=141
CROSS=142
MATMUL=143
SOLVE=144
MATRIX_RANK=145
RIFE=146
BNOT=147
BITCOUNT=148
SHAPE=149
BAND=150
XOR=151
BOR=152
TENSOR=153
ZEROS=154
ONES=155
EYE=156
ONE_HOT=157
MSE=158
MAE=159
PSNR=160
WEIGHTED_MEAN=161
HUBER_LOSS=162
CROSS_ENTROPY=163
ADD_KEY=164
REMOVE_KEY=165
PUSH=166
POP=167
CLEAR=168
HAS=169
GET=170
CONCAT=171
STACK=172
NONZERO=173
INT=174
FLOAT=175
UPPER=176
LOWER=177
TRIM=178
SPLIT=179
JOIN=180
SUBSTRING=181
FIND=182
REPLACE=183
DILATE=184
ERODE=185
MORPH_OPEN=186
MORPH_CLOSE=187
RGB_TO_OKLAB=188
RGB_TO_CIELAB=189
OKLAB_TO_RGB=190
CIELAB_TO_RGB=191
RGB_TO_HSV=192
HSV_TO_RGB=193
INT_TO_RGB=194
RGB_TO_INT=195
INTERPOLATE_LINEAR=196
INTERPOLATE_AREA=197
INTERPOLATE_NEAREST=198
TEXT_IMAGE=199
AS_NESTED=200
SVD=201
DIAG=202
IF=203
ELSE=204
WHILE=205
FOR=206
IN=207
BREAK=208
CONTINUE=209
RETURN=210
TIMESTAMP=211
SORT=212
ARGSORT=213
ARGMIN=214
ARGMAX=215
SOFTMAX=216
SOFTMIN=217
UNIQUE=218
FLIP=219
STARTSWITH=220
ENDSWITH=221
SQUEEZE=222
UNSQUEEZE=223
ROLL=224
COV=225
CORR=226
ENTROPY=227
CROP=228
NONE=229
COORDS=230
GATHER=231
SCATTER=232
SCATTER_ADD=233
NOISE=234
PINK_NOISE=235
BROWN_NOISE=236
RAND=237
CAUCHY=238
EXPONENTIAL=239
LOGNORMAL=240
BERNOULLI=241
POISSON=242
GAMMADIST=243
BETADIST=244
LAPLACEDIST=245
GUMBELDIST=246
WEIBULLDIST=247
CHI2DIST=248
STUDENTTDIST=249
PERLIN=250
CELLULAR=251
PLASMA=252
RIDGED=253
DOMAIN_WARP=254
PLUS=255
MINUS=256
MULT=257
DIV=258
MOD=259
POW=260
LSHIFT=261
RSHIFT=262
GE=263
GT=264
LE=265
LT=266
EQ=267
EQUEALS=268
PLUS_EQ=269
MINUS_EQ=270
MULT_EQ=271
DIV_EQ=272
MOD_EQ=273
NE=274
PIPE=275
LPAREN=276
RPAREN=277
COMMA=278
SEMICOLON=279
ARROW=280
LBRACKET=281
RBRACKET=282
QUESTION=283
COLON=284
LBRACE=285
RBRACE=286
NUMBER=287
CONSTANT=288
STRING=289
VARIABLE=290
SL_COMMENT=291
ML_COMMENT=292
WS=293
SINC=22
CBRT=23
RECIPROCAL=24
LOGADDEXP=25
LOGSUMEXP=26
NORM=27
NORMALIZE=28
GROUP_NORM=29
OUTER=30
TRACE=31
DET=32
RFFT=33
IRFFT=34
ISNAN=35
ISINF=36
ISFINITE=37
SMIN=38
SMAX=39
TMIN=40
TMAX=41
TNORM=42
SNORM=43
FLOOR=44
CEIL=45
ROUND=46
GAMMA=47
POWE=48
SIGM=49
CLAMP=50
SFFT=51
SIFFT=52
ANGL=53
PRNT=54
PRINT_SHAPE=55
NVL=56
LERP=57
SLERP=58
STEP=59
SMOOTHSTEP=60
FRACT=61
RELU=62
SOFTSIGN=63
LEAKY_RELU=64
SOFTPLUS=65
GELU=66
SILU=67
SIGN=68
DEGREES=69
RADIANS=70
LOGICAL_NOT=71
LOGICAL_AND=72
LOGICAL_OR=73
HYPOT=74
MAP=75
EZCONV=76
CONV=77
SWAP=78
TRANSPOSE=79
PERM=80
RESHAPE=81
RANGE=82
LINSPACE=83
LOGSPACE=84
TOPK=85
BOTK=86
PINV=87
INV=88
SUM=89
MEAN=90
STD=91
VAR=92
PROD=93
ISCLOSE=94
ALLCLOSE=95
QUARTILE=96
PERCENTILE=97
QUANTILE=98
DOT=99
MOMENT=100
ERF=101
ERFC=102
ERFINV=103
ANY=104
ALL=105
EDGE=106
GAUSSIAN=107
MEDIAN=108
MODE=109
CUMSUM=110
CUMPROD=111
TOPK_IND=112
BOTK_IND=113
CUBIC_EASE=114
ELASTIC_EASE=115
SINE_EASE=116
SMOOTHERSTEP=117
DIST=118
REMAP=119
COSSIM=120
COUNT=121
KEYS=122
ENABLE_TRACKING=123
DISABLE_TRACKING=124
RESET_TRACKING=125
GET_CHANGED_KEYS=126
GET_ADDED_KEYS=127
GET_REMOVED_KEYS=128
GET_UNCHANGED_KEYS=129
REPEAT=130
FLATTEN=131
APPEND=132
GET_VALUE=133
FLOW_APPLY=134
BATCH_SHUFFLE=135
MOTION_MASK=136
FLOW_TO_IMAGE=137
FLOW_MAG=138
FLOW_ANG=139
WHERE=140
HISTOGRAM=141
OVERLAY=142
PAD=143
CROSS=144
MATMUL=145
SOLVE=146
MATRIX_RANK=147
RIFE=148
BNOT=149
BITCOUNT=150
SHAPE=151
BAND=152
XOR=153
BOR=154
TENSOR=155
ZEROS=156
ONES=157
EYE=158
ONE_HOT=159
MSE=160
MAE=161
PSNR=162
WEIGHTED_MEAN=163
HUBER_LOSS=164
CROSS_ENTROPY=165
ADD_KEY=166
REMOVE_KEY=167
PUSH=168
POP=169
CLEAR=170
HAS=171
GET=172
CONCAT=173
STACK=174
NONZERO=175
INT=176
FLOAT=177
UPPER=178
LOWER=179
TRIM=180
SPLIT=181
JOIN=182
SUBSTRING=183
FIND=184
REPLACE=185
DILATE=186
ERODE=187
MORPH_OPEN=188
MORPH_CLOSE=189
RGB_TO_OKLAB=190
RGB_TO_CIELAB=191
OKLAB_TO_RGB=192
CIELAB_TO_RGB=193
RGB_TO_HSV=194
HSV_TO_RGB=195
INT_TO_RGB=196
RGB_TO_INT=197
INTERPOLATE_LINEAR=198
INTERPOLATE_AREA=199
INTERPOLATE_NEAREST=200
TEXT_IMAGE=201
AS_NESTED=202
SVD=203
DIAG=204
IF=205
ELSE=206
WHILE=207
FOR=208
IN=209
BREAK=210
CONTINUE=211
RETURN=212
TIMESTAMP=213
SORT=214
ARGSORT=215
ARGMIN=216
ARGMAX=217
SOFTMAX=218
SOFTMIN=219
UNIQUE=220
FLIP=221
STARTSWITH=222
ENDSWITH=223
SQUEEZE=224
UNSQUEEZE=225
ROLL=226
COV=227
CORR=228
ENTROPY=229
CROP=230
NONE=231
COORDS=232
GATHER=233
SCATTER=234
SCATTER_ADD=235
NOISE=236
PINK_NOISE=237
BROWN_NOISE=238
RAND=239
CAUCHY=240
EXPONENTIAL=241
LOGNORMAL=242
BERNOULLI=243
POISSON=244
GAMMADIST=245
BETADIST=246
LAPLACEDIST=247
GUMBELDIST=248
WEIBULLDIST=249
CHI2DIST=250
STUDENTTDIST=251
PERLIN=252
CELLULAR=253
PLASMA=254
RIDGED=255
DOMAIN_WARP=256
PLUS=257
MINUS=258
MULT=259
DIV=260
MOD=261
POW=262
LSHIFT=263
RSHIFT=264
GE=265
GT=266
LE=267
LT=268
EQ=269
EQUEALS=270
PLUS_EQ=271
MINUS_EQ=272
MULT_EQ=273
DIV_EQ=274
MOD_EQ=275
NE=276
PIPE=277
LPAREN=278
RPAREN=279
COMMA=280
SEMICOLON=281
ARROW=282
LBRACKET=283
RBRACKET=284
QUESTION=285
COLON=286
LBRACE=287
RBRACE=288
NUMBER=289
CONSTANT=290
STRING=291
VARIABLE=292
SL_COMMENT=293
ML_COMMENT=294
WS=295
'sin'=1
'cos'=2
'tan'=3
@@ -312,202 +314,204 @@ WS=293
'exp'=19
'log1p'=20
'expm1'=21
'cbrt'=22
'reciprocal'=23
'logaddexp'=24
'logsumexp'=25
'norm'=26
'normalize'=27
'group_norm'=28
'outer'=29
'trace'=30
'det'=31
'rfft'=32
'irfft'=33
'isnan'=34
'isinf'=35
'isfinite'=36
'smin'=37
'smax'=38
'tmin'=39
'tmax'=40
'tnorm'=41
'snorm'=42
'floor'=43
'ceil'=44
'round'=45
'gamma'=46
'pow'=47
'sigm'=48
'clamp'=49
'fft'=50
'ifft'=51
'angle'=52
'print'=53
'lerp'=56
'slerp'=57
'step'=58
'smoothstep'=59
'fract'=60
'relu'=61
'softsign'=62
'leaky_relu'=63
'softplus'=64
'gelu'=65
'silu'=66
'sign'=67
'degrees'=68
'radians'=69
'logical_not'=70
'logical_and'=71
'logical_or'=72
'hypot'=73
'map'=74
'swap'=77
'range'=81
'linspace'=82
'logspace'=83
'topk'=84
'botk'=85
'pinv'=86
'inv'=87
'sum'=88
'mean'=89
'std'=90
'var'=91
'prod'=92
'isclose'=93
'allclose'=94
'quantile'=97
'dot'=98
'moment'=99
'erf'=100
'erfinv'=101
'any'=102
'all'=103
'edge'=104
'median'=106
'mode'=107
'cumsum'=108
'cumprod'=109
'smootherstep'=115
'remap'=117
'keys'=120
'repeat'=128
'flatten'=129
'append'=130
'get_value'=131
'flow_apply'=132
'motion_mask'=134
'flow_to_image'=135
'where'=138
'overlay'=140
'pad'=141
'cross'=142
'matmul'=143
'solve'=144
'matrix_rank'=145
'rife'=146
'shape'=149
'tensor'=153
'zeros'=154
'ones'=155
'eye'=156
'one_hot'=157
'mse'=158
'mae'=159
'psnr'=160
'weighted_mean'=161
'huber_loss'=162
'cross_entropy'=163
'add_key'=164
'stack_push'=166
'stack_pop'=167
'stack_clear'=168
'stack_has'=169
'stack_get'=170
'stack'=172
'nonzero'=173
'int'=174
'float'=175
'upper'=176
'lower'=177
'trim'=178
'split'=179
'join'=180
'find'=182
'replace'=183
'dilate'=184
'erode'=185
'morph_open'=186
'morph_close'=187
'rgb_to_oklab'=188
'rgb_to_cielab'=189
'oklab_to_rgb'=190
'cielab_to_rgb'=191
'rgb_to_hsv'=192
'hsv_to_rgb'=193
'int_to_rgb'=194
'rgb_to_int'=195
'interpolate_linear'=196
'interpolate_area'=197
'text_image'=199
'if'=203
'else'=204
'while'=205
'for'=206
'in'=207
'break'=208
'continue'=209
'return'=210
'sort'=212
'argsort'=213
'argmin'=214
'argmax'=215
'softmax'=216
'softmin'=217
'unique'=218
'flip'=219
'startswith'=220
'endswith'=221
'squeeze'=222
'unsqueeze'=223
'roll'=224
'cov'=225
'entropy'=227
'crop'=228
'gather'=231
'scatter'=232
'scatter_add'=233
'+'=255
'-'=256
'*'=257
'/'=258
'%'=259
'^'=260
'<<'=261
'>>'=262
'>='=263
'>'=264
'<='=265
'<'=266
'=='=267
'='=268
'+='=269
'-='=270
'*='=271
'/='=272
'%='=273
'!='=274
'|'=275
'('=276
')'=277
','=278
';'=279
'->'=280
'['=281
']'=282
'?'=283
':'=284
'{'=285
'}'=286
'sinc'=22
'cbrt'=23
'reciprocal'=24
'logaddexp'=25
'logsumexp'=26
'norm'=27
'normalize'=28
'group_norm'=29
'outer'=30
'trace'=31
'det'=32
'rfft'=33
'irfft'=34
'isnan'=35
'isinf'=36
'isfinite'=37
'smin'=38
'smax'=39
'tmin'=40
'tmax'=41
'tnorm'=42
'snorm'=43
'floor'=44
'ceil'=45
'round'=46
'gamma'=47
'pow'=48
'sigm'=49
'clamp'=50
'fft'=51
'ifft'=52
'angle'=53
'print'=54
'lerp'=57
'slerp'=58
'step'=59
'smoothstep'=60
'fract'=61
'relu'=62
'softsign'=63
'leaky_relu'=64
'softplus'=65
'gelu'=66
'silu'=67
'sign'=68
'degrees'=69
'radians'=70
'logical_not'=71
'logical_and'=72
'logical_or'=73
'hypot'=74
'map'=75
'swap'=78
'range'=82
'linspace'=83
'logspace'=84
'topk'=85
'botk'=86
'pinv'=87
'inv'=88
'sum'=89
'mean'=90
'std'=91
'var'=92
'prod'=93
'isclose'=94
'allclose'=95
'quantile'=98
'dot'=99
'moment'=100
'erf'=101
'erfc'=102
'erfinv'=103
'any'=104
'all'=105
'edge'=106
'median'=108
'mode'=109
'cumsum'=110
'cumprod'=111
'smootherstep'=117
'remap'=119
'keys'=122
'repeat'=130
'flatten'=131
'append'=132
'get_value'=133
'flow_apply'=134
'motion_mask'=136
'flow_to_image'=137
'where'=140
'overlay'=142
'pad'=143
'cross'=144
'matmul'=145
'solve'=146
'matrix_rank'=147
'rife'=148
'shape'=151
'tensor'=155
'zeros'=156
'ones'=157
'eye'=158
'one_hot'=159
'mse'=160
'mae'=161
'psnr'=162
'weighted_mean'=163
'huber_loss'=164
'cross_entropy'=165
'add_key'=166
'stack_push'=168
'stack_pop'=169
'stack_clear'=170
'stack_has'=171
'stack_get'=172
'stack'=174
'nonzero'=175
'int'=176
'float'=177
'upper'=178
'lower'=179
'trim'=180
'split'=181
'join'=182
'find'=184
'replace'=185
'dilate'=186
'erode'=187
'morph_open'=188
'morph_close'=189
'rgb_to_oklab'=190
'rgb_to_cielab'=191
'oklab_to_rgb'=192
'cielab_to_rgb'=193
'rgb_to_hsv'=194
'hsv_to_rgb'=195
'int_to_rgb'=196
'rgb_to_int'=197
'interpolate_linear'=198
'interpolate_area'=199
'text_image'=201
'if'=205
'else'=206
'while'=207
'for'=208
'in'=209
'break'=210
'continue'=211
'return'=212
'sort'=214
'argsort'=215
'argmin'=216
'argmax'=217
'softmax'=218
'softmin'=219
'unique'=220
'flip'=221
'startswith'=222
'endswith'=223
'squeeze'=224
'unsqueeze'=225
'roll'=226
'cov'=227
'entropy'=229
'crop'=230
'gather'=233
'scatter'=234
'scatter_add'=235
'+'=257
'-'=258
'*'=259
'/'=260
'%'=261
'^'=262
'<<'=263
'>>'=264
'>='=265
'>'=266
'<='=267
'<'=268
'=='=269
'='=270
'+='=271
'-='=272
'*='=273
'/='=274
'%='=275
'!='=276
'|'=277
'('=278
')'=279
','=280
';'=281
'->'=282
'['=283
']'=284
'?'=285
':'=286
'{'=287
'}'=288
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+475 -471
View File
@@ -19,278 +19,280 @@ LOG2=18
EXP=19
LOG1P=20
EXPM1=21
CBRT=22
RECIPROCAL=23
LOGADDEXP=24
LOGSUMEXP=25
NORM=26
NORMALIZE=27
GROUP_NORM=28
OUTER=29
TRACE=30
DET=31
RFFT=32
IRFFT=33
ISNAN=34
ISINF=35
ISFINITE=36
SMIN=37
SMAX=38
TMIN=39
TMAX=40
TNORM=41
SNORM=42
FLOOR=43
CEIL=44
ROUND=45
GAMMA=46
POWE=47
SIGM=48
CLAMP=49
SFFT=50
SIFFT=51
ANGL=52
PRNT=53
PRINT_SHAPE=54
NVL=55
LERP=56
SLERP=57
STEP=58
SMOOTHSTEP=59
FRACT=60
RELU=61
SOFTSIGN=62
LEAKY_RELU=63
SOFTPLUS=64
GELU=65
SILU=66
SIGN=67
DEGREES=68
RADIANS=69
LOGICAL_NOT=70
LOGICAL_AND=71
LOGICAL_OR=72
HYPOT=73
MAP=74
EZCONV=75
CONV=76
SWAP=77
TRANSPOSE=78
PERM=79
RESHAPE=80
RANGE=81
LINSPACE=82
LOGSPACE=83
TOPK=84
BOTK=85
PINV=86
INV=87
SUM=88
MEAN=89
STD=90
VAR=91
PROD=92
ISCLOSE=93
ALLCLOSE=94
QUARTILE=95
PERCENTILE=96
QUANTILE=97
DOT=98
MOMENT=99
ERF=100
ERFINV=101
ANY=102
ALL=103
EDGE=104
GAUSSIAN=105
MEDIAN=106
MODE=107
CUMSUM=108
CUMPROD=109
TOPK_IND=110
BOTK_IND=111
CUBIC_EASE=112
ELASTIC_EASE=113
SINE_EASE=114
SMOOTHERSTEP=115
DIST=116
REMAP=117
COSSIM=118
COUNT=119
KEYS=120
ENABLE_TRACKING=121
DISABLE_TRACKING=122
RESET_TRACKING=123
GET_CHANGED_KEYS=124
GET_ADDED_KEYS=125
GET_REMOVED_KEYS=126
GET_UNCHANGED_KEYS=127
REPEAT=128
FLATTEN=129
APPEND=130
GET_VALUE=131
FLOW_APPLY=132
BATCH_SHUFFLE=133
MOTION_MASK=134
FLOW_TO_IMAGE=135
FLOW_MAG=136
FLOW_ANG=137
WHERE=138
HISTOGRAM=139
OVERLAY=140
PAD=141
CROSS=142
MATMUL=143
SOLVE=144
MATRIX_RANK=145
RIFE=146
BNOT=147
BITCOUNT=148
SHAPE=149
BAND=150
XOR=151
BOR=152
TENSOR=153
ZEROS=154
ONES=155
EYE=156
ONE_HOT=157
MSE=158
MAE=159
PSNR=160
WEIGHTED_MEAN=161
HUBER_LOSS=162
CROSS_ENTROPY=163
ADD_KEY=164
REMOVE_KEY=165
PUSH=166
POP=167
CLEAR=168
HAS=169
GET=170
CONCAT=171
STACK=172
NONZERO=173
INT=174
FLOAT=175
UPPER=176
LOWER=177
TRIM=178
SPLIT=179
JOIN=180
SUBSTRING=181
FIND=182
REPLACE=183
DILATE=184
ERODE=185
MORPH_OPEN=186
MORPH_CLOSE=187
RGB_TO_OKLAB=188
RGB_TO_CIELAB=189
OKLAB_TO_RGB=190
CIELAB_TO_RGB=191
RGB_TO_HSV=192
HSV_TO_RGB=193
INT_TO_RGB=194
RGB_TO_INT=195
INTERPOLATE_LINEAR=196
INTERPOLATE_AREA=197
INTERPOLATE_NEAREST=198
TEXT_IMAGE=199
AS_NESTED=200
SVD=201
DIAG=202
IF=203
ELSE=204
WHILE=205
FOR=206
IN=207
BREAK=208
CONTINUE=209
RETURN=210
TIMESTAMP=211
SORT=212
ARGSORT=213
ARGMIN=214
ARGMAX=215
SOFTMAX=216
SOFTMIN=217
UNIQUE=218
FLIP=219
STARTSWITH=220
ENDSWITH=221
SQUEEZE=222
UNSQUEEZE=223
ROLL=224
COV=225
CORR=226
ENTROPY=227
CROP=228
NONE=229
COORDS=230
GATHER=231
SCATTER=232
SCATTER_ADD=233
NOISE=234
PINK_NOISE=235
BROWN_NOISE=236
RAND=237
CAUCHY=238
EXPONENTIAL=239
LOGNORMAL=240
BERNOULLI=241
POISSON=242
GAMMADIST=243
BETADIST=244
LAPLACEDIST=245
GUMBELDIST=246
WEIBULLDIST=247
CHI2DIST=248
STUDENTTDIST=249
PERLIN=250
CELLULAR=251
PLASMA=252
RIDGED=253
DOMAIN_WARP=254
PLUS=255
MINUS=256
MULT=257
DIV=258
MOD=259
POW=260
LSHIFT=261
RSHIFT=262
GE=263
GT=264
LE=265
LT=266
EQ=267
EQUEALS=268
PLUS_EQ=269
MINUS_EQ=270
MULT_EQ=271
DIV_EQ=272
MOD_EQ=273
NE=274
PIPE=275
LPAREN=276
RPAREN=277
COMMA=278
SEMICOLON=279
ARROW=280
LBRACKET=281
RBRACKET=282
QUESTION=283
COLON=284
LBRACE=285
RBRACE=286
NUMBER=287
CONSTANT=288
STRING=289
VARIABLE=290
SL_COMMENT=291
ML_COMMENT=292
WS=293
SINC=22
CBRT=23
RECIPROCAL=24
LOGADDEXP=25
LOGSUMEXP=26
NORM=27
NORMALIZE=28
GROUP_NORM=29
OUTER=30
TRACE=31
DET=32
RFFT=33
IRFFT=34
ISNAN=35
ISINF=36
ISFINITE=37
SMIN=38
SMAX=39
TMIN=40
TMAX=41
TNORM=42
SNORM=43
FLOOR=44
CEIL=45
ROUND=46
GAMMA=47
POWE=48
SIGM=49
CLAMP=50
SFFT=51
SIFFT=52
ANGL=53
PRNT=54
PRINT_SHAPE=55
NVL=56
LERP=57
SLERP=58
STEP=59
SMOOTHSTEP=60
FRACT=61
RELU=62
SOFTSIGN=63
LEAKY_RELU=64
SOFTPLUS=65
GELU=66
SILU=67
SIGN=68
DEGREES=69
RADIANS=70
LOGICAL_NOT=71
LOGICAL_AND=72
LOGICAL_OR=73
HYPOT=74
MAP=75
EZCONV=76
CONV=77
SWAP=78
TRANSPOSE=79
PERM=80
RESHAPE=81
RANGE=82
LINSPACE=83
LOGSPACE=84
TOPK=85
BOTK=86
PINV=87
INV=88
SUM=89
MEAN=90
STD=91
VAR=92
PROD=93
ISCLOSE=94
ALLCLOSE=95
QUARTILE=96
PERCENTILE=97
QUANTILE=98
DOT=99
MOMENT=100
ERF=101
ERFC=102
ERFINV=103
ANY=104
ALL=105
EDGE=106
GAUSSIAN=107
MEDIAN=108
MODE=109
CUMSUM=110
CUMPROD=111
TOPK_IND=112
BOTK_IND=113
CUBIC_EASE=114
ELASTIC_EASE=115
SINE_EASE=116
SMOOTHERSTEP=117
DIST=118
REMAP=119
COSSIM=120
COUNT=121
KEYS=122
ENABLE_TRACKING=123
DISABLE_TRACKING=124
RESET_TRACKING=125
GET_CHANGED_KEYS=126
GET_ADDED_KEYS=127
GET_REMOVED_KEYS=128
GET_UNCHANGED_KEYS=129
REPEAT=130
FLATTEN=131
APPEND=132
GET_VALUE=133
FLOW_APPLY=134
BATCH_SHUFFLE=135
MOTION_MASK=136
FLOW_TO_IMAGE=137
FLOW_MAG=138
FLOW_ANG=139
WHERE=140
HISTOGRAM=141
OVERLAY=142
PAD=143
CROSS=144
MATMUL=145
SOLVE=146
MATRIX_RANK=147
RIFE=148
BNOT=149
BITCOUNT=150
SHAPE=151
BAND=152
XOR=153
BOR=154
TENSOR=155
ZEROS=156
ONES=157
EYE=158
ONE_HOT=159
MSE=160
MAE=161
PSNR=162
WEIGHTED_MEAN=163
HUBER_LOSS=164
CROSS_ENTROPY=165
ADD_KEY=166
REMOVE_KEY=167
PUSH=168
POP=169
CLEAR=170
HAS=171
GET=172
CONCAT=173
STACK=174
NONZERO=175
INT=176
FLOAT=177
UPPER=178
LOWER=179
TRIM=180
SPLIT=181
JOIN=182
SUBSTRING=183
FIND=184
REPLACE=185
DILATE=186
ERODE=187
MORPH_OPEN=188
MORPH_CLOSE=189
RGB_TO_OKLAB=190
RGB_TO_CIELAB=191
OKLAB_TO_RGB=192
CIELAB_TO_RGB=193
RGB_TO_HSV=194
HSV_TO_RGB=195
INT_TO_RGB=196
RGB_TO_INT=197
INTERPOLATE_LINEAR=198
INTERPOLATE_AREA=199
INTERPOLATE_NEAREST=200
TEXT_IMAGE=201
AS_NESTED=202
SVD=203
DIAG=204
IF=205
ELSE=206
WHILE=207
FOR=208
IN=209
BREAK=210
CONTINUE=211
RETURN=212
TIMESTAMP=213
SORT=214
ARGSORT=215
ARGMIN=216
ARGMAX=217
SOFTMAX=218
SOFTMIN=219
UNIQUE=220
FLIP=221
STARTSWITH=222
ENDSWITH=223
SQUEEZE=224
UNSQUEEZE=225
ROLL=226
COV=227
CORR=228
ENTROPY=229
CROP=230
NONE=231
COORDS=232
GATHER=233
SCATTER=234
SCATTER_ADD=235
NOISE=236
PINK_NOISE=237
BROWN_NOISE=238
RAND=239
CAUCHY=240
EXPONENTIAL=241
LOGNORMAL=242
BERNOULLI=243
POISSON=244
GAMMADIST=245
BETADIST=246
LAPLACEDIST=247
GUMBELDIST=248
WEIBULLDIST=249
CHI2DIST=250
STUDENTTDIST=251
PERLIN=252
CELLULAR=253
PLASMA=254
RIDGED=255
DOMAIN_WARP=256
PLUS=257
MINUS=258
MULT=259
DIV=260
MOD=261
POW=262
LSHIFT=263
RSHIFT=264
GE=265
GT=266
LE=267
LT=268
EQ=269
EQUEALS=270
PLUS_EQ=271
MINUS_EQ=272
MULT_EQ=273
DIV_EQ=274
MOD_EQ=275
NE=276
PIPE=277
LPAREN=278
RPAREN=279
COMMA=280
SEMICOLON=281
ARROW=282
LBRACKET=283
RBRACKET=284
QUESTION=285
COLON=286
LBRACE=287
RBRACE=288
NUMBER=289
CONSTANT=290
STRING=291
VARIABLE=292
SL_COMMENT=293
ML_COMMENT=294
WS=295
'sin'=1
'cos'=2
'tan'=3
@@ -312,202 +314,204 @@ WS=293
'exp'=19
'log1p'=20
'expm1'=21
'cbrt'=22
'reciprocal'=23
'logaddexp'=24
'logsumexp'=25
'norm'=26
'normalize'=27
'group_norm'=28
'outer'=29
'trace'=30
'det'=31
'rfft'=32
'irfft'=33
'isnan'=34
'isinf'=35
'isfinite'=36
'smin'=37
'smax'=38
'tmin'=39
'tmax'=40
'tnorm'=41
'snorm'=42
'floor'=43
'ceil'=44
'round'=45
'gamma'=46
'pow'=47
'sigm'=48
'clamp'=49
'fft'=50
'ifft'=51
'angle'=52
'print'=53
'lerp'=56
'slerp'=57
'step'=58
'smoothstep'=59
'fract'=60
'relu'=61
'softsign'=62
'leaky_relu'=63
'softplus'=64
'gelu'=65
'silu'=66
'sign'=67
'degrees'=68
'radians'=69
'logical_not'=70
'logical_and'=71
'logical_or'=72
'hypot'=73
'map'=74
'swap'=77
'range'=81
'linspace'=82
'logspace'=83
'topk'=84
'botk'=85
'pinv'=86
'inv'=87
'sum'=88
'mean'=89
'std'=90
'var'=91
'prod'=92
'isclose'=93
'allclose'=94
'quantile'=97
'dot'=98
'moment'=99
'erf'=100
'erfinv'=101
'any'=102
'all'=103
'edge'=104
'median'=106
'mode'=107
'cumsum'=108
'cumprod'=109
'smootherstep'=115
'remap'=117
'keys'=120
'repeat'=128
'flatten'=129
'append'=130
'get_value'=131
'flow_apply'=132
'motion_mask'=134
'flow_to_image'=135
'where'=138
'overlay'=140
'pad'=141
'cross'=142
'matmul'=143
'solve'=144
'matrix_rank'=145
'rife'=146
'shape'=149
'tensor'=153
'zeros'=154
'ones'=155
'eye'=156
'one_hot'=157
'mse'=158
'mae'=159
'psnr'=160
'weighted_mean'=161
'huber_loss'=162
'cross_entropy'=163
'add_key'=164
'stack_push'=166
'stack_pop'=167
'stack_clear'=168
'stack_has'=169
'stack_get'=170
'stack'=172
'nonzero'=173
'int'=174
'float'=175
'upper'=176
'lower'=177
'trim'=178
'split'=179
'join'=180
'find'=182
'replace'=183
'dilate'=184
'erode'=185
'morph_open'=186
'morph_close'=187
'rgb_to_oklab'=188
'rgb_to_cielab'=189
'oklab_to_rgb'=190
'cielab_to_rgb'=191
'rgb_to_hsv'=192
'hsv_to_rgb'=193
'int_to_rgb'=194
'rgb_to_int'=195
'interpolate_linear'=196
'interpolate_area'=197
'text_image'=199
'if'=203
'else'=204
'while'=205
'for'=206
'in'=207
'break'=208
'continue'=209
'return'=210
'sort'=212
'argsort'=213
'argmin'=214
'argmax'=215
'softmax'=216
'softmin'=217
'unique'=218
'flip'=219
'startswith'=220
'endswith'=221
'squeeze'=222
'unsqueeze'=223
'roll'=224
'cov'=225
'entropy'=227
'crop'=228
'gather'=231
'scatter'=232
'scatter_add'=233
'+'=255
'-'=256
'*'=257
'/'=258
'%'=259
'^'=260
'<<'=261
'>>'=262
'>='=263
'>'=264
'<='=265
'<'=266
'=='=267
'='=268
'+='=269
'-='=270
'*='=271
'/='=272
'%='=273
'!='=274
'|'=275
'('=276
')'=277
','=278
';'=279
'->'=280
'['=281
']'=282
'?'=283
':'=284
'{'=285
'}'=286
'sinc'=22
'cbrt'=23
'reciprocal'=24
'logaddexp'=25
'logsumexp'=26
'norm'=27
'normalize'=28
'group_norm'=29
'outer'=30
'trace'=31
'det'=32
'rfft'=33
'irfft'=34
'isnan'=35
'isinf'=36
'isfinite'=37
'smin'=38
'smax'=39
'tmin'=40
'tmax'=41
'tnorm'=42
'snorm'=43
'floor'=44
'ceil'=45
'round'=46
'gamma'=47
'pow'=48
'sigm'=49
'clamp'=50
'fft'=51
'ifft'=52
'angle'=53
'print'=54
'lerp'=57
'slerp'=58
'step'=59
'smoothstep'=60
'fract'=61
'relu'=62
'softsign'=63
'leaky_relu'=64
'softplus'=65
'gelu'=66
'silu'=67
'sign'=68
'degrees'=69
'radians'=70
'logical_not'=71
'logical_and'=72
'logical_or'=73
'hypot'=74
'map'=75
'swap'=78
'range'=82
'linspace'=83
'logspace'=84
'topk'=85
'botk'=86
'pinv'=87
'inv'=88
'sum'=89
'mean'=90
'std'=91
'var'=92
'prod'=93
'isclose'=94
'allclose'=95
'quantile'=98
'dot'=99
'moment'=100
'erf'=101
'erfc'=102
'erfinv'=103
'any'=104
'all'=105
'edge'=106
'median'=108
'mode'=109
'cumsum'=110
'cumprod'=111
'smootherstep'=117
'remap'=119
'keys'=122
'repeat'=130
'flatten'=131
'append'=132
'get_value'=133
'flow_apply'=134
'motion_mask'=136
'flow_to_image'=137
'where'=140
'overlay'=142
'pad'=143
'cross'=144
'matmul'=145
'solve'=146
'matrix_rank'=147
'rife'=148
'shape'=151
'tensor'=155
'zeros'=156
'ones'=157
'eye'=158
'one_hot'=159
'mse'=160
'mae'=161
'psnr'=162
'weighted_mean'=163
'huber_loss'=164
'cross_entropy'=165
'add_key'=166
'stack_push'=168
'stack_pop'=169
'stack_clear'=170
'stack_has'=171
'stack_get'=172
'stack'=174
'nonzero'=175
'int'=176
'float'=177
'upper'=178
'lower'=179
'trim'=180
'split'=181
'join'=182
'find'=184
'replace'=185
'dilate'=186
'erode'=187
'morph_open'=188
'morph_close'=189
'rgb_to_oklab'=190
'rgb_to_cielab'=191
'oklab_to_rgb'=192
'cielab_to_rgb'=193
'rgb_to_hsv'=194
'hsv_to_rgb'=195
'int_to_rgb'=196
'rgb_to_int'=197
'interpolate_linear'=198
'interpolate_area'=199
'text_image'=201
'if'=205
'else'=206
'while'=207
'for'=208
'in'=209
'break'=210
'continue'=211
'return'=212
'sort'=214
'argsort'=215
'argmin'=216
'argmax'=217
'softmax'=218
'softmin'=219
'unique'=220
'flip'=221
'startswith'=222
'endswith'=223
'squeeze'=224
'unsqueeze'=225
'roll'=226
'cov'=227
'entropy'=229
'crop'=230
'gather'=233
'scatter'=234
'scatter_add'=235
'+'=257
'-'=258
'*'=259
'/'=260
'%'=261
'^'=262
'<<'=263
'>>'=264
'>='=265
'>'=266
'<='=267
'<'=268
'=='=269
'='=270
'+='=271
'-='=272
'*='=273
'/='=274
'%='=275
'!='=276
'|'=277
'('=278
')'=279
','=280
';'=281
'->'=282
'['=283
']'=284
'?'=285
':'=286
'{'=287
'}'=288
@@ -917,6 +917,15 @@ class MathExprListener(ParseTreeListener):
pass
# Enter a parse tree produced by MathExprParser#SincFunc.
def enterSincFunc(self, ctx:MathExprParser.SincFuncContext):
pass
# Exit a parse tree produced by MathExprParser#SincFunc.
def exitSincFunc(self, ctx:MathExprParser.SincFuncContext):
pass
# Enter a parse tree produced by MathExprParser#CbrtFunc.
def enterCbrtFunc(self, ctx:MathExprParser.CbrtFuncContext):
pass
@@ -1421,6 +1430,15 @@ class MathExprListener(ParseTreeListener):
pass
# Enter a parse tree produced by MathExprParser#ErfcFunc.
def enterErfcFunc(self, ctx:MathExprParser.ErfcFuncContext):
pass
# Exit a parse tree produced by MathExprParser#ErfcFunc.
def exitErfcFunc(self, ctx:MathExprParser.ErfcFuncContext):
pass
# Enter a parse tree produced by MathExprParser#ErfinvFunc.
def enterErfinvFunc(self, ctx:MathExprParser.ErfinvFuncContext):
pass
File diff suppressed because it is too large Load Diff
@@ -514,6 +514,11 @@ class MathExprVisitor(ParseTreeVisitor):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#SincFunc.
def visitSincFunc(self, ctx:MathExprParser.SincFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#CbrtFunc.
def visitCbrtFunc(self, ctx:MathExprParser.CbrtFuncContext):
return self.visitChildren(ctx)
@@ -794,6 +799,11 @@ class MathExprVisitor(ParseTreeVisitor):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#ErfcFunc.
def visitErfcFunc(self, ctx:MathExprParser.ErfcFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#ErfinvFunc.
def visitErfinvFunc(self, ctx:MathExprParser.ErfinvFuncContext):
return self.visitChildren(ctx)
+4 -2
View File
@@ -6,7 +6,7 @@ INBUILT_CONSTANTS = {
'e', 'pi'
}
INBUILT_FUNCTIONS = {
'abs', 'acos', 'acosh', 'add_key', 'added_keys', 'all', 'allclose', 'angle', 'any', 'append', 'argmax', 'argmin', 'argsort', 'as_nested', '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', 'brown', 'brown_noise', 'bxor', 'cat', 'cbrt', 'ceil', 'cellular', 'cellular_noise', 'cielab_to_rgb', 'clamp', 'cnt', 'concat', 'concatenate', 'conv', 'convolution', 'coordinates', 'coords', 'corr', 'correlation', 'cos', 'cosh', 'cosine_similarity', 'cossim', 'count', 'cov', 'crop', 'cross', 'cross_entropy', 'cubic', 'cubic_ease', 'cumprod', 'cumsum', 'degrees', 'det', 'diag', 'diagonal_matrix', 'dilate', 'disable_tracking', 'dist', 'distance', 'domain_warp', 'domain_warp_noise', 'dot', 'edge', 'elastic', 'elastic_ease', 'enable_tracking', 'endswith', 'entropy', 'erf', 'erfinv', 'erode', 'exp', 'expm1', 'eye', 'ezconv', 'ezconvolution', 'fft', 'find', 'flatten', 'flip', 'float', 'floor', 'flow_ang', 'flow_angle', 'flow_apply', 'flow_mag', 'flow_magnitude', 'flow_to_image', 'fract', 'gamma', 'gather', 'gaussian', 'gelu', 'get_added_keys', 'get_changed_keys', 'get_removed_keys', 'get_unchanged_keys', 'get_value', 'group_norm', 'hist', 'histogram', 'hsv_to_rgb', 'huber_loss', 'hypot', 'changed_keys', 'ifft', 'int', 'int_to_rgb', 'interpolate_area', 'interpolate_linear', 'interpolate_nearest', 'interpolate_nearest_exact', 'inv', 'irfft', 'isclose', 'isfinite', 'isinf', 'isnan', 'join', 'keys', 'leaky_relu', 'length', 'lerp', 'linspace', 'ln', 'log', 'log1p', 'log2', 'logaddexp', 'logical_and', 'logical_not', 'logical_or', 'logspace', 'logsumexp', 'lower', 'mae', 'map', 'matmul', 'matrix_rank', 'mean', 'median', 'mode', 'moment', 'morph_close', 'morph_open', 'motion_mask', 'mse', 'nan_to_num', 'noise', 'nonzero', 'norm', 'normalize', 'now', 'nvl', 'oklab_to_rgb', 'one_hot', 'ones', 'outer', 'overlay', 'pad', 'percentile', 'perlin', 'perlin_noise', 'perm', 'permute', 'pink', 'pink_noise', 'pinv', 'plasma', 'plasma_noise', 'popcnt', 'popcount', 'pow', 'prcnt', 'print', 'print_shape', 'prod', 'pshp', 'psnr', 'quantile', 'quartil', 'quartile', 'radians', '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', 'reciprocal', 'relu', 'remap', 'remove_key', 'removed_keys', 'repeat', 'replace', 'reset_tracking', 'reshape', 'rfft', 'rgb_to_cielab', 'rgb_to_hsv', 'rgb_to_int', 'rgb_to_oklab', 'ridged', 'ridged_noise', 'rife', 'rm_key', 'roll', 'round', 'rshp', 'scatter', 'scatter_add', 'select', 'shape', 'shuffle', 'sigm', 'sign', 'silu', 'sin', 'sine', 'sine_ease', 'singular_value_decomposition', 'sinh', 'slerp', 'smax', 'smin', 'smootherstep', 'smoothstep', 'snorm', 'softmax', 'softmin', 'softplus', 'softsign', 'solve', 'sort', 'split', 'sqrt', 'squeeze', 'stack', 'stack_clear', 'stack_get', 'stack_has', 'stack_pop', 'stack_push', 'startswith', 'std', 'step', 'substr', 'substring', 'sum', 'svd', 'swap', 'swapaxes', 'tan', 'tanh', 'tensor', 'text_image', 'timestamp', 'tmax', 'tmin', 'tnorm', 'topk', 'topk_ind', 'topk_indices', 'trace', 'track_off', 'track_on', 'track_reset', 'transpose', 'trim', 'turbulence', 'unchanged_keys', 'unique', 'unsqueeze', 'upper', 'var', 'voronoi', 'voronoi_noise', 'weighted_mean', 'where', 'worley', 'zeros'
'abs', 'acos', 'acosh', 'add_key', 'added_keys', 'all', 'allclose', 'angle', 'any', 'append', 'argmax', 'argmin', 'argsort', 'as_nested', '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', 'brown', 'brown_noise', 'bxor', 'cat', 'cbrt', 'ceil', 'cellular', 'cellular_noise', 'cielab_to_rgb', 'clamp', 'cnt', 'concat', 'concatenate', 'conv', 'convolution', 'coordinates', 'coords', 'corr', 'correlation', 'cos', 'cosh', 'cosine_similarity', 'cossim', 'count', 'cov', 'crop', 'cross', 'cross_entropy', 'cubic', 'cubic_ease', 'cumprod', 'cumsum', 'degrees', 'det', 'diag', 'diagonal_matrix', 'dilate', 'disable_tracking', 'dist', 'distance', 'domain_warp', 'domain_warp_noise', 'dot', 'edge', 'elastic', 'elastic_ease', 'enable_tracking', 'endswith', 'entropy', 'erf', 'erfc', 'erfinv', 'erode', 'exp', 'expm1', 'eye', 'ezconv', 'ezconvolution', 'fft', 'find', 'flatten', 'flip', 'float', 'floor', 'flow_ang', 'flow_angle', 'flow_apply', 'flow_mag', 'flow_magnitude', 'flow_to_image', 'fract', 'gamma', 'gather', 'gaussian', 'gelu', 'get_added_keys', 'get_changed_keys', 'get_removed_keys', 'get_unchanged_keys', 'get_value', 'group_norm', 'hist', 'histogram', 'hsv_to_rgb', 'huber_loss', 'hypot', 'changed_keys', 'ifft', 'int', 'int_to_rgb', 'interpolate_area', 'interpolate_linear', 'interpolate_nearest', 'interpolate_nearest_exact', 'inv', 'irfft', 'isclose', 'isfinite', 'isinf', 'isnan', 'join', 'keys', 'leaky_relu', 'length', 'lerp', 'linspace', 'ln', 'log', 'log1p', 'log2', 'logaddexp', 'logical_and', 'logical_not', 'logical_or', 'logspace', 'logsumexp', 'lower', 'mae', 'map', 'matmul', 'matrix_rank', 'mean', 'median', 'mode', 'moment', 'morph_close', 'morph_open', 'motion_mask', 'mse', 'nan_to_num', 'noise', 'nonzero', 'norm', 'normalize', 'now', 'nvl', 'oklab_to_rgb', 'one_hot', 'ones', 'outer', 'overlay', 'pad', 'percentile', 'perlin', 'perlin_noise', 'perm', 'permute', 'pink', 'pink_noise', 'pinv', 'plasma', 'plasma_noise', 'popcnt', 'popcount', 'pow', 'prcnt', 'print', 'print_shape', 'prod', 'pshp', 'psnr', 'quantile', 'quartil', 'quartile', 'radians', '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', 'reciprocal', 'relu', 'remap', 'remove_key', 'removed_keys', 'repeat', 'replace', 'reset_tracking', 'reshape', 'rfft', 'rgb_to_cielab', 'rgb_to_hsv', 'rgb_to_int', 'rgb_to_oklab', 'ridged', 'ridged_noise', 'rife', 'rm_key', 'roll', 'round', 'rshp', 'scatter', 'scatter_add', 'select', 'shape', 'shuffle', 'sigm', 'sign', 'silu', 'sin', 'sinc', 'sine', 'sine_ease', 'singular_value_decomposition', 'sinh', 'slerp', 'smax', 'smin', 'smootherstep', 'smoothstep', 'snorm', 'softmax', 'softmin', 'softplus', 'softsign', 'solve', 'sort', 'split', 'sqrt', 'squeeze', 'stack', 'stack_clear', 'stack_get', 'stack_has', 'stack_pop', 'stack_push', 'startswith', 'std', 'step', 'substr', 'substring', 'sum', 'svd', 'swap', 'swapaxes', 'tan', 'tanh', 'tensor', 'text_image', 'timestamp', 'tmax', 'tmin', 'tnorm', 'topk', 'topk_ind', 'topk_indices', 'trace', 'track_off', 'track_on', 'track_reset', 'transpose', 'trim', 'turbulence', 'unchanged_keys', 'unique', 'unsqueeze', 'upper', 'var', 'voronoi', 'voronoi_noise', 'weighted_mean', 'where', 'worley', 'zeros'
}
INBUILT_FUNCTION_META = {
@@ -31,6 +31,7 @@ INBUILT_FUNCTION_META = {
'exp': {'min_args': 1, 'max_args': 1, 'snippet': 'exp(x)', 'description': 'applies e^x to value (per element)'},
'log1p': {'min_args': 1, 'max_args': 1, 'snippet': 'log1p(x)', 'description': 'applies ln(1+x) accurately for values near zero'},
'expm1': {'min_args': 1, 'max_args': 1, 'snippet': 'expm1(x)', 'description': 'applies exp(x)-1 accurately for values near zero'},
'sinc': {'min_args': 1, 'max_args': 1, 'snippet': 'sinc(x)', 'description': 'computes the normalized sinc function sin(pi*x)/(pi*x), with sinc(0)=1'},
'cbrt': {'min_args': 1, 'max_args': 1, 'snippet': 'cbrt(x)', 'description': 'computes the real cube root of each value, including negative values'},
'reciprocal': {'min_args': 1, 'max_args': 1, 'snippet': 'reciprocal(x)', 'description': 'computes 1/x element-wise'},
'logaddexp': {'min_args': 2, 'max_args': 2, 'snippet': 'logaddexp(x, y)', 'description': 'computes log(exp(x) + exp(y)) element-wise using a numerically stable method'},
@@ -68,7 +69,7 @@ INBUILT_FUNCTION_META = {
'nvl': {'min_args': 4, 'max_args': 4, 'snippet': 'nvl(x, nan, pos_inf, neg_inf)', 'description': 'null value replacement - inspired by NVL'},
'nan_to_num': {'min_args': 4, 'max_args': 4, 'snippet': 'nan_to_num(x, nan, pos_inf, neg_inf)', 'description': 'null value replacement - inspired by NVL'},
'lerp': {'min_args': 3, 'max_args': 3, 'snippet': 'lerp(a, b, t)', 'description': 'linear interpolation between a and b by t per element. t can be float or tensor.'},
'slerp': {'min_args': 3, 'max_args': 4, 'snippet': 'slerp(a, b, t, dim)', 'description': 'interpolates vector directions spherically and magnitudes linearly. dim selects the vector-component axis; other axes identify independent vectors. Defaults to the last dimension.'},
'slerp': {'min_args': 3, 'max_args': 4, 'snippet': 'slerp(a, b, t, dim)', 'description': 'interpolates vector directions spherically and magnitudes linearly. Without dim, all elements form one vector; dim selects a vector-component axis and other axes identify independent vectors.'},
'step': {'min_args': 2, 'max_args': 2, 'snippet': 'step(x, edge)', 'description': 'returns 0 if x < edge, else 1'},
'smoothstep': {'min_args': 3, 'max_args': 3, 'snippet': 'smoothstep(x, edge0, edge1)', 'description': 'smooth interpolation between edge0 and edge1'},
'fract': {'min_args': 1, 'max_args': 1, 'snippet': 'fract(x)', 'description': 'returns the fractional part of x: x - floor(x)'},
@@ -119,6 +120,7 @@ INBUILT_FUNCTION_META = {
'dot': {'min_args': 2, 'max_args': 2, 'snippet': 'dot(x, y)', 'description': 'computes the dot product of x and y after flattening both to 1D. Use cross(x, y) if you need a per-vector product with the last dimension kept.'},
'moment': {'min_args': 3, 'max_args': 3, 'snippet': 'moment(x, a, k)', 'description': 'computes the k-th moment of x around a'},
'erf': {'min_args': 1, 'max_args': 1, 'snippet': 'erf(x)', 'description': 'computes the error function (torch.erf)'},
'erfc': {'min_args': 1, 'max_args': 1, 'snippet': 'erfc(x)', 'description': 'computes the complementary error function (torch.special.erfc)'},
'erfinv': {'min_args': 1, 'max_args': 1, 'snippet': 'erfinv(x)', 'description': 'computes the inverse error function (torch.erfinv)'},
'any': {'min_args': 1, 'max_args': 1, 'snippet': 'any(x)', 'description': 'returns 1 if any element of x is non-zero otherwise 0'},
'all': {'min_args': 1, 'max_args': 1, 'snippet': 'all(x)', 'description': 'returns 1 if all elements of x are non-zero otherwise 0'},
File diff suppressed because one or more lines are too long
+475 -471
View File
@@ -19,278 +19,280 @@ LOG2=18
EXP=19
LOG1P=20
EXPM1=21
CBRT=22
RECIPROCAL=23
LOGADDEXP=24
LOGSUMEXP=25
NORM=26
NORMALIZE=27
GROUP_NORM=28
OUTER=29
TRACE=30
DET=31
RFFT=32
IRFFT=33
ISNAN=34
ISINF=35
ISFINITE=36
SMIN=37
SMAX=38
TMIN=39
TMAX=40
TNORM=41
SNORM=42
FLOOR=43
CEIL=44
ROUND=45
GAMMA=46
POWE=47
SIGM=48
CLAMP=49
SFFT=50
SIFFT=51
ANGL=52
PRNT=53
PRINT_SHAPE=54
NVL=55
LERP=56
SLERP=57
STEP=58
SMOOTHSTEP=59
FRACT=60
RELU=61
SOFTSIGN=62
LEAKY_RELU=63
SOFTPLUS=64
GELU=65
SILU=66
SIGN=67
DEGREES=68
RADIANS=69
LOGICAL_NOT=70
LOGICAL_AND=71
LOGICAL_OR=72
HYPOT=73
MAP=74
EZCONV=75
CONV=76
SWAP=77
TRANSPOSE=78
PERM=79
RESHAPE=80
RANGE=81
LINSPACE=82
LOGSPACE=83
TOPK=84
BOTK=85
PINV=86
INV=87
SUM=88
MEAN=89
STD=90
VAR=91
PROD=92
ISCLOSE=93
ALLCLOSE=94
QUARTILE=95
PERCENTILE=96
QUANTILE=97
DOT=98
MOMENT=99
ERF=100
ERFINV=101
ANY=102
ALL=103
EDGE=104
GAUSSIAN=105
MEDIAN=106
MODE=107
CUMSUM=108
CUMPROD=109
TOPK_IND=110
BOTK_IND=111
CUBIC_EASE=112
ELASTIC_EASE=113
SINE_EASE=114
SMOOTHERSTEP=115
DIST=116
REMAP=117
COSSIM=118
COUNT=119
KEYS=120
ENABLE_TRACKING=121
DISABLE_TRACKING=122
RESET_TRACKING=123
GET_CHANGED_KEYS=124
GET_ADDED_KEYS=125
GET_REMOVED_KEYS=126
GET_UNCHANGED_KEYS=127
REPEAT=128
FLATTEN=129
APPEND=130
GET_VALUE=131
FLOW_APPLY=132
BATCH_SHUFFLE=133
MOTION_MASK=134
FLOW_TO_IMAGE=135
FLOW_MAG=136
FLOW_ANG=137
WHERE=138
HISTOGRAM=139
OVERLAY=140
PAD=141
CROSS=142
MATMUL=143
SOLVE=144
MATRIX_RANK=145
RIFE=146
BNOT=147
BITCOUNT=148
SHAPE=149
BAND=150
XOR=151
BOR=152
TENSOR=153
ZEROS=154
ONES=155
EYE=156
ONE_HOT=157
MSE=158
MAE=159
PSNR=160
WEIGHTED_MEAN=161
HUBER_LOSS=162
CROSS_ENTROPY=163
ADD_KEY=164
REMOVE_KEY=165
PUSH=166
POP=167
CLEAR=168
HAS=169
GET=170
CONCAT=171
STACK=172
NONZERO=173
INT=174
FLOAT=175
UPPER=176
LOWER=177
TRIM=178
SPLIT=179
JOIN=180
SUBSTRING=181
FIND=182
REPLACE=183
DILATE=184
ERODE=185
MORPH_OPEN=186
MORPH_CLOSE=187
RGB_TO_OKLAB=188
RGB_TO_CIELAB=189
OKLAB_TO_RGB=190
CIELAB_TO_RGB=191
RGB_TO_HSV=192
HSV_TO_RGB=193
INT_TO_RGB=194
RGB_TO_INT=195
INTERPOLATE_LINEAR=196
INTERPOLATE_AREA=197
INTERPOLATE_NEAREST=198
TEXT_IMAGE=199
AS_NESTED=200
SVD=201
DIAG=202
IF=203
ELSE=204
WHILE=205
FOR=206
IN=207
BREAK=208
CONTINUE=209
RETURN=210
TIMESTAMP=211
SORT=212
ARGSORT=213
ARGMIN=214
ARGMAX=215
SOFTMAX=216
SOFTMIN=217
UNIQUE=218
FLIP=219
STARTSWITH=220
ENDSWITH=221
SQUEEZE=222
UNSQUEEZE=223
ROLL=224
COV=225
CORR=226
ENTROPY=227
CROP=228
NONE=229
COORDS=230
GATHER=231
SCATTER=232
SCATTER_ADD=233
NOISE=234
PINK_NOISE=235
BROWN_NOISE=236
RAND=237
CAUCHY=238
EXPONENTIAL=239
LOGNORMAL=240
BERNOULLI=241
POISSON=242
GAMMADIST=243
BETADIST=244
LAPLACEDIST=245
GUMBELDIST=246
WEIBULLDIST=247
CHI2DIST=248
STUDENTTDIST=249
PERLIN=250
CELLULAR=251
PLASMA=252
RIDGED=253
DOMAIN_WARP=254
PLUS=255
MINUS=256
MULT=257
DIV=258
MOD=259
POW=260
LSHIFT=261
RSHIFT=262
GE=263
GT=264
LE=265
LT=266
EQ=267
EQUEALS=268
PLUS_EQ=269
MINUS_EQ=270
MULT_EQ=271
DIV_EQ=272
MOD_EQ=273
NE=274
PIPE=275
LPAREN=276
RPAREN=277
COMMA=278
SEMICOLON=279
ARROW=280
LBRACKET=281
RBRACKET=282
QUESTION=283
COLON=284
LBRACE=285
RBRACE=286
NUMBER=287
CONSTANT=288
STRING=289
VARIABLE=290
SL_COMMENT=291
ML_COMMENT=292
WS=293
SINC=22
CBRT=23
RECIPROCAL=24
LOGADDEXP=25
LOGSUMEXP=26
NORM=27
NORMALIZE=28
GROUP_NORM=29
OUTER=30
TRACE=31
DET=32
RFFT=33
IRFFT=34
ISNAN=35
ISINF=36
ISFINITE=37
SMIN=38
SMAX=39
TMIN=40
TMAX=41
TNORM=42
SNORM=43
FLOOR=44
CEIL=45
ROUND=46
GAMMA=47
POWE=48
SIGM=49
CLAMP=50
SFFT=51
SIFFT=52
ANGL=53
PRNT=54
PRINT_SHAPE=55
NVL=56
LERP=57
SLERP=58
STEP=59
SMOOTHSTEP=60
FRACT=61
RELU=62
SOFTSIGN=63
LEAKY_RELU=64
SOFTPLUS=65
GELU=66
SILU=67
SIGN=68
DEGREES=69
RADIANS=70
LOGICAL_NOT=71
LOGICAL_AND=72
LOGICAL_OR=73
HYPOT=74
MAP=75
EZCONV=76
CONV=77
SWAP=78
TRANSPOSE=79
PERM=80
RESHAPE=81
RANGE=82
LINSPACE=83
LOGSPACE=84
TOPK=85
BOTK=86
PINV=87
INV=88
SUM=89
MEAN=90
STD=91
VAR=92
PROD=93
ISCLOSE=94
ALLCLOSE=95
QUARTILE=96
PERCENTILE=97
QUANTILE=98
DOT=99
MOMENT=100
ERF=101
ERFC=102
ERFINV=103
ANY=104
ALL=105
EDGE=106
GAUSSIAN=107
MEDIAN=108
MODE=109
CUMSUM=110
CUMPROD=111
TOPK_IND=112
BOTK_IND=113
CUBIC_EASE=114
ELASTIC_EASE=115
SINE_EASE=116
SMOOTHERSTEP=117
DIST=118
REMAP=119
COSSIM=120
COUNT=121
KEYS=122
ENABLE_TRACKING=123
DISABLE_TRACKING=124
RESET_TRACKING=125
GET_CHANGED_KEYS=126
GET_ADDED_KEYS=127
GET_REMOVED_KEYS=128
GET_UNCHANGED_KEYS=129
REPEAT=130
FLATTEN=131
APPEND=132
GET_VALUE=133
FLOW_APPLY=134
BATCH_SHUFFLE=135
MOTION_MASK=136
FLOW_TO_IMAGE=137
FLOW_MAG=138
FLOW_ANG=139
WHERE=140
HISTOGRAM=141
OVERLAY=142
PAD=143
CROSS=144
MATMUL=145
SOLVE=146
MATRIX_RANK=147
RIFE=148
BNOT=149
BITCOUNT=150
SHAPE=151
BAND=152
XOR=153
BOR=154
TENSOR=155
ZEROS=156
ONES=157
EYE=158
ONE_HOT=159
MSE=160
MAE=161
PSNR=162
WEIGHTED_MEAN=163
HUBER_LOSS=164
CROSS_ENTROPY=165
ADD_KEY=166
REMOVE_KEY=167
PUSH=168
POP=169
CLEAR=170
HAS=171
GET=172
CONCAT=173
STACK=174
NONZERO=175
INT=176
FLOAT=177
UPPER=178
LOWER=179
TRIM=180
SPLIT=181
JOIN=182
SUBSTRING=183
FIND=184
REPLACE=185
DILATE=186
ERODE=187
MORPH_OPEN=188
MORPH_CLOSE=189
RGB_TO_OKLAB=190
RGB_TO_CIELAB=191
OKLAB_TO_RGB=192
CIELAB_TO_RGB=193
RGB_TO_HSV=194
HSV_TO_RGB=195
INT_TO_RGB=196
RGB_TO_INT=197
INTERPOLATE_LINEAR=198
INTERPOLATE_AREA=199
INTERPOLATE_NEAREST=200
TEXT_IMAGE=201
AS_NESTED=202
SVD=203
DIAG=204
IF=205
ELSE=206
WHILE=207
FOR=208
IN=209
BREAK=210
CONTINUE=211
RETURN=212
TIMESTAMP=213
SORT=214
ARGSORT=215
ARGMIN=216
ARGMAX=217
SOFTMAX=218
SOFTMIN=219
UNIQUE=220
FLIP=221
STARTSWITH=222
ENDSWITH=223
SQUEEZE=224
UNSQUEEZE=225
ROLL=226
COV=227
CORR=228
ENTROPY=229
CROP=230
NONE=231
COORDS=232
GATHER=233
SCATTER=234
SCATTER_ADD=235
NOISE=236
PINK_NOISE=237
BROWN_NOISE=238
RAND=239
CAUCHY=240
EXPONENTIAL=241
LOGNORMAL=242
BERNOULLI=243
POISSON=244
GAMMADIST=245
BETADIST=246
LAPLACEDIST=247
GUMBELDIST=248
WEIBULLDIST=249
CHI2DIST=250
STUDENTTDIST=251
PERLIN=252
CELLULAR=253
PLASMA=254
RIDGED=255
DOMAIN_WARP=256
PLUS=257
MINUS=258
MULT=259
DIV=260
MOD=261
POW=262
LSHIFT=263
RSHIFT=264
GE=265
GT=266
LE=267
LT=268
EQ=269
EQUEALS=270
PLUS_EQ=271
MINUS_EQ=272
MULT_EQ=273
DIV_EQ=274
MOD_EQ=275
NE=276
PIPE=277
LPAREN=278
RPAREN=279
COMMA=280
SEMICOLON=281
ARROW=282
LBRACKET=283
RBRACKET=284
QUESTION=285
COLON=286
LBRACE=287
RBRACE=288
NUMBER=289
CONSTANT=290
STRING=291
VARIABLE=292
SL_COMMENT=293
ML_COMMENT=294
WS=295
'sin'=1
'cos'=2
'tan'=3
@@ -312,202 +314,204 @@ WS=293
'exp'=19
'log1p'=20
'expm1'=21
'cbrt'=22
'reciprocal'=23
'logaddexp'=24
'logsumexp'=25
'norm'=26
'normalize'=27
'group_norm'=28
'outer'=29
'trace'=30
'det'=31
'rfft'=32
'irfft'=33
'isnan'=34
'isinf'=35
'isfinite'=36
'smin'=37
'smax'=38
'tmin'=39
'tmax'=40
'tnorm'=41
'snorm'=42
'floor'=43
'ceil'=44
'round'=45
'gamma'=46
'pow'=47
'sigm'=48
'clamp'=49
'fft'=50
'ifft'=51
'angle'=52
'print'=53
'lerp'=56
'slerp'=57
'step'=58
'smoothstep'=59
'fract'=60
'relu'=61
'softsign'=62
'leaky_relu'=63
'softplus'=64
'gelu'=65
'silu'=66
'sign'=67
'degrees'=68
'radians'=69
'logical_not'=70
'logical_and'=71
'logical_or'=72
'hypot'=73
'map'=74
'swap'=77
'range'=81
'linspace'=82
'logspace'=83
'topk'=84
'botk'=85
'pinv'=86
'inv'=87
'sum'=88
'mean'=89
'std'=90
'var'=91
'prod'=92
'isclose'=93
'allclose'=94
'quantile'=97
'dot'=98
'moment'=99
'erf'=100
'erfinv'=101
'any'=102
'all'=103
'edge'=104
'median'=106
'mode'=107
'cumsum'=108
'cumprod'=109
'smootherstep'=115
'remap'=117
'keys'=120
'repeat'=128
'flatten'=129
'append'=130
'get_value'=131
'flow_apply'=132
'motion_mask'=134
'flow_to_image'=135
'where'=138
'overlay'=140
'pad'=141
'cross'=142
'matmul'=143
'solve'=144
'matrix_rank'=145
'rife'=146
'shape'=149
'tensor'=153
'zeros'=154
'ones'=155
'eye'=156
'one_hot'=157
'mse'=158
'mae'=159
'psnr'=160
'weighted_mean'=161
'huber_loss'=162
'cross_entropy'=163
'add_key'=164
'stack_push'=166
'stack_pop'=167
'stack_clear'=168
'stack_has'=169
'stack_get'=170
'stack'=172
'nonzero'=173
'int'=174
'float'=175
'upper'=176
'lower'=177
'trim'=178
'split'=179
'join'=180
'find'=182
'replace'=183
'dilate'=184
'erode'=185
'morph_open'=186
'morph_close'=187
'rgb_to_oklab'=188
'rgb_to_cielab'=189
'oklab_to_rgb'=190
'cielab_to_rgb'=191
'rgb_to_hsv'=192
'hsv_to_rgb'=193
'int_to_rgb'=194
'rgb_to_int'=195
'interpolate_linear'=196
'interpolate_area'=197
'text_image'=199
'if'=203
'else'=204
'while'=205
'for'=206
'in'=207
'break'=208
'continue'=209
'return'=210
'sort'=212
'argsort'=213
'argmin'=214
'argmax'=215
'softmax'=216
'softmin'=217
'unique'=218
'flip'=219
'startswith'=220
'endswith'=221
'squeeze'=222
'unsqueeze'=223
'roll'=224
'cov'=225
'entropy'=227
'crop'=228
'gather'=231
'scatter'=232
'scatter_add'=233
'+'=255
'-'=256
'*'=257
'/'=258
'%'=259
'^'=260
'<<'=261
'>>'=262
'>='=263
'>'=264
'<='=265
'<'=266
'=='=267
'='=268
'+='=269
'-='=270
'*='=271
'/='=272
'%='=273
'!='=274
'|'=275
'('=276
')'=277
','=278
';'=279
'->'=280
'['=281
']'=282
'?'=283
':'=284
'{'=285
'}'=286
'sinc'=22
'cbrt'=23
'reciprocal'=24
'logaddexp'=25
'logsumexp'=26
'norm'=27
'normalize'=28
'group_norm'=29
'outer'=30
'trace'=31
'det'=32
'rfft'=33
'irfft'=34
'isnan'=35
'isinf'=36
'isfinite'=37
'smin'=38
'smax'=39
'tmin'=40
'tmax'=41
'tnorm'=42
'snorm'=43
'floor'=44
'ceil'=45
'round'=46
'gamma'=47
'pow'=48
'sigm'=49
'clamp'=50
'fft'=51
'ifft'=52
'angle'=53
'print'=54
'lerp'=57
'slerp'=58
'step'=59
'smoothstep'=60
'fract'=61
'relu'=62
'softsign'=63
'leaky_relu'=64
'softplus'=65
'gelu'=66
'silu'=67
'sign'=68
'degrees'=69
'radians'=70
'logical_not'=71
'logical_and'=72
'logical_or'=73
'hypot'=74
'map'=75
'swap'=78
'range'=82
'linspace'=83
'logspace'=84
'topk'=85
'botk'=86
'pinv'=87
'inv'=88
'sum'=89
'mean'=90
'std'=91
'var'=92
'prod'=93
'isclose'=94
'allclose'=95
'quantile'=98
'dot'=99
'moment'=100
'erf'=101
'erfc'=102
'erfinv'=103
'any'=104
'all'=105
'edge'=106
'median'=108
'mode'=109
'cumsum'=110
'cumprod'=111
'smootherstep'=117
'remap'=119
'keys'=122
'repeat'=130
'flatten'=131
'append'=132
'get_value'=133
'flow_apply'=134
'motion_mask'=136
'flow_to_image'=137
'where'=140
'overlay'=142
'pad'=143
'cross'=144
'matmul'=145
'solve'=146
'matrix_rank'=147
'rife'=148
'shape'=151
'tensor'=155
'zeros'=156
'ones'=157
'eye'=158
'one_hot'=159
'mse'=160
'mae'=161
'psnr'=162
'weighted_mean'=163
'huber_loss'=164
'cross_entropy'=165
'add_key'=166
'stack_push'=168
'stack_pop'=169
'stack_clear'=170
'stack_has'=171
'stack_get'=172
'stack'=174
'nonzero'=175
'int'=176
'float'=177
'upper'=178
'lower'=179
'trim'=180
'split'=181
'join'=182
'find'=184
'replace'=185
'dilate'=186
'erode'=187
'morph_open'=188
'morph_close'=189
'rgb_to_oklab'=190
'rgb_to_cielab'=191
'oklab_to_rgb'=192
'cielab_to_rgb'=193
'rgb_to_hsv'=194
'hsv_to_rgb'=195
'int_to_rgb'=196
'rgb_to_int'=197
'interpolate_linear'=198
'interpolate_area'=199
'text_image'=201
'if'=205
'else'=206
'while'=207
'for'=208
'in'=209
'break'=210
'continue'=211
'return'=212
'sort'=214
'argsort'=215
'argmin'=216
'argmax'=217
'softmax'=218
'softmin'=219
'unique'=220
'flip'=221
'startswith'=222
'endswith'=223
'squeeze'=224
'unsqueeze'=225
'roll'=226
'cov'=227
'entropy'=229
'crop'=230
'gather'=233
'scatter'=234
'scatter_add'=235
'+'=257
'-'=258
'*'=259
'/'=260
'%'=261
'^'=262
'<<'=263
'>>'=264
'>='=265
'>'=266
'<='=267
'<'=268
'=='=269
'='=270
'+='=271
'-='=272
'*='=273
'/='=274
'%='=275
'!='=276
'|'=277
'('=278
')'=279
','=280
';'=281
'->'=282
'['=283
']'=284
'?'=285
':'=286
'{'=287
'}'=288
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+475 -471
View File
@@ -19,278 +19,280 @@ LOG2=18
EXP=19
LOG1P=20
EXPM1=21
CBRT=22
RECIPROCAL=23
LOGADDEXP=24
LOGSUMEXP=25
NORM=26
NORMALIZE=27
GROUP_NORM=28
OUTER=29
TRACE=30
DET=31
RFFT=32
IRFFT=33
ISNAN=34
ISINF=35
ISFINITE=36
SMIN=37
SMAX=38
TMIN=39
TMAX=40
TNORM=41
SNORM=42
FLOOR=43
CEIL=44
ROUND=45
GAMMA=46
POWE=47
SIGM=48
CLAMP=49
SFFT=50
SIFFT=51
ANGL=52
PRNT=53
PRINT_SHAPE=54
NVL=55
LERP=56
SLERP=57
STEP=58
SMOOTHSTEP=59
FRACT=60
RELU=61
SOFTSIGN=62
LEAKY_RELU=63
SOFTPLUS=64
GELU=65
SILU=66
SIGN=67
DEGREES=68
RADIANS=69
LOGICAL_NOT=70
LOGICAL_AND=71
LOGICAL_OR=72
HYPOT=73
MAP=74
EZCONV=75
CONV=76
SWAP=77
TRANSPOSE=78
PERM=79
RESHAPE=80
RANGE=81
LINSPACE=82
LOGSPACE=83
TOPK=84
BOTK=85
PINV=86
INV=87
SUM=88
MEAN=89
STD=90
VAR=91
PROD=92
ISCLOSE=93
ALLCLOSE=94
QUARTILE=95
PERCENTILE=96
QUANTILE=97
DOT=98
MOMENT=99
ERF=100
ERFINV=101
ANY=102
ALL=103
EDGE=104
GAUSSIAN=105
MEDIAN=106
MODE=107
CUMSUM=108
CUMPROD=109
TOPK_IND=110
BOTK_IND=111
CUBIC_EASE=112
ELASTIC_EASE=113
SINE_EASE=114
SMOOTHERSTEP=115
DIST=116
REMAP=117
COSSIM=118
COUNT=119
KEYS=120
ENABLE_TRACKING=121
DISABLE_TRACKING=122
RESET_TRACKING=123
GET_CHANGED_KEYS=124
GET_ADDED_KEYS=125
GET_REMOVED_KEYS=126
GET_UNCHANGED_KEYS=127
REPEAT=128
FLATTEN=129
APPEND=130
GET_VALUE=131
FLOW_APPLY=132
BATCH_SHUFFLE=133
MOTION_MASK=134
FLOW_TO_IMAGE=135
FLOW_MAG=136
FLOW_ANG=137
WHERE=138
HISTOGRAM=139
OVERLAY=140
PAD=141
CROSS=142
MATMUL=143
SOLVE=144
MATRIX_RANK=145
RIFE=146
BNOT=147
BITCOUNT=148
SHAPE=149
BAND=150
XOR=151
BOR=152
TENSOR=153
ZEROS=154
ONES=155
EYE=156
ONE_HOT=157
MSE=158
MAE=159
PSNR=160
WEIGHTED_MEAN=161
HUBER_LOSS=162
CROSS_ENTROPY=163
ADD_KEY=164
REMOVE_KEY=165
PUSH=166
POP=167
CLEAR=168
HAS=169
GET=170
CONCAT=171
STACK=172
NONZERO=173
INT=174
FLOAT=175
UPPER=176
LOWER=177
TRIM=178
SPLIT=179
JOIN=180
SUBSTRING=181
FIND=182
REPLACE=183
DILATE=184
ERODE=185
MORPH_OPEN=186
MORPH_CLOSE=187
RGB_TO_OKLAB=188
RGB_TO_CIELAB=189
OKLAB_TO_RGB=190
CIELAB_TO_RGB=191
RGB_TO_HSV=192
HSV_TO_RGB=193
INT_TO_RGB=194
RGB_TO_INT=195
INTERPOLATE_LINEAR=196
INTERPOLATE_AREA=197
INTERPOLATE_NEAREST=198
TEXT_IMAGE=199
AS_NESTED=200
SVD=201
DIAG=202
IF=203
ELSE=204
WHILE=205
FOR=206
IN=207
BREAK=208
CONTINUE=209
RETURN=210
TIMESTAMP=211
SORT=212
ARGSORT=213
ARGMIN=214
ARGMAX=215
SOFTMAX=216
SOFTMIN=217
UNIQUE=218
FLIP=219
STARTSWITH=220
ENDSWITH=221
SQUEEZE=222
UNSQUEEZE=223
ROLL=224
COV=225
CORR=226
ENTROPY=227
CROP=228
NONE=229
COORDS=230
GATHER=231
SCATTER=232
SCATTER_ADD=233
NOISE=234
PINK_NOISE=235
BROWN_NOISE=236
RAND=237
CAUCHY=238
EXPONENTIAL=239
LOGNORMAL=240
BERNOULLI=241
POISSON=242
GAMMADIST=243
BETADIST=244
LAPLACEDIST=245
GUMBELDIST=246
WEIBULLDIST=247
CHI2DIST=248
STUDENTTDIST=249
PERLIN=250
CELLULAR=251
PLASMA=252
RIDGED=253
DOMAIN_WARP=254
PLUS=255
MINUS=256
MULT=257
DIV=258
MOD=259
POW=260
LSHIFT=261
RSHIFT=262
GE=263
GT=264
LE=265
LT=266
EQ=267
EQUEALS=268
PLUS_EQ=269
MINUS_EQ=270
MULT_EQ=271
DIV_EQ=272
MOD_EQ=273
NE=274
PIPE=275
LPAREN=276
RPAREN=277
COMMA=278
SEMICOLON=279
ARROW=280
LBRACKET=281
RBRACKET=282
QUESTION=283
COLON=284
LBRACE=285
RBRACE=286
NUMBER=287
CONSTANT=288
STRING=289
VARIABLE=290
SL_COMMENT=291
ML_COMMENT=292
WS=293
SINC=22
CBRT=23
RECIPROCAL=24
LOGADDEXP=25
LOGSUMEXP=26
NORM=27
NORMALIZE=28
GROUP_NORM=29
OUTER=30
TRACE=31
DET=32
RFFT=33
IRFFT=34
ISNAN=35
ISINF=36
ISFINITE=37
SMIN=38
SMAX=39
TMIN=40
TMAX=41
TNORM=42
SNORM=43
FLOOR=44
CEIL=45
ROUND=46
GAMMA=47
POWE=48
SIGM=49
CLAMP=50
SFFT=51
SIFFT=52
ANGL=53
PRNT=54
PRINT_SHAPE=55
NVL=56
LERP=57
SLERP=58
STEP=59
SMOOTHSTEP=60
FRACT=61
RELU=62
SOFTSIGN=63
LEAKY_RELU=64
SOFTPLUS=65
GELU=66
SILU=67
SIGN=68
DEGREES=69
RADIANS=70
LOGICAL_NOT=71
LOGICAL_AND=72
LOGICAL_OR=73
HYPOT=74
MAP=75
EZCONV=76
CONV=77
SWAP=78
TRANSPOSE=79
PERM=80
RESHAPE=81
RANGE=82
LINSPACE=83
LOGSPACE=84
TOPK=85
BOTK=86
PINV=87
INV=88
SUM=89
MEAN=90
STD=91
VAR=92
PROD=93
ISCLOSE=94
ALLCLOSE=95
QUARTILE=96
PERCENTILE=97
QUANTILE=98
DOT=99
MOMENT=100
ERF=101
ERFC=102
ERFINV=103
ANY=104
ALL=105
EDGE=106
GAUSSIAN=107
MEDIAN=108
MODE=109
CUMSUM=110
CUMPROD=111
TOPK_IND=112
BOTK_IND=113
CUBIC_EASE=114
ELASTIC_EASE=115
SINE_EASE=116
SMOOTHERSTEP=117
DIST=118
REMAP=119
COSSIM=120
COUNT=121
KEYS=122
ENABLE_TRACKING=123
DISABLE_TRACKING=124
RESET_TRACKING=125
GET_CHANGED_KEYS=126
GET_ADDED_KEYS=127
GET_REMOVED_KEYS=128
GET_UNCHANGED_KEYS=129
REPEAT=130
FLATTEN=131
APPEND=132
GET_VALUE=133
FLOW_APPLY=134
BATCH_SHUFFLE=135
MOTION_MASK=136
FLOW_TO_IMAGE=137
FLOW_MAG=138
FLOW_ANG=139
WHERE=140
HISTOGRAM=141
OVERLAY=142
PAD=143
CROSS=144
MATMUL=145
SOLVE=146
MATRIX_RANK=147
RIFE=148
BNOT=149
BITCOUNT=150
SHAPE=151
BAND=152
XOR=153
BOR=154
TENSOR=155
ZEROS=156
ONES=157
EYE=158
ONE_HOT=159
MSE=160
MAE=161
PSNR=162
WEIGHTED_MEAN=163
HUBER_LOSS=164
CROSS_ENTROPY=165
ADD_KEY=166
REMOVE_KEY=167
PUSH=168
POP=169
CLEAR=170
HAS=171
GET=172
CONCAT=173
STACK=174
NONZERO=175
INT=176
FLOAT=177
UPPER=178
LOWER=179
TRIM=180
SPLIT=181
JOIN=182
SUBSTRING=183
FIND=184
REPLACE=185
DILATE=186
ERODE=187
MORPH_OPEN=188
MORPH_CLOSE=189
RGB_TO_OKLAB=190
RGB_TO_CIELAB=191
OKLAB_TO_RGB=192
CIELAB_TO_RGB=193
RGB_TO_HSV=194
HSV_TO_RGB=195
INT_TO_RGB=196
RGB_TO_INT=197
INTERPOLATE_LINEAR=198
INTERPOLATE_AREA=199
INTERPOLATE_NEAREST=200
TEXT_IMAGE=201
AS_NESTED=202
SVD=203
DIAG=204
IF=205
ELSE=206
WHILE=207
FOR=208
IN=209
BREAK=210
CONTINUE=211
RETURN=212
TIMESTAMP=213
SORT=214
ARGSORT=215
ARGMIN=216
ARGMAX=217
SOFTMAX=218
SOFTMIN=219
UNIQUE=220
FLIP=221
STARTSWITH=222
ENDSWITH=223
SQUEEZE=224
UNSQUEEZE=225
ROLL=226
COV=227
CORR=228
ENTROPY=229
CROP=230
NONE=231
COORDS=232
GATHER=233
SCATTER=234
SCATTER_ADD=235
NOISE=236
PINK_NOISE=237
BROWN_NOISE=238
RAND=239
CAUCHY=240
EXPONENTIAL=241
LOGNORMAL=242
BERNOULLI=243
POISSON=244
GAMMADIST=245
BETADIST=246
LAPLACEDIST=247
GUMBELDIST=248
WEIBULLDIST=249
CHI2DIST=250
STUDENTTDIST=251
PERLIN=252
CELLULAR=253
PLASMA=254
RIDGED=255
DOMAIN_WARP=256
PLUS=257
MINUS=258
MULT=259
DIV=260
MOD=261
POW=262
LSHIFT=263
RSHIFT=264
GE=265
GT=266
LE=267
LT=268
EQ=269
EQUEALS=270
PLUS_EQ=271
MINUS_EQ=272
MULT_EQ=273
DIV_EQ=274
MOD_EQ=275
NE=276
PIPE=277
LPAREN=278
RPAREN=279
COMMA=280
SEMICOLON=281
ARROW=282
LBRACKET=283
RBRACKET=284
QUESTION=285
COLON=286
LBRACE=287
RBRACE=288
NUMBER=289
CONSTANT=290
STRING=291
VARIABLE=292
SL_COMMENT=293
ML_COMMENT=294
WS=295
'sin'=1
'cos'=2
'tan'=3
@@ -312,202 +314,204 @@ WS=293
'exp'=19
'log1p'=20
'expm1'=21
'cbrt'=22
'reciprocal'=23
'logaddexp'=24
'logsumexp'=25
'norm'=26
'normalize'=27
'group_norm'=28
'outer'=29
'trace'=30
'det'=31
'rfft'=32
'irfft'=33
'isnan'=34
'isinf'=35
'isfinite'=36
'smin'=37
'smax'=38
'tmin'=39
'tmax'=40
'tnorm'=41
'snorm'=42
'floor'=43
'ceil'=44
'round'=45
'gamma'=46
'pow'=47
'sigm'=48
'clamp'=49
'fft'=50
'ifft'=51
'angle'=52
'print'=53
'lerp'=56
'slerp'=57
'step'=58
'smoothstep'=59
'fract'=60
'relu'=61
'softsign'=62
'leaky_relu'=63
'softplus'=64
'gelu'=65
'silu'=66
'sign'=67
'degrees'=68
'radians'=69
'logical_not'=70
'logical_and'=71
'logical_or'=72
'hypot'=73
'map'=74
'swap'=77
'range'=81
'linspace'=82
'logspace'=83
'topk'=84
'botk'=85
'pinv'=86
'inv'=87
'sum'=88
'mean'=89
'std'=90
'var'=91
'prod'=92
'isclose'=93
'allclose'=94
'quantile'=97
'dot'=98
'moment'=99
'erf'=100
'erfinv'=101
'any'=102
'all'=103
'edge'=104
'median'=106
'mode'=107
'cumsum'=108
'cumprod'=109
'smootherstep'=115
'remap'=117
'keys'=120
'repeat'=128
'flatten'=129
'append'=130
'get_value'=131
'flow_apply'=132
'motion_mask'=134
'flow_to_image'=135
'where'=138
'overlay'=140
'pad'=141
'cross'=142
'matmul'=143
'solve'=144
'matrix_rank'=145
'rife'=146
'shape'=149
'tensor'=153
'zeros'=154
'ones'=155
'eye'=156
'one_hot'=157
'mse'=158
'mae'=159
'psnr'=160
'weighted_mean'=161
'huber_loss'=162
'cross_entropy'=163
'add_key'=164
'stack_push'=166
'stack_pop'=167
'stack_clear'=168
'stack_has'=169
'stack_get'=170
'stack'=172
'nonzero'=173
'int'=174
'float'=175
'upper'=176
'lower'=177
'trim'=178
'split'=179
'join'=180
'find'=182
'replace'=183
'dilate'=184
'erode'=185
'morph_open'=186
'morph_close'=187
'rgb_to_oklab'=188
'rgb_to_cielab'=189
'oklab_to_rgb'=190
'cielab_to_rgb'=191
'rgb_to_hsv'=192
'hsv_to_rgb'=193
'int_to_rgb'=194
'rgb_to_int'=195
'interpolate_linear'=196
'interpolate_area'=197
'text_image'=199
'if'=203
'else'=204
'while'=205
'for'=206
'in'=207
'break'=208
'continue'=209
'return'=210
'sort'=212
'argsort'=213
'argmin'=214
'argmax'=215
'softmax'=216
'softmin'=217
'unique'=218
'flip'=219
'startswith'=220
'endswith'=221
'squeeze'=222
'unsqueeze'=223
'roll'=224
'cov'=225
'entropy'=227
'crop'=228
'gather'=231
'scatter'=232
'scatter_add'=233
'+'=255
'-'=256
'*'=257
'/'=258
'%'=259
'^'=260
'<<'=261
'>>'=262
'>='=263
'>'=264
'<='=265
'<'=266
'=='=267
'='=268
'+='=269
'-='=270
'*='=271
'/='=272
'%='=273
'!='=274
'|'=275
'('=276
')'=277
','=278
';'=279
'->'=280
'['=281
']'=282
'?'=283
':'=284
'{'=285
'}'=286
'sinc'=22
'cbrt'=23
'reciprocal'=24
'logaddexp'=25
'logsumexp'=26
'norm'=27
'normalize'=28
'group_norm'=29
'outer'=30
'trace'=31
'det'=32
'rfft'=33
'irfft'=34
'isnan'=35
'isinf'=36
'isfinite'=37
'smin'=38
'smax'=39
'tmin'=40
'tmax'=41
'tnorm'=42
'snorm'=43
'floor'=44
'ceil'=45
'round'=46
'gamma'=47
'pow'=48
'sigm'=49
'clamp'=50
'fft'=51
'ifft'=52
'angle'=53
'print'=54
'lerp'=57
'slerp'=58
'step'=59
'smoothstep'=60
'fract'=61
'relu'=62
'softsign'=63
'leaky_relu'=64
'softplus'=65
'gelu'=66
'silu'=67
'sign'=68
'degrees'=69
'radians'=70
'logical_not'=71
'logical_and'=72
'logical_or'=73
'hypot'=74
'map'=75
'swap'=78
'range'=82
'linspace'=83
'logspace'=84
'topk'=85
'botk'=86
'pinv'=87
'inv'=88
'sum'=89
'mean'=90
'std'=91
'var'=92
'prod'=93
'isclose'=94
'allclose'=95
'quantile'=98
'dot'=99
'moment'=100
'erf'=101
'erfc'=102
'erfinv'=103
'any'=104
'all'=105
'edge'=106
'median'=108
'mode'=109
'cumsum'=110
'cumprod'=111
'smootherstep'=117
'remap'=119
'keys'=122
'repeat'=130
'flatten'=131
'append'=132
'get_value'=133
'flow_apply'=134
'motion_mask'=136
'flow_to_image'=137
'where'=140
'overlay'=142
'pad'=143
'cross'=144
'matmul'=145
'solve'=146
'matrix_rank'=147
'rife'=148
'shape'=151
'tensor'=155
'zeros'=156
'ones'=157
'eye'=158
'one_hot'=159
'mse'=160
'mae'=161
'psnr'=162
'weighted_mean'=163
'huber_loss'=164
'cross_entropy'=165
'add_key'=166
'stack_push'=168
'stack_pop'=169
'stack_clear'=170
'stack_has'=171
'stack_get'=172
'stack'=174
'nonzero'=175
'int'=176
'float'=177
'upper'=178
'lower'=179
'trim'=180
'split'=181
'join'=182
'find'=184
'replace'=185
'dilate'=186
'erode'=187
'morph_open'=188
'morph_close'=189
'rgb_to_oklab'=190
'rgb_to_cielab'=191
'oklab_to_rgb'=192
'cielab_to_rgb'=193
'rgb_to_hsv'=194
'hsv_to_rgb'=195
'int_to_rgb'=196
'rgb_to_int'=197
'interpolate_linear'=198
'interpolate_area'=199
'text_image'=201
'if'=205
'else'=206
'while'=207
'for'=208
'in'=209
'break'=210
'continue'=211
'return'=212
'sort'=214
'argsort'=215
'argmin'=216
'argmax'=217
'softmax'=218
'softmin'=219
'unique'=220
'flip'=221
'startswith'=222
'endswith'=223
'squeeze'=224
'unsqueeze'=225
'roll'=226
'cov'=227
'entropy'=229
'crop'=230
'gather'=233
'scatter'=234
'scatter_add'=235
'+'=257
'-'=258
'*'=259
'/'=260
'%'=261
'^'=262
'<<'=263
'>>'=264
'>='=265
'>'=266
'<='=267
'<'=268
'=='=269
'='=270
'+='=271
'-='=272
'*='=273
'/='=274
'%='=275
'!='=276
'|'=277
'('=278
')'=279
','=280
';'=281
'->'=282
'['=283
']'=284
'?'=285
':'=286
'{'=287
'}'=288
@@ -917,6 +917,15 @@ class MathExprListener(ParseTreeListener):
pass
# Enter a parse tree produced by MathExprParser#SincFunc.
def enterSincFunc(self, ctx:MathExprParser.SincFuncContext):
pass
# Exit a parse tree produced by MathExprParser#SincFunc.
def exitSincFunc(self, ctx:MathExprParser.SincFuncContext):
pass
# Enter a parse tree produced by MathExprParser#CbrtFunc.
def enterCbrtFunc(self, ctx:MathExprParser.CbrtFuncContext):
pass
@@ -1421,6 +1430,15 @@ class MathExprListener(ParseTreeListener):
pass
# Enter a parse tree produced by MathExprParser#ErfcFunc.
def enterErfcFunc(self, ctx:MathExprParser.ErfcFuncContext):
pass
# Exit a parse tree produced by MathExprParser#ErfcFunc.
def exitErfcFunc(self, ctx:MathExprParser.ErfcFuncContext):
pass
# Enter a parse tree produced by MathExprParser#ErfinvFunc.
def enterErfinvFunc(self, ctx:MathExprParser.ErfinvFuncContext):
pass
File diff suppressed because one or more lines are too long
@@ -514,6 +514,11 @@ class MathExprVisitor(ParseTreeVisitor):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#SincFunc.
def visitSincFunc(self, ctx:MathExprParser.SincFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#CbrtFunc.
def visitCbrtFunc(self, ctx:MathExprParser.CbrtFuncContext):
return self.visitChildren(ctx)
@@ -794,6 +799,11 @@ class MathExprVisitor(ParseTreeVisitor):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#ErfcFunc.
def visitErfcFunc(self, ctx:MathExprParser.ErfcFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#ErfinvFunc.
def visitErfinvFunc(self, ctx:MathExprParser.ErfinvFuncContext):
return self.visitChildren(ctx)
+38 -3
View File
@@ -7,8 +7,10 @@ import pytest
# Ensure test runner usage (Visual Studio) can import the package regardless of working dir.
_here = os.path.abspath(os.path.dirname(__file__))
_project_root = os.path.abspath(os.path.join(_here, os.pardir))
if _project_root not in sys.path:
sys.path.insert(0, _project_root)
_comfy_root = os.path.abspath(os.path.join(_project_root, os.pardir, os.pardir))
for _path in (_comfy_root, _project_root):
if _path not in sys.path:
sys.path.insert(0, _path)
from more_math.Parser.UnifiedMathVisitor import UnifiedMathVisitor
from more_math.Parser.inbuilt_symbols import INBUILT_FUNCTIONS
@@ -210,10 +212,17 @@ def test_slerp_interpolates_direction_and_magnitude():
batch_a = torch.tensor([[1.0, 0.0], [2.0, 0.0]])
batch_b = torch.tensor([[0.0, 1.0], [0.0, 2.0]])
torch.testing.assert_close(
eval_expr("slerp(a, b, t)", {"a": batch_a, "b": batch_b, "t": torch.tensor([0.0, 1.0])}),
eval_expr("slerp(a, b, t, 1)", {"a": batch_a, "b": batch_b, "t": torch.tensor([0.0, 1.0])}),
torch.tensor([[1.0, 0.0], [0.0, 2.0]]),
)
whole_a = torch.tensor([[1.0, 0.0], [0.0, 0.0]])
whole_b = torch.tensor([[0.0, 0.0], [0.0, 1.0]])
torch.testing.assert_close(
eval_expr("slerp(a, b, 0.5)", {"a": whole_a, "b": whole_b}),
torch.tensor([[1.0 / math.sqrt(2.0), 0.0], [0.0, 1.0 / math.sqrt(2.0)]]),
)
a_by_column = torch.tensor([[1.0, 0.0], [0.0, 1.0]])
b_by_column = torch.tensor([[0.0, 2.0], [2.0, 0.0]])
torch.testing.assert_close(
@@ -242,10 +251,36 @@ def test_slerp_validates_broadcasting_and_preserves_float8_dtype():
result = eval_expr("slerp(a, b, 0.5)", {"a": values, "b": values})
assert result.dtype == dtype
def test_sinc_and_erfc():
assert {"sinc", "erfc"} <= INBUILT_FUNCTIONS
assert eval_expr("sinc(0)") == 1.0
assert abs(eval_expr("sinc(0.5)") - 2.0 / math.pi) < 1e-6
assert abs(eval_expr("sinc(1)")) < 1e-6
assert eval_expr("erfc(0)") == 1.0
assert math.isclose(eval_expr("erfc(1)"), math.erfc(1), rel_tol=1e-6)
torch.testing.assert_close(
eval_expr("sinc(x)", {"x": torch.tensor([0.0, 0.5, 1.0])}),
torch.sinc(torch.tensor([0.0, 0.5, 1.0])),
)
torch.testing.assert_close(
eval_expr("erfc(x)", {"x": torch.tensor([-1.0, 0.0, 1.0])}),
torch.special.erfc(torch.tensor([-1.0, 0.0, 1.0])),
)
assert eval_expr("sinc([0, 0.5])") == [1.0, 2.0 / math.pi]
float8_dtypes = [
getattr(torch, name, None)
for name in ("float8_e4m3fn", "float8_e4m3fnuz", "float8_e5m2", "float8_e5m2fnuz")
]
for dtype in (dtype for dtype in float8_dtypes if dtype is not None):
values = torch.tensor([0.0, 0.5, 1.0]).to(dtype)
assert eval_expr("sinc(x)", {"x": values}).dtype == dtype
assert eval_expr("erfc(x)", {"x": values}).dtype == dtype
if __name__ == "__main__":
test_logic_functions()
test_spatial_functions()
test_stats_functions()
test_easing_functions()
test_lerp_fix()
test_sinc_and_erfc()
print("All new function tests passed!")
+4 -2
View File
@@ -9,7 +9,7 @@ export const CONSTANTS = new Set([
]);
export const FUNCTIONS = new Set([
"abs", "acos", "acosh", "add_key", "added_keys", "all", "allclose", "angle", "any", "append", "argmax", "argmin", "argsort", "as_nested", "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", "brown", "brown_noise", "bxor", "cat", "cbrt", "ceil", "cellular", "cellular_noise", "cielab_to_rgb", "clamp", "cnt", "concat", "concatenate", "conv", "convolution", "coordinates", "coords", "corr", "correlation", "cos", "cosh", "cosine_similarity", "cossim", "count", "cov", "crop", "cross", "cross_entropy", "cubic", "cubic_ease", "cumprod", "cumsum", "degrees", "det", "diag", "diagonal_matrix", "dilate", "disable_tracking", "dist", "distance", "domain_warp", "domain_warp_noise", "dot", "edge", "elastic", "elastic_ease", "enable_tracking", "endswith", "entropy", "erf", "erfinv", "erode", "exp", "expm1", "eye", "ezconv", "ezconvolution", "fft", "find", "flatten", "flip", "float", "floor", "flow_ang", "flow_angle", "flow_apply", "flow_mag", "flow_magnitude", "flow_to_image", "fract", "gamma", "gather", "gaussian", "gelu", "get_added_keys", "get_changed_keys", "get_removed_keys", "get_unchanged_keys", "get_value", "group_norm", "hist", "histogram", "hsv_to_rgb", "huber_loss", "hypot", "changed_keys", "ifft", "int", "int_to_rgb", "interpolate_area", "interpolate_linear", "interpolate_nearest", "interpolate_nearest_exact", "inv", "irfft", "isclose", "isfinite", "isinf", "isnan", "join", "keys", "leaky_relu", "length", "lerp", "linspace", "ln", "log", "log1p", "log2", "logaddexp", "logical_and", "logical_not", "logical_or", "logspace", "logsumexp", "lower", "mae", "map", "matmul", "matrix_rank", "mean", "median", "mode", "moment", "morph_close", "morph_open", "motion_mask", "mse", "nan_to_num", "noise", "nonzero", "norm", "normalize", "now", "nvl", "oklab_to_rgb", "one_hot", "ones", "outer", "overlay", "pad", "percentile", "perlin", "perlin_noise", "perm", "permute", "pink", "pink_noise", "pinv", "plasma", "plasma_noise", "popcnt", "popcount", "pow", "prcnt", "print", "print_shape", "prod", "pshp", "psnr", "quantile", "quartil", "quartile", "radians", "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", "reciprocal", "relu", "remap", "remove_key", "removed_keys", "repeat", "replace", "reset_tracking", "reshape", "rfft", "rgb_to_cielab", "rgb_to_hsv", "rgb_to_int", "rgb_to_oklab", "ridged", "ridged_noise", "rife", "rm_key", "roll", "round", "rshp", "scatter", "scatter_add", "select", "shape", "shuffle", "sigm", "sign", "silu", "sin", "sine", "sine_ease", "singular_value_decomposition", "sinh", "slerp", "smax", "smin", "smootherstep", "smoothstep", "snorm", "softmax", "softmin", "softplus", "softsign", "solve", "sort", "split", "sqrt", "squeeze", "stack", "stack_clear", "stack_get", "stack_has", "stack_pop", "stack_push", "startswith", "std", "step", "substr", "substring", "sum", "svd", "swap", "swapaxes", "tan", "tanh", "tensor", "text_image", "timestamp", "tmax", "tmin", "tnorm", "topk", "topk_ind", "topk_indices", "trace", "track_off", "track_on", "track_reset", "transpose", "trim", "turbulence", "unchanged_keys", "unique", "unsqueeze", "upper", "var", "voronoi", "voronoi_noise", "weighted_mean", "where", "worley", "zeros"
"abs", "acos", "acosh", "add_key", "added_keys", "all", "allclose", "angle", "any", "append", "argmax", "argmin", "argsort", "as_nested", "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", "brown", "brown_noise", "bxor", "cat", "cbrt", "ceil", "cellular", "cellular_noise", "cielab_to_rgb", "clamp", "cnt", "concat", "concatenate", "conv", "convolution", "coordinates", "coords", "corr", "correlation", "cos", "cosh", "cosine_similarity", "cossim", "count", "cov", "crop", "cross", "cross_entropy", "cubic", "cubic_ease", "cumprod", "cumsum", "degrees", "det", "diag", "diagonal_matrix", "dilate", "disable_tracking", "dist", "distance", "domain_warp", "domain_warp_noise", "dot", "edge", "elastic", "elastic_ease", "enable_tracking", "endswith", "entropy", "erf", "erfc", "erfinv", "erode", "exp", "expm1", "eye", "ezconv", "ezconvolution", "fft", "find", "flatten", "flip", "float", "floor", "flow_ang", "flow_angle", "flow_apply", "flow_mag", "flow_magnitude", "flow_to_image", "fract", "gamma", "gather", "gaussian", "gelu", "get_added_keys", "get_changed_keys", "get_removed_keys", "get_unchanged_keys", "get_value", "group_norm", "hist", "histogram", "hsv_to_rgb", "huber_loss", "hypot", "changed_keys", "ifft", "int", "int_to_rgb", "interpolate_area", "interpolate_linear", "interpolate_nearest", "interpolate_nearest_exact", "inv", "irfft", "isclose", "isfinite", "isinf", "isnan", "join", "keys", "leaky_relu", "length", "lerp", "linspace", "ln", "log", "log1p", "log2", "logaddexp", "logical_and", "logical_not", "logical_or", "logspace", "logsumexp", "lower", "mae", "map", "matmul", "matrix_rank", "mean", "median", "mode", "moment", "morph_close", "morph_open", "motion_mask", "mse", "nan_to_num", "noise", "nonzero", "norm", "normalize", "now", "nvl", "oklab_to_rgb", "one_hot", "ones", "outer", "overlay", "pad", "percentile", "perlin", "perlin_noise", "perm", "permute", "pink", "pink_noise", "pinv", "plasma", "plasma_noise", "popcnt", "popcount", "pow", "prcnt", "print", "print_shape", "prod", "pshp", "psnr", "quantile", "quartil", "quartile", "radians", "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", "reciprocal", "relu", "remap", "remove_key", "removed_keys", "repeat", "replace", "reset_tracking", "reshape", "rfft", "rgb_to_cielab", "rgb_to_hsv", "rgb_to_int", "rgb_to_oklab", "ridged", "ridged_noise", "rife", "rm_key", "roll", "round", "rshp", "scatter", "scatter_add", "select", "shape", "shuffle", "sigm", "sign", "silu", "sin", "sinc", "sine", "sine_ease", "singular_value_decomposition", "sinh", "slerp", "smax", "smin", "smootherstep", "smoothstep", "snorm", "softmax", "softmin", "softplus", "softsign", "solve", "sort", "split", "sqrt", "squeeze", "stack", "stack_clear", "stack_get", "stack_has", "stack_pop", "stack_push", "startswith", "std", "step", "substr", "substring", "sum", "svd", "swap", "swapaxes", "tan", "tanh", "tensor", "text_image", "timestamp", "tmax", "tmin", "tnorm", "topk", "topk_ind", "topk_indices", "trace", "track_off", "track_on", "track_reset", "transpose", "trim", "turbulence", "unchanged_keys", "unique", "unsqueeze", "upper", "var", "voronoi", "voronoi_noise", "weighted_mean", "where", "worley", "zeros"
]);
export const FUNCTION_META = {
@@ -34,6 +34,7 @@ export const FUNCTION_META = {
"exp": { minArgs: 1, maxArgs: 1, snippet: "exp(x)", description: "applies e^x to value (per element)" },
"log1p": { minArgs: 1, maxArgs: 1, snippet: "log1p(x)", description: "applies ln(1+x) accurately for values near zero" },
"expm1": { minArgs: 1, maxArgs: 1, snippet: "expm1(x)", description: "applies exp(x)-1 accurately for values near zero" },
"sinc": { minArgs: 1, maxArgs: 1, snippet: "sinc(x)", description: "computes the normalized sinc function sin(pi*x)/(pi*x), with sinc(0)=1" },
"cbrt": { minArgs: 1, maxArgs: 1, snippet: "cbrt(x)", description: "computes the real cube root of each value, including negative values" },
"reciprocal": { minArgs: 1, maxArgs: 1, snippet: "reciprocal(x)", description: "computes 1/x element-wise" },
"logaddexp": { minArgs: 2, maxArgs: 2, snippet: "logaddexp(x, y)", description: "computes log(exp(x) + exp(y)) element-wise using a numerically stable method" },
@@ -71,7 +72,7 @@ export const FUNCTION_META = {
"nvl": { minArgs: 4, maxArgs: 4, snippet: "nvl(x, nan, pos_inf, neg_inf)", description: "null value replacement - inspired by NVL" },
"nan_to_num": { minArgs: 4, maxArgs: 4, snippet: "nan_to_num(x, nan, pos_inf, neg_inf)", description: "null value replacement - inspired by NVL" },
"lerp": { minArgs: 3, maxArgs: 3, snippet: "lerp(a, b, t)", description: "linear interpolation between a and b by t per element. t can be float or tensor." },
"slerp": { minArgs: 3, maxArgs: 4, snippet: "slerp(a, b, t, dim)", description: "interpolates vector directions spherically and magnitudes linearly. dim selects the vector-component axis; other axes identify independent vectors. Defaults to the last dimension." },
"slerp": { minArgs: 3, maxArgs: 4, snippet: "slerp(a, b, t, dim)", description: "interpolates vector directions spherically and magnitudes linearly. Without dim, all elements form one vector; dim selects a vector-component axis and other axes identify independent vectors." },
"step": { minArgs: 2, maxArgs: 2, snippet: "step(x, edge)", description: "returns 0 if x < edge, else 1" },
"smoothstep": { minArgs: 3, maxArgs: 3, snippet: "smoothstep(x, edge0, edge1)", description: "smooth interpolation between edge0 and edge1" },
"fract": { minArgs: 1, maxArgs: 1, snippet: "fract(x)", description: "returns the fractional part of x: x - floor(x)" },
@@ -122,6 +123,7 @@ export const FUNCTION_META = {
"dot": { minArgs: 2, maxArgs: 2, snippet: "dot(x, y)", description: "computes the dot product of x and y after flattening both to 1D. Use cross(x, y) if you need a per-vector product with the last dimension kept." },
"moment": { minArgs: 3, maxArgs: 3, snippet: "moment(x, a, k)", description: "computes the k-th moment of x around a" },
"erf": { minArgs: 1, maxArgs: 1, snippet: "erf(x)", description: "computes the error function (torch.erf)" },
"erfc": { minArgs: 1, maxArgs: 1, snippet: "erfc(x)", description: "computes the complementary error function (torch.special.erfc)" },
"erfinv": { minArgs: 1, maxArgs: 1, snippet: "erfinv(x)", description: "computes the inverse error function (torch.erfinv)" },
"any": { minArgs: 1, maxArgs: 1, snippet: "any(x)", description: "returns 1 if any element of x is non-zero otherwise 0" },
"all": { minArgs: 1, maxArgs: 1, snippet: "all(x)", description: "returns 1 if all elements of x are non-zero otherwise 0" },