AI: add spherical lerp

This commit is contained in:
mcDandy
2026-10-14 13:52:11 +02:00
parent 36d12fcb8d
commit 28fe274826
22 changed files with 8696 additions and 8367 deletions
+1
View File
@@ -169,6 +169,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.
- `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.
+5
View File
@@ -972,6 +972,10 @@ funcN:
norm(x, [p], [dims]) - computes the p-norm globally or along one or more dimensions (default p=2)
*/
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 LPAREN expr COMMA expr COMMA expr (COMMA expr)? RPAREN # SlerpFunc
/**
normalize(x, [p], [dim], [eps]) - normalizes x along dim using the p-norm (defaults: p=2, dim=-1, eps=1e-12)
*/
@@ -1185,6 +1189,7 @@ PRNT: 'print';
PRINT_SHAPE: 'print_shape' | 'pshp';
NVL: 'nvl' | 'nan_to_num';
LERP: 'lerp';
SLERP: 'slerp';
STEP: 'step';
SMOOTHSTEP: 'smoothstep';
FRACT: 'fract';
+68
View File
@@ -1566,6 +1566,74 @@ class UnifiedMathVisitor(MathExprVisitor):
return self._lerp_helper(a, b, w)
def visitSlerpFunc(self, ctx):
a = self._promote_to_tensor((yield ctx.expr(0)))
b = self._promote_to_tensor((yield ctx.expr(1)))
t = self._promote_to_tensor((yield ctx.expr(2)))
if a.ndim == 0 or b.ndim == 0:
raise ValueError(f"{ctx.start.line}:{ctx.start.column}: slerp inputs must have a vector dimension")
try:
a, b = torch.broadcast_tensors(a, b)
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:
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")
dim = dims[0]
float8_dtypes = self._float8_dtypes()
input_dtypes = (a.dtype, b.dtype)
output_dtype = next((dtype for dtype in input_dtypes if dtype in float8_dtypes), None)
if output_dtype is None:
output_dtype = torch.promote_types(a.dtype, b.dtype)
if not torch.empty((), dtype=output_dtype).is_floating_point():
output_dtype = torch.float32
if a.is_complex() or b.is_complex():
raise ValueError(f"{ctx.start.line}:{ctx.start.column}: slerp inputs must be real-valued")
compute_dtype = torch.float64 if output_dtype == torch.float64 else torch.float32
a = a.to(dtype=compute_dtype).movedim(dim, -1)
b = b.to(dtype=compute_dtype).movedim(dim, -1)
t = t.to(device=a.device, dtype=compute_dtype)
try:
t = torch.broadcast_to(t, a.shape[:-1]).unsqueeze(-1)
except RuntimeError as exc:
raise ValueError(f"{ctx.start.line}:{ctx.start.column}: slerp t must broadcast to the input shape without the vector dimension") from exc
norm_a = torch.linalg.vector_norm(a, dim=-1, keepdim=True)
norm_b = torch.linalg.vector_norm(b, dim=-1, keepdim=True)
eps = torch.finfo(compute_dtype).eps
unit_a = a / norm_a.clamp_min(eps)
unit_b = b / norm_b.clamp_min(eps)
unit_a = torch.where(norm_a > eps, unit_a, unit_b)
unit_b = torch.where(norm_b > eps, unit_b, unit_a)
dot = (unit_a * unit_b).sum(dim=-1, keepdim=True).clamp(-1.0, 1.0)
omega = torch.acos(dot)
sin_omega = torch.sin(omega)
regular = sin_omega.abs() > 1e-6
safe_sin_omega = torch.where(regular, sin_omega, torch.ones_like(sin_omega))
spherical = (
torch.sin((1.0 - t) * omega) / safe_sin_omega * unit_a
+ torch.sin(t * omega) / safe_sin_omega * unit_b
)
linear_direction = (1.0 - t) * unit_a + t * unit_b
linear_direction = linear_direction / torch.linalg.vector_norm(linear_direction, dim=-1, keepdim=True).clamp_min(eps)
basis_indices = unit_a.abs().argmin(dim=-1, keepdim=True)
basis = torch.zeros_like(unit_a).scatter_(-1, basis_indices, 1.0)
orthogonal = basis - (basis * unit_a).sum(dim=-1, keepdim=True) * unit_a
orthogonal = orthogonal / torch.linalg.vector_norm(orthogonal, dim=-1, keepdim=True).clamp_min(eps)
antipodal_direction = torch.cos(math.pi * t) * unit_a + torch.sin(math.pi * t) * orthogonal
fallback_direction = torch.where(dot < 0, antipodal_direction, linear_direction)
direction = torch.where(regular, spherical, fallback_direction)
magnitude = (1.0 - t) * norm_a + t * norm_b
result = (direction * magnitude).movedim(-1, dim)
return result.to(dtype=output_dtype).contiguous()
def _lerp_helper(self, a, b, w):
if any(self._is_tensor(x) for x in [a, b, w]) or any(self._is_list(x) for x in [a, b, w]):
return torch.lerp(self._promote_to_tensor(a), self._promote_to_tensor(b), self._promote_to_tensor(w))
File diff suppressed because one or more lines are too long
+403 -401
View File
@@ -54,242 +54,243 @@ PRNT=53
PRINT_SHAPE=54
NVL=55
LERP=56
STEP=57
SMOOTHSTEP=58
FRACT=59
RELU=60
SOFTSIGN=61
LEAKY_RELU=62
SOFTPLUS=63
GELU=64
SILU=65
SIGN=66
DEGREES=67
RADIANS=68
LOGICAL_NOT=69
LOGICAL_AND=70
LOGICAL_OR=71
HYPOT=72
MAP=73
EZCONV=74
CONV=75
SWAP=76
TRANSPOSE=77
PERM=78
RESHAPE=79
RANGE=80
LINSPACE=81
LOGSPACE=82
TOPK=83
BOTK=84
PINV=85
INV=86
SUM=87
MEAN=88
STD=89
VAR=90
PROD=91
ISCLOSE=92
ALLCLOSE=93
QUARTILE=94
PERCENTILE=95
QUANTILE=96
DOT=97
MOMENT=98
ERF=99
ERFINV=100
ANY=101
ALL=102
EDGE=103
GAUSSIAN=104
MEDIAN=105
MODE=106
CUMSUM=107
CUMPROD=108
TOPK_IND=109
BOTK_IND=110
CUBIC_EASE=111
ELASTIC_EASE=112
SINE_EASE=113
SMOOTHERSTEP=114
DIST=115
REMAP=116
COSSIM=117
COUNT=118
KEYS=119
ENABLE_TRACKING=120
DISABLE_TRACKING=121
RESET_TRACKING=122
GET_CHANGED_KEYS=123
GET_ADDED_KEYS=124
GET_REMOVED_KEYS=125
GET_UNCHANGED_KEYS=126
REPEAT=127
FLATTEN=128
APPEND=129
GET_VALUE=130
FLOW_APPLY=131
BATCH_SHUFFLE=132
MOTION_MASK=133
FLOW_TO_IMAGE=134
FLOW_MAG=135
FLOW_ANG=136
WHERE=137
HISTOGRAM=138
OVERLAY=139
PAD=140
CROSS=141
MATMUL=142
SOLVE=143
MATRIX_RANK=144
RIFE=145
BNOT=146
BITCOUNT=147
SHAPE=148
BAND=149
XOR=150
BOR=151
TENSOR=152
ZEROS=153
ONES=154
EYE=155
ONE_HOT=156
MSE=157
MAE=158
PSNR=159
WEIGHTED_MEAN=160
HUBER_LOSS=161
CROSS_ENTROPY=162
ADD_KEY=163
REMOVE_KEY=164
PUSH=165
POP=166
CLEAR=167
HAS=168
GET=169
CONCAT=170
STACK=171
NONZERO=172
INT=173
FLOAT=174
UPPER=175
LOWER=176
TRIM=177
SPLIT=178
JOIN=179
SUBSTRING=180
FIND=181
REPLACE=182
DILATE=183
ERODE=184
MORPH_OPEN=185
MORPH_CLOSE=186
RGB_TO_OKLAB=187
RGB_TO_CIELAB=188
OKLAB_TO_RGB=189
CIELAB_TO_RGB=190
RGB_TO_HSV=191
HSV_TO_RGB=192
INT_TO_RGB=193
RGB_TO_INT=194
INTERPOLATE_LINEAR=195
INTERPOLATE_AREA=196
INTERPOLATE_NEAREST=197
TEXT_IMAGE=198
AS_NESTED=199
SVD=200
DIAG=201
IF=202
ELSE=203
WHILE=204
FOR=205
IN=206
BREAK=207
CONTINUE=208
RETURN=209
TIMESTAMP=210
SORT=211
ARGSORT=212
ARGMIN=213
ARGMAX=214
SOFTMAX=215
SOFTMIN=216
UNIQUE=217
FLIP=218
STARTSWITH=219
ENDSWITH=220
SQUEEZE=221
UNSQUEEZE=222
ROLL=223
COV=224
CORR=225
ENTROPY=226
CROP=227
NONE=228
COORDS=229
GATHER=230
SCATTER=231
SCATTER_ADD=232
NOISE=233
PINK_NOISE=234
BROWN_NOISE=235
RAND=236
CAUCHY=237
EXPONENTIAL=238
LOGNORMAL=239
BERNOULLI=240
POISSON=241
GAMMADIST=242
BETADIST=243
LAPLACEDIST=244
GUMBELDIST=245
WEIBULLDIST=246
CHI2DIST=247
STUDENTTDIST=248
PERLIN=249
CELLULAR=250
PLASMA=251
RIDGED=252
DOMAIN_WARP=253
PLUS=254
MINUS=255
MULT=256
DIV=257
MOD=258
POW=259
LSHIFT=260
RSHIFT=261
GE=262
GT=263
LE=264
LT=265
EQ=266
EQUEALS=267
PLUS_EQ=268
MINUS_EQ=269
MULT_EQ=270
DIV_EQ=271
MOD_EQ=272
NE=273
PIPE=274
LPAREN=275
RPAREN=276
COMMA=277
SEMICOLON=278
ARROW=279
LBRACKET=280
RBRACKET=281
QUESTION=282
COLON=283
LBRACE=284
RBRACE=285
NUMBER=286
CONSTANT=287
STRING=288
VARIABLE=289
SL_COMMENT=290
ML_COMMENT=291
WS=292
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
'sin'=1
'cos'=2
'tan'=3
@@ -344,168 +345,169 @@ WS=292
'angle'=52
'print'=53
'lerp'=56
'step'=57
'smoothstep'=58
'fract'=59
'relu'=60
'softsign'=61
'leaky_relu'=62
'softplus'=63
'gelu'=64
'silu'=65
'sign'=66
'degrees'=67
'radians'=68
'logical_not'=69
'logical_and'=70
'logical_or'=71
'hypot'=72
'map'=73
'swap'=76
'range'=80
'linspace'=81
'logspace'=82
'topk'=83
'botk'=84
'pinv'=85
'inv'=86
'sum'=87
'mean'=88
'std'=89
'var'=90
'prod'=91
'isclose'=92
'allclose'=93
'quantile'=96
'dot'=97
'moment'=98
'erf'=99
'erfinv'=100
'any'=101
'all'=102
'edge'=103
'median'=105
'mode'=106
'cumsum'=107
'cumprod'=108
'smootherstep'=114
'remap'=116
'keys'=119
'repeat'=127
'flatten'=128
'append'=129
'get_value'=130
'flow_apply'=131
'motion_mask'=133
'flow_to_image'=134
'where'=137
'overlay'=139
'pad'=140
'cross'=141
'matmul'=142
'solve'=143
'matrix_rank'=144
'rife'=145
'shape'=148
'tensor'=152
'zeros'=153
'ones'=154
'eye'=155
'one_hot'=156
'mse'=157
'mae'=158
'psnr'=159
'weighted_mean'=160
'huber_loss'=161
'cross_entropy'=162
'add_key'=163
'stack_push'=165
'stack_pop'=166
'stack_clear'=167
'stack_has'=168
'stack_get'=169
'stack'=171
'nonzero'=172
'int'=173
'float'=174
'upper'=175
'lower'=176
'trim'=177
'split'=178
'join'=179
'find'=181
'replace'=182
'dilate'=183
'erode'=184
'morph_open'=185
'morph_close'=186
'rgb_to_oklab'=187
'rgb_to_cielab'=188
'oklab_to_rgb'=189
'cielab_to_rgb'=190
'rgb_to_hsv'=191
'hsv_to_rgb'=192
'int_to_rgb'=193
'rgb_to_int'=194
'interpolate_linear'=195
'interpolate_area'=196
'text_image'=198
'if'=202
'else'=203
'while'=204
'for'=205
'in'=206
'break'=207
'continue'=208
'return'=209
'sort'=211
'argsort'=212
'argmin'=213
'argmax'=214
'softmax'=215
'softmin'=216
'unique'=217
'flip'=218
'startswith'=219
'endswith'=220
'squeeze'=221
'unsqueeze'=222
'roll'=223
'cov'=224
'entropy'=226
'crop'=227
'gather'=230
'scatter'=231
'scatter_add'=232
'+'=254
'-'=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
'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
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+403 -401
View File
@@ -54,242 +54,243 @@ PRNT=53
PRINT_SHAPE=54
NVL=55
LERP=56
STEP=57
SMOOTHSTEP=58
FRACT=59
RELU=60
SOFTSIGN=61
LEAKY_RELU=62
SOFTPLUS=63
GELU=64
SILU=65
SIGN=66
DEGREES=67
RADIANS=68
LOGICAL_NOT=69
LOGICAL_AND=70
LOGICAL_OR=71
HYPOT=72
MAP=73
EZCONV=74
CONV=75
SWAP=76
TRANSPOSE=77
PERM=78
RESHAPE=79
RANGE=80
LINSPACE=81
LOGSPACE=82
TOPK=83
BOTK=84
PINV=85
INV=86
SUM=87
MEAN=88
STD=89
VAR=90
PROD=91
ISCLOSE=92
ALLCLOSE=93
QUARTILE=94
PERCENTILE=95
QUANTILE=96
DOT=97
MOMENT=98
ERF=99
ERFINV=100
ANY=101
ALL=102
EDGE=103
GAUSSIAN=104
MEDIAN=105
MODE=106
CUMSUM=107
CUMPROD=108
TOPK_IND=109
BOTK_IND=110
CUBIC_EASE=111
ELASTIC_EASE=112
SINE_EASE=113
SMOOTHERSTEP=114
DIST=115
REMAP=116
COSSIM=117
COUNT=118
KEYS=119
ENABLE_TRACKING=120
DISABLE_TRACKING=121
RESET_TRACKING=122
GET_CHANGED_KEYS=123
GET_ADDED_KEYS=124
GET_REMOVED_KEYS=125
GET_UNCHANGED_KEYS=126
REPEAT=127
FLATTEN=128
APPEND=129
GET_VALUE=130
FLOW_APPLY=131
BATCH_SHUFFLE=132
MOTION_MASK=133
FLOW_TO_IMAGE=134
FLOW_MAG=135
FLOW_ANG=136
WHERE=137
HISTOGRAM=138
OVERLAY=139
PAD=140
CROSS=141
MATMUL=142
SOLVE=143
MATRIX_RANK=144
RIFE=145
BNOT=146
BITCOUNT=147
SHAPE=148
BAND=149
XOR=150
BOR=151
TENSOR=152
ZEROS=153
ONES=154
EYE=155
ONE_HOT=156
MSE=157
MAE=158
PSNR=159
WEIGHTED_MEAN=160
HUBER_LOSS=161
CROSS_ENTROPY=162
ADD_KEY=163
REMOVE_KEY=164
PUSH=165
POP=166
CLEAR=167
HAS=168
GET=169
CONCAT=170
STACK=171
NONZERO=172
INT=173
FLOAT=174
UPPER=175
LOWER=176
TRIM=177
SPLIT=178
JOIN=179
SUBSTRING=180
FIND=181
REPLACE=182
DILATE=183
ERODE=184
MORPH_OPEN=185
MORPH_CLOSE=186
RGB_TO_OKLAB=187
RGB_TO_CIELAB=188
OKLAB_TO_RGB=189
CIELAB_TO_RGB=190
RGB_TO_HSV=191
HSV_TO_RGB=192
INT_TO_RGB=193
RGB_TO_INT=194
INTERPOLATE_LINEAR=195
INTERPOLATE_AREA=196
INTERPOLATE_NEAREST=197
TEXT_IMAGE=198
AS_NESTED=199
SVD=200
DIAG=201
IF=202
ELSE=203
WHILE=204
FOR=205
IN=206
BREAK=207
CONTINUE=208
RETURN=209
TIMESTAMP=210
SORT=211
ARGSORT=212
ARGMIN=213
ARGMAX=214
SOFTMAX=215
SOFTMIN=216
UNIQUE=217
FLIP=218
STARTSWITH=219
ENDSWITH=220
SQUEEZE=221
UNSQUEEZE=222
ROLL=223
COV=224
CORR=225
ENTROPY=226
CROP=227
NONE=228
COORDS=229
GATHER=230
SCATTER=231
SCATTER_ADD=232
NOISE=233
PINK_NOISE=234
BROWN_NOISE=235
RAND=236
CAUCHY=237
EXPONENTIAL=238
LOGNORMAL=239
BERNOULLI=240
POISSON=241
GAMMADIST=242
BETADIST=243
LAPLACEDIST=244
GUMBELDIST=245
WEIBULLDIST=246
CHI2DIST=247
STUDENTTDIST=248
PERLIN=249
CELLULAR=250
PLASMA=251
RIDGED=252
DOMAIN_WARP=253
PLUS=254
MINUS=255
MULT=256
DIV=257
MOD=258
POW=259
LSHIFT=260
RSHIFT=261
GE=262
GT=263
LE=264
LT=265
EQ=266
EQUEALS=267
PLUS_EQ=268
MINUS_EQ=269
MULT_EQ=270
DIV_EQ=271
MOD_EQ=272
NE=273
PIPE=274
LPAREN=275
RPAREN=276
COMMA=277
SEMICOLON=278
ARROW=279
LBRACKET=280
RBRACKET=281
QUESTION=282
COLON=283
LBRACE=284
RBRACE=285
NUMBER=286
CONSTANT=287
STRING=288
VARIABLE=289
SL_COMMENT=290
ML_COMMENT=291
WS=292
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
'sin'=1
'cos'=2
'tan'=3
@@ -344,168 +345,169 @@ WS=292
'angle'=52
'print'=53
'lerp'=56
'step'=57
'smoothstep'=58
'fract'=59
'relu'=60
'softsign'=61
'leaky_relu'=62
'softplus'=63
'gelu'=64
'silu'=65
'sign'=66
'degrees'=67
'radians'=68
'logical_not'=69
'logical_and'=70
'logical_or'=71
'hypot'=72
'map'=73
'swap'=76
'range'=80
'linspace'=81
'logspace'=82
'topk'=83
'botk'=84
'pinv'=85
'inv'=86
'sum'=87
'mean'=88
'std'=89
'var'=90
'prod'=91
'isclose'=92
'allclose'=93
'quantile'=96
'dot'=97
'moment'=98
'erf'=99
'erfinv'=100
'any'=101
'all'=102
'edge'=103
'median'=105
'mode'=106
'cumsum'=107
'cumprod'=108
'smootherstep'=114
'remap'=116
'keys'=119
'repeat'=127
'flatten'=128
'append'=129
'get_value'=130
'flow_apply'=131
'motion_mask'=133
'flow_to_image'=134
'where'=137
'overlay'=139
'pad'=140
'cross'=141
'matmul'=142
'solve'=143
'matrix_rank'=144
'rife'=145
'shape'=148
'tensor'=152
'zeros'=153
'ones'=154
'eye'=155
'one_hot'=156
'mse'=157
'mae'=158
'psnr'=159
'weighted_mean'=160
'huber_loss'=161
'cross_entropy'=162
'add_key'=163
'stack_push'=165
'stack_pop'=166
'stack_clear'=167
'stack_has'=168
'stack_get'=169
'stack'=171
'nonzero'=172
'int'=173
'float'=174
'upper'=175
'lower'=176
'trim'=177
'split'=178
'join'=179
'find'=181
'replace'=182
'dilate'=183
'erode'=184
'morph_open'=185
'morph_close'=186
'rgb_to_oklab'=187
'rgb_to_cielab'=188
'oklab_to_rgb'=189
'cielab_to_rgb'=190
'rgb_to_hsv'=191
'hsv_to_rgb'=192
'int_to_rgb'=193
'rgb_to_int'=194
'interpolate_linear'=195
'interpolate_area'=196
'text_image'=198
'if'=202
'else'=203
'while'=204
'for'=205
'in'=206
'break'=207
'continue'=208
'return'=209
'sort'=211
'argsort'=212
'argmin'=213
'argmax'=214
'softmax'=215
'softmin'=216
'unique'=217
'flip'=218
'startswith'=219
'endswith'=220
'squeeze'=221
'unsqueeze'=222
'roll'=223
'cov'=224
'entropy'=226
'crop'=227
'gather'=230
'scatter'=231
'scatter_add'=232
'+'=254
'-'=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
'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
@@ -2582,6 +2582,15 @@ class MathExprListener(ParseTreeListener):
pass
# Enter a parse tree produced by MathExprParser#SlerpFunc.
def enterSlerpFunc(self, ctx:MathExprParser.SlerpFuncContext):
pass
# Exit a parse tree produced by MathExprParser#SlerpFunc.
def exitSlerpFunc(self, ctx:MathExprParser.SlerpFuncContext):
pass
# Enter a parse tree produced by MathExprParser#NormalizeFunc.
def enterNormalizeFunc(self, ctx:MathExprParser.NormalizeFuncContext):
pass
File diff suppressed because it is too large Load Diff
@@ -1439,6 +1439,11 @@ class MathExprVisitor(ParseTreeVisitor):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#SlerpFunc.
def visitSlerpFunc(self, ctx:MathExprParser.SlerpFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#NormalizeFunc.
def visitNormalizeFunc(self, ctx:MathExprParser.NormalizeFuncContext):
return self.visitChildren(ctx)
+2 -1
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', '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', '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'
}
INBUILT_FUNCTION_META = {
@@ -68,6 +68,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.'},
'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)'},
File diff suppressed because one or more lines are too long
+403 -401
View File
@@ -54,242 +54,243 @@ PRNT=53
PRINT_SHAPE=54
NVL=55
LERP=56
STEP=57
SMOOTHSTEP=58
FRACT=59
RELU=60
SOFTSIGN=61
LEAKY_RELU=62
SOFTPLUS=63
GELU=64
SILU=65
SIGN=66
DEGREES=67
RADIANS=68
LOGICAL_NOT=69
LOGICAL_AND=70
LOGICAL_OR=71
HYPOT=72
MAP=73
EZCONV=74
CONV=75
SWAP=76
TRANSPOSE=77
PERM=78
RESHAPE=79
RANGE=80
LINSPACE=81
LOGSPACE=82
TOPK=83
BOTK=84
PINV=85
INV=86
SUM=87
MEAN=88
STD=89
VAR=90
PROD=91
ISCLOSE=92
ALLCLOSE=93
QUARTILE=94
PERCENTILE=95
QUANTILE=96
DOT=97
MOMENT=98
ERF=99
ERFINV=100
ANY=101
ALL=102
EDGE=103
GAUSSIAN=104
MEDIAN=105
MODE=106
CUMSUM=107
CUMPROD=108
TOPK_IND=109
BOTK_IND=110
CUBIC_EASE=111
ELASTIC_EASE=112
SINE_EASE=113
SMOOTHERSTEP=114
DIST=115
REMAP=116
COSSIM=117
COUNT=118
KEYS=119
ENABLE_TRACKING=120
DISABLE_TRACKING=121
RESET_TRACKING=122
GET_CHANGED_KEYS=123
GET_ADDED_KEYS=124
GET_REMOVED_KEYS=125
GET_UNCHANGED_KEYS=126
REPEAT=127
FLATTEN=128
APPEND=129
GET_VALUE=130
FLOW_APPLY=131
BATCH_SHUFFLE=132
MOTION_MASK=133
FLOW_TO_IMAGE=134
FLOW_MAG=135
FLOW_ANG=136
WHERE=137
HISTOGRAM=138
OVERLAY=139
PAD=140
CROSS=141
MATMUL=142
SOLVE=143
MATRIX_RANK=144
RIFE=145
BNOT=146
BITCOUNT=147
SHAPE=148
BAND=149
XOR=150
BOR=151
TENSOR=152
ZEROS=153
ONES=154
EYE=155
ONE_HOT=156
MSE=157
MAE=158
PSNR=159
WEIGHTED_MEAN=160
HUBER_LOSS=161
CROSS_ENTROPY=162
ADD_KEY=163
REMOVE_KEY=164
PUSH=165
POP=166
CLEAR=167
HAS=168
GET=169
CONCAT=170
STACK=171
NONZERO=172
INT=173
FLOAT=174
UPPER=175
LOWER=176
TRIM=177
SPLIT=178
JOIN=179
SUBSTRING=180
FIND=181
REPLACE=182
DILATE=183
ERODE=184
MORPH_OPEN=185
MORPH_CLOSE=186
RGB_TO_OKLAB=187
RGB_TO_CIELAB=188
OKLAB_TO_RGB=189
CIELAB_TO_RGB=190
RGB_TO_HSV=191
HSV_TO_RGB=192
INT_TO_RGB=193
RGB_TO_INT=194
INTERPOLATE_LINEAR=195
INTERPOLATE_AREA=196
INTERPOLATE_NEAREST=197
TEXT_IMAGE=198
AS_NESTED=199
SVD=200
DIAG=201
IF=202
ELSE=203
WHILE=204
FOR=205
IN=206
BREAK=207
CONTINUE=208
RETURN=209
TIMESTAMP=210
SORT=211
ARGSORT=212
ARGMIN=213
ARGMAX=214
SOFTMAX=215
SOFTMIN=216
UNIQUE=217
FLIP=218
STARTSWITH=219
ENDSWITH=220
SQUEEZE=221
UNSQUEEZE=222
ROLL=223
COV=224
CORR=225
ENTROPY=226
CROP=227
NONE=228
COORDS=229
GATHER=230
SCATTER=231
SCATTER_ADD=232
NOISE=233
PINK_NOISE=234
BROWN_NOISE=235
RAND=236
CAUCHY=237
EXPONENTIAL=238
LOGNORMAL=239
BERNOULLI=240
POISSON=241
GAMMADIST=242
BETADIST=243
LAPLACEDIST=244
GUMBELDIST=245
WEIBULLDIST=246
CHI2DIST=247
STUDENTTDIST=248
PERLIN=249
CELLULAR=250
PLASMA=251
RIDGED=252
DOMAIN_WARP=253
PLUS=254
MINUS=255
MULT=256
DIV=257
MOD=258
POW=259
LSHIFT=260
RSHIFT=261
GE=262
GT=263
LE=264
LT=265
EQ=266
EQUEALS=267
PLUS_EQ=268
MINUS_EQ=269
MULT_EQ=270
DIV_EQ=271
MOD_EQ=272
NE=273
PIPE=274
LPAREN=275
RPAREN=276
COMMA=277
SEMICOLON=278
ARROW=279
LBRACKET=280
RBRACKET=281
QUESTION=282
COLON=283
LBRACE=284
RBRACE=285
NUMBER=286
CONSTANT=287
STRING=288
VARIABLE=289
SL_COMMENT=290
ML_COMMENT=291
WS=292
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
'sin'=1
'cos'=2
'tan'=3
@@ -344,168 +345,169 @@ WS=292
'angle'=52
'print'=53
'lerp'=56
'step'=57
'smoothstep'=58
'fract'=59
'relu'=60
'softsign'=61
'leaky_relu'=62
'softplus'=63
'gelu'=64
'silu'=65
'sign'=66
'degrees'=67
'radians'=68
'logical_not'=69
'logical_and'=70
'logical_or'=71
'hypot'=72
'map'=73
'swap'=76
'range'=80
'linspace'=81
'logspace'=82
'topk'=83
'botk'=84
'pinv'=85
'inv'=86
'sum'=87
'mean'=88
'std'=89
'var'=90
'prod'=91
'isclose'=92
'allclose'=93
'quantile'=96
'dot'=97
'moment'=98
'erf'=99
'erfinv'=100
'any'=101
'all'=102
'edge'=103
'median'=105
'mode'=106
'cumsum'=107
'cumprod'=108
'smootherstep'=114
'remap'=116
'keys'=119
'repeat'=127
'flatten'=128
'append'=129
'get_value'=130
'flow_apply'=131
'motion_mask'=133
'flow_to_image'=134
'where'=137
'overlay'=139
'pad'=140
'cross'=141
'matmul'=142
'solve'=143
'matrix_rank'=144
'rife'=145
'shape'=148
'tensor'=152
'zeros'=153
'ones'=154
'eye'=155
'one_hot'=156
'mse'=157
'mae'=158
'psnr'=159
'weighted_mean'=160
'huber_loss'=161
'cross_entropy'=162
'add_key'=163
'stack_push'=165
'stack_pop'=166
'stack_clear'=167
'stack_has'=168
'stack_get'=169
'stack'=171
'nonzero'=172
'int'=173
'float'=174
'upper'=175
'lower'=176
'trim'=177
'split'=178
'join'=179
'find'=181
'replace'=182
'dilate'=183
'erode'=184
'morph_open'=185
'morph_close'=186
'rgb_to_oklab'=187
'rgb_to_cielab'=188
'oklab_to_rgb'=189
'cielab_to_rgb'=190
'rgb_to_hsv'=191
'hsv_to_rgb'=192
'int_to_rgb'=193
'rgb_to_int'=194
'interpolate_linear'=195
'interpolate_area'=196
'text_image'=198
'if'=202
'else'=203
'while'=204
'for'=205
'in'=206
'break'=207
'continue'=208
'return'=209
'sort'=211
'argsort'=212
'argmin'=213
'argmax'=214
'softmax'=215
'softmin'=216
'unique'=217
'flip'=218
'startswith'=219
'endswith'=220
'squeeze'=221
'unsqueeze'=222
'roll'=223
'cov'=224
'entropy'=226
'crop'=227
'gather'=230
'scatter'=231
'scatter_add'=232
'+'=254
'-'=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
'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
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+403 -401
View File
@@ -54,242 +54,243 @@ PRNT=53
PRINT_SHAPE=54
NVL=55
LERP=56
STEP=57
SMOOTHSTEP=58
FRACT=59
RELU=60
SOFTSIGN=61
LEAKY_RELU=62
SOFTPLUS=63
GELU=64
SILU=65
SIGN=66
DEGREES=67
RADIANS=68
LOGICAL_NOT=69
LOGICAL_AND=70
LOGICAL_OR=71
HYPOT=72
MAP=73
EZCONV=74
CONV=75
SWAP=76
TRANSPOSE=77
PERM=78
RESHAPE=79
RANGE=80
LINSPACE=81
LOGSPACE=82
TOPK=83
BOTK=84
PINV=85
INV=86
SUM=87
MEAN=88
STD=89
VAR=90
PROD=91
ISCLOSE=92
ALLCLOSE=93
QUARTILE=94
PERCENTILE=95
QUANTILE=96
DOT=97
MOMENT=98
ERF=99
ERFINV=100
ANY=101
ALL=102
EDGE=103
GAUSSIAN=104
MEDIAN=105
MODE=106
CUMSUM=107
CUMPROD=108
TOPK_IND=109
BOTK_IND=110
CUBIC_EASE=111
ELASTIC_EASE=112
SINE_EASE=113
SMOOTHERSTEP=114
DIST=115
REMAP=116
COSSIM=117
COUNT=118
KEYS=119
ENABLE_TRACKING=120
DISABLE_TRACKING=121
RESET_TRACKING=122
GET_CHANGED_KEYS=123
GET_ADDED_KEYS=124
GET_REMOVED_KEYS=125
GET_UNCHANGED_KEYS=126
REPEAT=127
FLATTEN=128
APPEND=129
GET_VALUE=130
FLOW_APPLY=131
BATCH_SHUFFLE=132
MOTION_MASK=133
FLOW_TO_IMAGE=134
FLOW_MAG=135
FLOW_ANG=136
WHERE=137
HISTOGRAM=138
OVERLAY=139
PAD=140
CROSS=141
MATMUL=142
SOLVE=143
MATRIX_RANK=144
RIFE=145
BNOT=146
BITCOUNT=147
SHAPE=148
BAND=149
XOR=150
BOR=151
TENSOR=152
ZEROS=153
ONES=154
EYE=155
ONE_HOT=156
MSE=157
MAE=158
PSNR=159
WEIGHTED_MEAN=160
HUBER_LOSS=161
CROSS_ENTROPY=162
ADD_KEY=163
REMOVE_KEY=164
PUSH=165
POP=166
CLEAR=167
HAS=168
GET=169
CONCAT=170
STACK=171
NONZERO=172
INT=173
FLOAT=174
UPPER=175
LOWER=176
TRIM=177
SPLIT=178
JOIN=179
SUBSTRING=180
FIND=181
REPLACE=182
DILATE=183
ERODE=184
MORPH_OPEN=185
MORPH_CLOSE=186
RGB_TO_OKLAB=187
RGB_TO_CIELAB=188
OKLAB_TO_RGB=189
CIELAB_TO_RGB=190
RGB_TO_HSV=191
HSV_TO_RGB=192
INT_TO_RGB=193
RGB_TO_INT=194
INTERPOLATE_LINEAR=195
INTERPOLATE_AREA=196
INTERPOLATE_NEAREST=197
TEXT_IMAGE=198
AS_NESTED=199
SVD=200
DIAG=201
IF=202
ELSE=203
WHILE=204
FOR=205
IN=206
BREAK=207
CONTINUE=208
RETURN=209
TIMESTAMP=210
SORT=211
ARGSORT=212
ARGMIN=213
ARGMAX=214
SOFTMAX=215
SOFTMIN=216
UNIQUE=217
FLIP=218
STARTSWITH=219
ENDSWITH=220
SQUEEZE=221
UNSQUEEZE=222
ROLL=223
COV=224
CORR=225
ENTROPY=226
CROP=227
NONE=228
COORDS=229
GATHER=230
SCATTER=231
SCATTER_ADD=232
NOISE=233
PINK_NOISE=234
BROWN_NOISE=235
RAND=236
CAUCHY=237
EXPONENTIAL=238
LOGNORMAL=239
BERNOULLI=240
POISSON=241
GAMMADIST=242
BETADIST=243
LAPLACEDIST=244
GUMBELDIST=245
WEIBULLDIST=246
CHI2DIST=247
STUDENTTDIST=248
PERLIN=249
CELLULAR=250
PLASMA=251
RIDGED=252
DOMAIN_WARP=253
PLUS=254
MINUS=255
MULT=256
DIV=257
MOD=258
POW=259
LSHIFT=260
RSHIFT=261
GE=262
GT=263
LE=264
LT=265
EQ=266
EQUEALS=267
PLUS_EQ=268
MINUS_EQ=269
MULT_EQ=270
DIV_EQ=271
MOD_EQ=272
NE=273
PIPE=274
LPAREN=275
RPAREN=276
COMMA=277
SEMICOLON=278
ARROW=279
LBRACKET=280
RBRACKET=281
QUESTION=282
COLON=283
LBRACE=284
RBRACE=285
NUMBER=286
CONSTANT=287
STRING=288
VARIABLE=289
SL_COMMENT=290
ML_COMMENT=291
WS=292
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
'sin'=1
'cos'=2
'tan'=3
@@ -344,168 +345,169 @@ WS=292
'angle'=52
'print'=53
'lerp'=56
'step'=57
'smoothstep'=58
'fract'=59
'relu'=60
'softsign'=61
'leaky_relu'=62
'softplus'=63
'gelu'=64
'silu'=65
'sign'=66
'degrees'=67
'radians'=68
'logical_not'=69
'logical_and'=70
'logical_or'=71
'hypot'=72
'map'=73
'swap'=76
'range'=80
'linspace'=81
'logspace'=82
'topk'=83
'botk'=84
'pinv'=85
'inv'=86
'sum'=87
'mean'=88
'std'=89
'var'=90
'prod'=91
'isclose'=92
'allclose'=93
'quantile'=96
'dot'=97
'moment'=98
'erf'=99
'erfinv'=100
'any'=101
'all'=102
'edge'=103
'median'=105
'mode'=106
'cumsum'=107
'cumprod'=108
'smootherstep'=114
'remap'=116
'keys'=119
'repeat'=127
'flatten'=128
'append'=129
'get_value'=130
'flow_apply'=131
'motion_mask'=133
'flow_to_image'=134
'where'=137
'overlay'=139
'pad'=140
'cross'=141
'matmul'=142
'solve'=143
'matrix_rank'=144
'rife'=145
'shape'=148
'tensor'=152
'zeros'=153
'ones'=154
'eye'=155
'one_hot'=156
'mse'=157
'mae'=158
'psnr'=159
'weighted_mean'=160
'huber_loss'=161
'cross_entropy'=162
'add_key'=163
'stack_push'=165
'stack_pop'=166
'stack_clear'=167
'stack_has'=168
'stack_get'=169
'stack'=171
'nonzero'=172
'int'=173
'float'=174
'upper'=175
'lower'=176
'trim'=177
'split'=178
'join'=179
'find'=181
'replace'=182
'dilate'=183
'erode'=184
'morph_open'=185
'morph_close'=186
'rgb_to_oklab'=187
'rgb_to_cielab'=188
'oklab_to_rgb'=189
'cielab_to_rgb'=190
'rgb_to_hsv'=191
'hsv_to_rgb'=192
'int_to_rgb'=193
'rgb_to_int'=194
'interpolate_linear'=195
'interpolate_area'=196
'text_image'=198
'if'=202
'else'=203
'while'=204
'for'=205
'in'=206
'break'=207
'continue'=208
'return'=209
'sort'=211
'argsort'=212
'argmin'=213
'argmax'=214
'softmax'=215
'softmin'=216
'unique'=217
'flip'=218
'startswith'=219
'endswith'=220
'squeeze'=221
'unsqueeze'=222
'roll'=223
'cov'=224
'entropy'=226
'crop'=227
'gather'=230
'scatter'=231
'scatter_add'=232
'+'=254
'-'=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
'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
@@ -2582,6 +2582,15 @@ class MathExprListener(ParseTreeListener):
pass
# Enter a parse tree produced by MathExprParser#SlerpFunc.
def enterSlerpFunc(self, ctx:MathExprParser.SlerpFuncContext):
pass
# Exit a parse tree produced by MathExprParser#SlerpFunc.
def exitSlerpFunc(self, ctx:MathExprParser.SlerpFuncContext):
pass
# Enter a parse tree produced by MathExprParser#NormalizeFunc.
def enterNormalizeFunc(self, ctx:MathExprParser.NormalizeFuncContext):
pass
File diff suppressed because one or more lines are too long
@@ -1439,6 +1439,11 @@ class MathExprVisitor(ParseTreeVisitor):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#SlerpFunc.
def visitSlerpFunc(self, ctx:MathExprParser.SlerpFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#NormalizeFunc.
def visitNormalizeFunc(self, ctx:MathExprParser.NormalizeFuncContext):
return self.visitChildren(ctx)
+43
View File
@@ -199,6 +199,49 @@ def test_group_norm_preserves_float8_dtype():
result = eval_expr("group_norm(x, 2)", {"x": values})
assert result.dtype == dtype
def test_slerp_interpolates_direction_and_magnitude():
a = torch.tensor([2.0, 0.0])
b = torch.tensor([0.0, 4.0])
result = eval_expr("slerp(a, b, 0.5)", {"a": a, "b": b})
torch.testing.assert_close(result, torch.tensor([3.0 / math.sqrt(2.0), 3.0 / math.sqrt(2.0)]))
torch.testing.assert_close(eval_expr("slerp(a, b, 0)", {"a": a, "b": b}), a)
torch.testing.assert_close(eval_expr("slerp(a, b, 1)", {"a": a, "b": b}), b)
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])}),
torch.tensor([[1.0, 0.0], [0.0, 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(
eval_expr("slerp(a, b, 0.5, 0)", {"a": a_by_column, "b": b_by_column}),
torch.full((2, 2), 1.5 / math.sqrt(2.0)),
)
antipodal = eval_expr("slerp([1, 0], [-4, 0], 0.5)")
assert torch.isfinite(antipodal).all()
torch.testing.assert_close(torch.linalg.vector_norm(antipodal), torch.tensor(2.5))
torch.testing.assert_close(eval_expr("slerp([0, 0], [0, 4], 0.5)"), torch.tensor([0.0, 2.0]))
assert "slerp" in INBUILT_FUNCTIONS
def test_slerp_validates_broadcasting_and_preserves_float8_dtype():
with pytest.raises(ValueError, match="inputs must be broadcastable"):
eval_expr("slerp([1, 2], [1, 2, 3], 0.5)")
with pytest.raises(ValueError, match="t must broadcast"):
eval_expr("slerp([[1, 0], [0, 1]], [[0, 1], [1, 0]], [1, 2, 3])")
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.randn(2, 3).to(dtype)
result = eval_expr("slerp(a, b, 0.5)", {"a": values, "b": values})
assert result.dtype == dtype
if __name__ == "__main__":
test_logic_functions()
test_spatial_functions()
+2 -1
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", "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", "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"
]);
export const FUNCTION_META = {
@@ -71,6 +71,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." },
"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)" },