AI: Fix dictionary mode and add functions to read changed keys.

This commit is contained in:
mcDandy
2026-09-17 18:50:09 +02:00
parent a3298018b9
commit d3d76e6eeb
30 changed files with 30654 additions and 6465 deletions
+21 -1
View File
@@ -812,7 +812,23 @@ funcN:
/**
concatenate(x1, x2, ..., dim) - concatenates tensors along the specified dimension
*/
| CONCAT LPAREN expr (COMMA expr)+ RPAREN # ConcatFunc;
| CONCAT LPAREN expr (COMMA expr)+ RPAREN # ConcatFunc
/**
get_changed_keys(d) - returns list of keys that were modified or added in ChangeTrackingDict d
*/
| GET_CHANGED_KEYS LPAREN expr RPAREN # GetChangedKeysFunc
/**
get_added_keys(d) - returns list of keys that were added (newly created) in ChangeTrackingDict d
*/
| GET_ADDED_KEYS LPAREN expr RPAREN # GetAddedKeysFunc
/**
get_removed_keys(d) - returns list of keys that were removed from ChangeTrackingDict d
*/
| GET_REMOVED_KEYS LPAREN expr RPAREN # GetRemovedKeysFunc
/**
get_unchanged_keys(d) - returns list of keys that remain unchanged in ChangeTrackingDict d
*/
| GET_UNCHANGED_KEYS LPAREN expr RPAREN # GetUnchangedKeysFunc;
funcNoise:
/**
@@ -982,6 +998,10 @@ REMAP: 'remap';
COSSIM: 'cossim' | 'cosine_similarity';
COUNT: 'count' | 'cnt' | 'length';
KEYS: 'keys';
GET_CHANGED_KEYS: 'get_changed_keys' | 'changed_keys';
GET_ADDED_KEYS: 'get_added_keys' | 'added_keys';
GET_REMOVED_KEYS: 'get_removed_keys' | 'removed_keys';
GET_UNCHANGED_KEYS: 'get_unchanged_keys' | 'unchanged_keys';
REPEAT: 'repeat';
FLATTEN: 'flatten';
APPEND: 'append';
File diff suppressed because one or more lines are too long
+409
View File
@@ -0,0 +1,409 @@
SIN=1
COS=2
TAN=3
ASIN=4
ACOS=5
ATAN=6
ATAN2=7
SINH=8
COSH=9
TANH=10
ASINH=11
ACOSH=12
ATANH=13
ABS=14
SQRT=15
LN=16
LOG=17
EXP=18
SMIN=19
SMAX=20
TMIN=21
TMAX=22
TNORM=23
SNORM=24
FLOOR=25
CEIL=26
ROUND=27
GAMMA=28
POWE=29
SIGM=30
CLAMP=31
SFFT=32
SIFFT=33
ANGL=34
PRNT=35
PRINT_SHAPE=36
NVL=37
LERP=38
STEP=39
SMOOTHSTEP=40
FRACT=41
RELU=42
SOFTPLUS=43
GELU=44
SIGN=45
MAP=46
EZCONV=47
CONV=48
SWAP=49
PERM=50
RESHAPE=51
RANGE=52
LINSPACE=53
LOGSPACE=54
TOPK=55
BOTK=56
PINV=57
SUM=58
MEAN=59
STD=60
VAR=61
QUARTILE=62
PERCENTILE=63
QUANTILE=64
DOT=65
MOMENT=66
ERF=67
ERFINV=68
ANY=69
ALL=70
EDGE=71
GAUSSIAN=72
MEDIAN=73
MODE=74
CUMSUM=75
CUMPROD=76
TOPK_IND=77
BOTK_IND=78
CUBIC_EASE=79
ELASTIC_EASE=80
SINE_EASE=81
SMOOTHERSTEP=82
DIST=83
REMAP=84
COSSIM=85
COUNT=86
KEYS=87
GET_CHANGED_KEYS=88
GET_ADDED_KEYS=89
GET_REMOVED_KEYS=90
GET_UNCHANGED_KEYS=91
REPEAT=92
FLATTEN=93
APPEND=94
GET_VALUE=95
FLOW_APPLY=96
BATCH_SHUFFLE=97
MOTION_MASK=98
FLOW_TO_IMAGE=99
FLOW_MAG=100
FLOW_ANG=101
WHERE=102
HISTOGRAM=103
OVERLAY=104
PAD=105
CROSS=106
MATMUL=107
RIFE=108
BNOT=109
BITCOUNT=110
SHAPE=111
BAND=112
XOR=113
BOR=114
TENSOR=115
ADD_KEY=116
REMOVE_KEY=117
PUSH=118
POP=119
CLEAR=120
HAS=121
GET=122
CONCAT=123
INT=124
FLOAT=125
UPPER=126
LOWER=127
TRIM=128
SPLIT=129
JOIN=130
SUBSTRING=131
FIND=132
REPLACE=133
DILATE=134
ERODE=135
MORPH_OPEN=136
MORPH_CLOSE=137
RGB_TO_OKLAB=138
RGB_TO_CIELAB=139
OKLAB_TO_RGB=140
CIELAB_TO_RGB=141
RGB_TO_HSV=142
HSV_TO_RGB=143
INT_TO_RGB=144
RGB_TO_INT=145
INTERPOLATE_LINEAR=146
INTERPOLATE_AREA=147
INTERPOLATE_NEAREST=148
TEXT_IMAGE=149
AS_NESTED=150
SVD=151
DIAG=152
IF=153
ELSE=154
WHILE=155
FOR=156
IN=157
BREAK=158
CONTINUE=159
RETURN=160
TIMESTAMP=161
SORT=162
ARGSORT=163
ARGMIN=164
ARGMAX=165
SOFTMAX=166
SOFTMIN=167
UNIQUE=168
FLIP=169
STARTSWITH=170
ENDSWITH=171
SQUEEZE=172
UNSQUEEZE=173
ROLL=174
COV=175
CORR=176
ENTROPY=177
CROP=178
NONE=179
COORDS=180
NOISE=181
RAND=182
CAUCHY=183
EXPONENTIAL=184
LOGNORMAL=185
BERNOULLI=186
POISSON=187
GAMMADIST=188
BETADIST=189
LAPLACEDIST=190
GUMBELDIST=191
WEIBULLDIST=192
CHI2DIST=193
STUDENTTDIST=194
PERLIN=195
CELLULAR=196
PLASMA=197
RIDGED=198
DOMAIN_WARP=199
PLUS=200
MINUS=201
MULT=202
DIV=203
MOD=204
POW=205
LSHIFT=206
RSHIFT=207
GE=208
GT=209
LE=210
LT=211
EQ=212
EQUEALS=213
PLUS_EQ=214
MINUS_EQ=215
MULT_EQ=216
DIV_EQ=217
MOD_EQ=218
NE=219
PIPE=220
LPAREN=221
RPAREN=222
COMMA=223
SEMICOLON=224
ARROW=225
LBRACKET=226
RBRACKET=227
QUESTION=228
COLON=229
LBRACE=230
RBRACE=231
NUMBER=232
CONSTANT=233
STRING=234
VARIABLE=235
SL_COMMENT=236
ML_COMMENT=237
WS=238
'sin'=1
'cos'=2
'tan'=3
'asin'=4
'acos'=5
'atan'=6
'atan2'=7
'sinh'=8
'cosh'=9
'tanh'=10
'asinh'=11
'acosh'=12
'atanh'=13
'abs'=14
'sqrt'=15
'ln'=16
'log'=17
'exp'=18
'smin'=19
'smax'=20
'tmin'=21
'tmax'=22
'tnorm'=23
'snorm'=24
'floor'=25
'ceil'=26
'round'=27
'gamma'=28
'pow'=29
'sigm'=30
'clamp'=31
'fft'=32
'ifft'=33
'angle'=34
'print'=35
'lerp'=38
'step'=39
'smoothstep'=40
'fract'=41
'relu'=42
'softplus'=43
'gelu'=44
'sign'=45
'map'=46
'swap'=49
'range'=52
'linspace'=53
'logspace'=54
'topk'=55
'botk'=56
'pinv'=57
'sum'=58
'mean'=59
'std'=60
'var'=61
'quantile'=64
'dot'=65
'moment'=66
'erf'=67
'erfinv'=68
'any'=69
'all'=70
'edge'=71
'median'=73
'mode'=74
'cumsum'=75
'cumprod'=76
'smootherstep'=82
'remap'=84
'keys'=87
'repeat'=92
'flatten'=93
'append'=94
'get_value'=95
'flow_apply'=96
'motion_mask'=98
'flow_to_image'=99
'where'=102
'overlay'=104
'pad'=105
'cross'=106
'matmul'=107
'rife'=108
'shape'=111
'tensor'=115
'add_key'=116
'stack_push'=118
'stack_pop'=119
'stack_clear'=120
'stack_has'=121
'stack_get'=122
'int'=124
'float'=125
'upper'=126
'lower'=127
'trim'=128
'split'=129
'join'=130
'find'=132
'replace'=133
'dilate'=134
'erode'=135
'morph_open'=136
'morph_close'=137
'rgb_to_oklab'=138
'rgb_to_cielab'=139
'oklab_to_rgb'=140
'cielab_to_rgb'=141
'rgb_to_hsv'=142
'hsv_to_rgb'=143
'int_to_rgb'=144
'rgb_to_int'=145
'interpolate_linear'=146
'interpolate_area'=147
'text_image'=149
'if'=153
'else'=154
'while'=155
'for'=156
'in'=157
'break'=158
'continue'=159
'return'=160
'sort'=162
'argsort'=163
'argmin'=164
'argmax'=165
'softmax'=166
'softmin'=167
'unique'=168
'flip'=169
'startswith'=170
'endswith'=171
'squeeze'=172
'unsqueeze'=173
'roll'=174
'cov'=175
'entropy'=177
'crop'=178
'+'=200
'-'=201
'*'=202
'/'=203
'%'=204
'^'=205
'<<'=206
'>>'=207
'>='=208
'>'=209
'<='=210
'<'=211
'=='=212
'='=213
'+='=214
'-='=215
'*='=216
'/='=217
'%='=218
'!='=219
'|'=220
'('=221
')'=222
','=223
';'=224
'->'=225
'['=226
']'=227
'?'=228
':'=229
'{'=230
'}'=231
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+409
View File
@@ -0,0 +1,409 @@
SIN=1
COS=2
TAN=3
ASIN=4
ACOS=5
ATAN=6
ATAN2=7
SINH=8
COSH=9
TANH=10
ASINH=11
ACOSH=12
ATANH=13
ABS=14
SQRT=15
LN=16
LOG=17
EXP=18
SMIN=19
SMAX=20
TMIN=21
TMAX=22
TNORM=23
SNORM=24
FLOOR=25
CEIL=26
ROUND=27
GAMMA=28
POWE=29
SIGM=30
CLAMP=31
SFFT=32
SIFFT=33
ANGL=34
PRNT=35
PRINT_SHAPE=36
NVL=37
LERP=38
STEP=39
SMOOTHSTEP=40
FRACT=41
RELU=42
SOFTPLUS=43
GELU=44
SIGN=45
MAP=46
EZCONV=47
CONV=48
SWAP=49
PERM=50
RESHAPE=51
RANGE=52
LINSPACE=53
LOGSPACE=54
TOPK=55
BOTK=56
PINV=57
SUM=58
MEAN=59
STD=60
VAR=61
QUARTILE=62
PERCENTILE=63
QUANTILE=64
DOT=65
MOMENT=66
ERF=67
ERFINV=68
ANY=69
ALL=70
EDGE=71
GAUSSIAN=72
MEDIAN=73
MODE=74
CUMSUM=75
CUMPROD=76
TOPK_IND=77
BOTK_IND=78
CUBIC_EASE=79
ELASTIC_EASE=80
SINE_EASE=81
SMOOTHERSTEP=82
DIST=83
REMAP=84
COSSIM=85
COUNT=86
KEYS=87
GET_CHANGED_KEYS=88
GET_ADDED_KEYS=89
GET_REMOVED_KEYS=90
GET_UNCHANGED_KEYS=91
REPEAT=92
FLATTEN=93
APPEND=94
GET_VALUE=95
FLOW_APPLY=96
BATCH_SHUFFLE=97
MOTION_MASK=98
FLOW_TO_IMAGE=99
FLOW_MAG=100
FLOW_ANG=101
WHERE=102
HISTOGRAM=103
OVERLAY=104
PAD=105
CROSS=106
MATMUL=107
RIFE=108
BNOT=109
BITCOUNT=110
SHAPE=111
BAND=112
XOR=113
BOR=114
TENSOR=115
ADD_KEY=116
REMOVE_KEY=117
PUSH=118
POP=119
CLEAR=120
HAS=121
GET=122
CONCAT=123
INT=124
FLOAT=125
UPPER=126
LOWER=127
TRIM=128
SPLIT=129
JOIN=130
SUBSTRING=131
FIND=132
REPLACE=133
DILATE=134
ERODE=135
MORPH_OPEN=136
MORPH_CLOSE=137
RGB_TO_OKLAB=138
RGB_TO_CIELAB=139
OKLAB_TO_RGB=140
CIELAB_TO_RGB=141
RGB_TO_HSV=142
HSV_TO_RGB=143
INT_TO_RGB=144
RGB_TO_INT=145
INTERPOLATE_LINEAR=146
INTERPOLATE_AREA=147
INTERPOLATE_NEAREST=148
TEXT_IMAGE=149
AS_NESTED=150
SVD=151
DIAG=152
IF=153
ELSE=154
WHILE=155
FOR=156
IN=157
BREAK=158
CONTINUE=159
RETURN=160
TIMESTAMP=161
SORT=162
ARGSORT=163
ARGMIN=164
ARGMAX=165
SOFTMAX=166
SOFTMIN=167
UNIQUE=168
FLIP=169
STARTSWITH=170
ENDSWITH=171
SQUEEZE=172
UNSQUEEZE=173
ROLL=174
COV=175
CORR=176
ENTROPY=177
CROP=178
NONE=179
COORDS=180
NOISE=181
RAND=182
CAUCHY=183
EXPONENTIAL=184
LOGNORMAL=185
BERNOULLI=186
POISSON=187
GAMMADIST=188
BETADIST=189
LAPLACEDIST=190
GUMBELDIST=191
WEIBULLDIST=192
CHI2DIST=193
STUDENTTDIST=194
PERLIN=195
CELLULAR=196
PLASMA=197
RIDGED=198
DOMAIN_WARP=199
PLUS=200
MINUS=201
MULT=202
DIV=203
MOD=204
POW=205
LSHIFT=206
RSHIFT=207
GE=208
GT=209
LE=210
LT=211
EQ=212
EQUEALS=213
PLUS_EQ=214
MINUS_EQ=215
MULT_EQ=216
DIV_EQ=217
MOD_EQ=218
NE=219
PIPE=220
LPAREN=221
RPAREN=222
COMMA=223
SEMICOLON=224
ARROW=225
LBRACKET=226
RBRACKET=227
QUESTION=228
COLON=229
LBRACE=230
RBRACE=231
NUMBER=232
CONSTANT=233
STRING=234
VARIABLE=235
SL_COMMENT=236
ML_COMMENT=237
WS=238
'sin'=1
'cos'=2
'tan'=3
'asin'=4
'acos'=5
'atan'=6
'atan2'=7
'sinh'=8
'cosh'=9
'tanh'=10
'asinh'=11
'acosh'=12
'atanh'=13
'abs'=14
'sqrt'=15
'ln'=16
'log'=17
'exp'=18
'smin'=19
'smax'=20
'tmin'=21
'tmax'=22
'tnorm'=23
'snorm'=24
'floor'=25
'ceil'=26
'round'=27
'gamma'=28
'pow'=29
'sigm'=30
'clamp'=31
'fft'=32
'ifft'=33
'angle'=34
'print'=35
'lerp'=38
'step'=39
'smoothstep'=40
'fract'=41
'relu'=42
'softplus'=43
'gelu'=44
'sign'=45
'map'=46
'swap'=49
'range'=52
'linspace'=53
'logspace'=54
'topk'=55
'botk'=56
'pinv'=57
'sum'=58
'mean'=59
'std'=60
'var'=61
'quantile'=64
'dot'=65
'moment'=66
'erf'=67
'erfinv'=68
'any'=69
'all'=70
'edge'=71
'median'=73
'mode'=74
'cumsum'=75
'cumprod'=76
'smootherstep'=82
'remap'=84
'keys'=87
'repeat'=92
'flatten'=93
'append'=94
'get_value'=95
'flow_apply'=96
'motion_mask'=98
'flow_to_image'=99
'where'=102
'overlay'=104
'pad'=105
'cross'=106
'matmul'=107
'rife'=108
'shape'=111
'tensor'=115
'add_key'=116
'stack_push'=118
'stack_pop'=119
'stack_clear'=120
'stack_has'=121
'stack_get'=122
'int'=124
'float'=125
'upper'=126
'lower'=127
'trim'=128
'split'=129
'join'=130
'find'=132
'replace'=133
'dilate'=134
'erode'=135
'morph_open'=136
'morph_close'=137
'rgb_to_oklab'=138
'rgb_to_cielab'=139
'oklab_to_rgb'=140
'cielab_to_rgb'=141
'rgb_to_hsv'=142
'hsv_to_rgb'=143
'int_to_rgb'=144
'rgb_to_int'=145
'interpolate_linear'=146
'interpolate_area'=147
'text_image'=149
'if'=153
'else'=154
'while'=155
'for'=156
'in'=157
'break'=158
'continue'=159
'return'=160
'sort'=162
'argsort'=163
'argmin'=164
'argmax'=165
'softmax'=166
'softmin'=167
'unique'=168
'flip'=169
'startswith'=170
'endswith'=171
'squeeze'=172
'unsqueeze'=173
'roll'=174
'cov'=175
'entropy'=177
'crop'=178
'+'=200
'-'=201
'*'=202
'/'=203
'%'=204
'^'=205
'<<'=206
'>>'=207
'>='=208
'>'=209
'<='=210
'<'=211
'=='=212
'='=213
'+='=214
'-='=215
'*='=216
'/='=217
'%='=218
'!='=219
'|'=220
'('=221
')'=222
','=223
';'=224
'->'=225
'['=226
']'=227
'?'=228
':'=229
'{'=230
'}'=231
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+40 -15
View File
@@ -178,7 +178,7 @@ class UnifiedMathVisitor(MathExprVisitor):
return isinstance(val, (list, tuple))
def _is_math_dict(self, val):
return isinstance(val, MathDict)
return isinstance(val, (MathDict, ChangeTrackingDict))
def _map_math_dict(self, op, *values):
dictionaries = [value for value in values if self._is_math_dict(value)]
@@ -190,7 +190,11 @@ class UnifiedMathVisitor(MathExprVisitor):
if any(set(value) != key_set for value in dictionaries[1:]):
raise ValueError("Dictionary operations require matching keys")
return MathDict({key: op(*(value[key] if self._is_math_dict(value) else value for value in values)) for key in keys})
# Determine result type: if any input is ChangeTrackingDict, create ChangeTrackingDict
result_dict = {key: op(*(value[key] if self._is_math_dict(value) else value for value in values)) for key in keys}
if any(isinstance(value, ChangeTrackingDict) for value in dictionaries):
return ChangeTrackingDict(result_dict)
return MathDict(result_dict)
def _where_value(self, condition, true_value, false_value):
if self._is_tensor(condition) or self._is_tensor(true_value) or self._is_tensor(false_value):
@@ -224,13 +228,19 @@ class UnifiedMathVisitor(MathExprVisitor):
if self._is_math_dict(a) and not self._is_math_dict(b):
if not self._is_tensor(b) and not self._is_list(b):
# a is dict, b is scalar - apply op directly to all dict values
return MathDict({key: (torch_op(a[key], b) if torch_op else scalar_op(a[key], b))
for key in a})
result = {key: (torch_op(a[key], b) if torch_op else scalar_op(a[key], b))
for key in a}
if isinstance(a, ChangeTrackingDict):
return ChangeTrackingDict(result)
return MathDict(result)
elif self._is_math_dict(b) and not self._is_math_dict(a):
if not self._is_tensor(a) and not self._is_list(a):
# b is dict, a is scalar - apply op directly to all dict values
return MathDict({key: (torch_op(a, b[key]) if torch_op else scalar_op(a, b[key]))
for key in b})
result = {key: (torch_op(a, b[key]) if torch_op else scalar_op(a, b[key]))
for key in b}
if isinstance(b, ChangeTrackingDict):
return ChangeTrackingDict(result)
return MathDict(result)
if self._is_math_dict(a) or self._is_math_dict(b):
return self._map_math_dict(lambda left, right: self._bin_op(left, right, torch_op, scalar_op, ctx), a, b)
@@ -1744,6 +1754,30 @@ class UnifiedMathVisitor(MathExprVisitor):
raise ValueError(f"{ctx.start.line}:{ctx.start.column}: keys() requires a dictionary")
return list(val)
def visitGetChangedKeysFunc(self, ctx):
val = yield ctx.expr()
if not isinstance(val, ChangeTrackingDict):
raise ValueError(f"{ctx.start.line}:{ctx.start.column}: get_changed_keys() requires a ChangeTrackingDict")
return list(val.get_changed_keys())
def visitGetAddedKeysFunc(self, ctx):
val = yield ctx.expr()
if not isinstance(val, ChangeTrackingDict):
raise ValueError(f"{ctx.start.line}:{ctx.start.column}: get_added_keys() requires a ChangeTrackingDict")
return list(val.get_added_keys())
def visitGetRemovedKeysFunc(self, ctx):
val = yield ctx.expr()
if not isinstance(val, ChangeTrackingDict):
raise ValueError(f"{ctx.start.line}:{ctx.start.column}: get_removed_keys() requires a ChangeTrackingDict")
return list(val.get_removed_keys())
def visitGetUnchangedKeysFunc(self, ctx):
val = yield ctx.expr()
if not isinstance(val, ChangeTrackingDict):
raise ValueError(f"{ctx.start.line}:{ctx.start.column}: get_unchanged_keys() requires a ChangeTrackingDict")
return list(val.get_unchanged_keys())
def visitMeanFunc(self, ctx):
return self._reduction_op(
(yield ctx.expr()), lambda x: torch.mean(x.float()), lambda x: sum(x) / len(x) if x else 0.0
@@ -2584,15 +2618,6 @@ class UnifiedMathVisitor(MathExprVisitor):
def visitCallExp(self, ctx):
func_name = ctx.VARIABLE().getText()
if func_name == "keys":
args = ctx.exprList().expr() if ctx.exprList() else []
if len(args) != 1:
raise ValueError(f"{ctx.start.line}:{ctx.start.column}: keys() expects 1 argument")
value = yield args[0]
if not isinstance(value, dict):
raise ValueError(f"{ctx.start.line}:{ctx.start.column}: keys() requires a dictionary")
return list(value)
# 1) Pokud proměnná existuje a je to lambda uložená v variables, aplikuj ji
if func_name in self.variables and isinstance(self.variables[func_name], LambdaFunction):
lam = self.variables[func_name]
File diff suppressed because one or more lines are too long
+252 -248
View File
@@ -85,153 +85,157 @@ REMAP=84
COSSIM=85
COUNT=86
KEYS=87
REPEAT=88
FLATTEN=89
APPEND=90
GET_VALUE=91
FLOW_APPLY=92
BATCH_SHUFFLE=93
MOTION_MASK=94
FLOW_TO_IMAGE=95
FLOW_MAG=96
FLOW_ANG=97
WHERE=98
HISTOGRAM=99
OVERLAY=100
PAD=101
CROSS=102
MATMUL=103
RIFE=104
BNOT=105
BITCOUNT=106
SHAPE=107
BAND=108
XOR=109
BOR=110
TENSOR=111
ADD_KEY=112
REMOVE_KEY=113
PUSH=114
POP=115
CLEAR=116
HAS=117
GET=118
CONCAT=119
INT=120
FLOAT=121
UPPER=122
LOWER=123
TRIM=124
SPLIT=125
JOIN=126
SUBSTRING=127
FIND=128
REPLACE=129
DILATE=130
ERODE=131
MORPH_OPEN=132
MORPH_CLOSE=133
RGB_TO_OKLAB=134
RGB_TO_CIELAB=135
OKLAB_TO_RGB=136
CIELAB_TO_RGB=137
RGB_TO_HSV=138
HSV_TO_RGB=139
INT_TO_RGB=140
RGB_TO_INT=141
INTERPOLATE_LINEAR=142
INTERPOLATE_AREA=143
INTERPOLATE_NEAREST=144
TEXT_IMAGE=145
AS_NESTED=146
SVD=147
DIAG=148
IF=149
ELSE=150
WHILE=151
FOR=152
IN=153
BREAK=154
CONTINUE=155
RETURN=156
TIMESTAMP=157
SORT=158
ARGSORT=159
ARGMIN=160
ARGMAX=161
SOFTMAX=162
SOFTMIN=163
UNIQUE=164
FLIP=165
STARTSWITH=166
ENDSWITH=167
SQUEEZE=168
UNSQUEEZE=169
ROLL=170
COV=171
CORR=172
ENTROPY=173
CROP=174
NONE=175
COORDS=176
NOISE=177
RAND=178
CAUCHY=179
EXPONENTIAL=180
LOGNORMAL=181
BERNOULLI=182
POISSON=183
GAMMADIST=184
BETADIST=185
LAPLACEDIST=186
GUMBELDIST=187
WEIBULLDIST=188
CHI2DIST=189
STUDENTTDIST=190
PERLIN=191
CELLULAR=192
PLASMA=193
RIDGED=194
DOMAIN_WARP=195
PLUS=196
MINUS=197
MULT=198
DIV=199
MOD=200
POW=201
LSHIFT=202
RSHIFT=203
GE=204
GT=205
LE=206
LT=207
EQ=208
EQUEALS=209
PLUS_EQ=210
MINUS_EQ=211
MULT_EQ=212
DIV_EQ=213
MOD_EQ=214
NE=215
PIPE=216
LPAREN=217
RPAREN=218
COMMA=219
SEMICOLON=220
ARROW=221
LBRACKET=222
RBRACKET=223
QUESTION=224
COLON=225
LBRACE=226
RBRACE=227
NUMBER=228
CONSTANT=229
STRING=230
VARIABLE=231
SL_COMMENT=232
ML_COMMENT=233
WS=234
GET_CHANGED_KEYS=88
GET_ADDED_KEYS=89
GET_REMOVED_KEYS=90
GET_UNCHANGED_KEYS=91
REPEAT=92
FLATTEN=93
APPEND=94
GET_VALUE=95
FLOW_APPLY=96
BATCH_SHUFFLE=97
MOTION_MASK=98
FLOW_TO_IMAGE=99
FLOW_MAG=100
FLOW_ANG=101
WHERE=102
HISTOGRAM=103
OVERLAY=104
PAD=105
CROSS=106
MATMUL=107
RIFE=108
BNOT=109
BITCOUNT=110
SHAPE=111
BAND=112
XOR=113
BOR=114
TENSOR=115
ADD_KEY=116
REMOVE_KEY=117
PUSH=118
POP=119
CLEAR=120
HAS=121
GET=122
CONCAT=123
INT=124
FLOAT=125
UPPER=126
LOWER=127
TRIM=128
SPLIT=129
JOIN=130
SUBSTRING=131
FIND=132
REPLACE=133
DILATE=134
ERODE=135
MORPH_OPEN=136
MORPH_CLOSE=137
RGB_TO_OKLAB=138
RGB_TO_CIELAB=139
OKLAB_TO_RGB=140
CIELAB_TO_RGB=141
RGB_TO_HSV=142
HSV_TO_RGB=143
INT_TO_RGB=144
RGB_TO_INT=145
INTERPOLATE_LINEAR=146
INTERPOLATE_AREA=147
INTERPOLATE_NEAREST=148
TEXT_IMAGE=149
AS_NESTED=150
SVD=151
DIAG=152
IF=153
ELSE=154
WHILE=155
FOR=156
IN=157
BREAK=158
CONTINUE=159
RETURN=160
TIMESTAMP=161
SORT=162
ARGSORT=163
ARGMIN=164
ARGMAX=165
SOFTMAX=166
SOFTMIN=167
UNIQUE=168
FLIP=169
STARTSWITH=170
ENDSWITH=171
SQUEEZE=172
UNSQUEEZE=173
ROLL=174
COV=175
CORR=176
ENTROPY=177
CROP=178
NONE=179
COORDS=180
NOISE=181
RAND=182
CAUCHY=183
EXPONENTIAL=184
LOGNORMAL=185
BERNOULLI=186
POISSON=187
GAMMADIST=188
BETADIST=189
LAPLACEDIST=190
GUMBELDIST=191
WEIBULLDIST=192
CHI2DIST=193
STUDENTTDIST=194
PERLIN=195
CELLULAR=196
PLASMA=197
RIDGED=198
DOMAIN_WARP=199
PLUS=200
MINUS=201
MULT=202
DIV=203
MOD=204
POW=205
LSHIFT=206
RSHIFT=207
GE=208
GT=209
LE=210
LT=211
EQ=212
EQUEALS=213
PLUS_EQ=214
MINUS_EQ=215
MULT_EQ=216
DIV_EQ=217
MOD_EQ=218
NE=219
PIPE=220
LPAREN=221
RPAREN=222
COMMA=223
SEMICOLON=224
ARROW=225
LBRACKET=226
RBRACKET=227
QUESTION=228
COLON=229
LBRACE=230
RBRACE=231
NUMBER=232
CONSTANT=233
STRING=234
VARIABLE=235
SL_COMMENT=236
ML_COMMENT=237
WS=238
'sin'=1
'cos'=2
'tan'=3
@@ -302,104 +306,104 @@ WS=234
'smootherstep'=82
'remap'=84
'keys'=87
'repeat'=88
'flatten'=89
'append'=90
'get_value'=91
'flow_apply'=92
'motion_mask'=94
'flow_to_image'=95
'where'=98
'overlay'=100
'pad'=101
'cross'=102
'matmul'=103
'rife'=104
'shape'=107
'tensor'=111
'add_key'=112
'stack_push'=114
'stack_pop'=115
'stack_clear'=116
'stack_has'=117
'stack_get'=118
'int'=120
'float'=121
'upper'=122
'lower'=123
'trim'=124
'split'=125
'join'=126
'find'=128
'replace'=129
'dilate'=130
'erode'=131
'morph_open'=132
'morph_close'=133
'rgb_to_oklab'=134
'rgb_to_cielab'=135
'oklab_to_rgb'=136
'cielab_to_rgb'=137
'rgb_to_hsv'=138
'hsv_to_rgb'=139
'int_to_rgb'=140
'rgb_to_int'=141
'interpolate_linear'=142
'interpolate_area'=143
'text_image'=145
'if'=149
'else'=150
'while'=151
'for'=152
'in'=153
'break'=154
'continue'=155
'return'=156
'sort'=158
'argsort'=159
'argmin'=160
'argmax'=161
'softmax'=162
'softmin'=163
'unique'=164
'flip'=165
'startswith'=166
'endswith'=167
'squeeze'=168
'unsqueeze'=169
'roll'=170
'cov'=171
'entropy'=173
'crop'=174
'+'=196
'-'=197
'*'=198
'/'=199
'%'=200
'^'=201
'<<'=202
'>>'=203
'>='=204
'>'=205
'<='=206
'<'=207
'=='=208
'='=209
'+='=210
'-='=211
'*='=212
'/='=213
'%='=214
'!='=215
'|'=216
'('=217
')'=218
','=219
';'=220
'->'=221
'['=222
']'=223
'?'=224
':'=225
'{'=226
'}'=227
'repeat'=92
'flatten'=93
'append'=94
'get_value'=95
'flow_apply'=96
'motion_mask'=98
'flow_to_image'=99
'where'=102
'overlay'=104
'pad'=105
'cross'=106
'matmul'=107
'rife'=108
'shape'=111
'tensor'=115
'add_key'=116
'stack_push'=118
'stack_pop'=119
'stack_clear'=120
'stack_has'=121
'stack_get'=122
'int'=124
'float'=125
'upper'=126
'lower'=127
'trim'=128
'split'=129
'join'=130
'find'=132
'replace'=133
'dilate'=134
'erode'=135
'morph_open'=136
'morph_close'=137
'rgb_to_oklab'=138
'rgb_to_cielab'=139
'oklab_to_rgb'=140
'cielab_to_rgb'=141
'rgb_to_hsv'=142
'hsv_to_rgb'=143
'int_to_rgb'=144
'rgb_to_int'=145
'interpolate_linear'=146
'interpolate_area'=147
'text_image'=149
'if'=153
'else'=154
'while'=155
'for'=156
'in'=157
'break'=158
'continue'=159
'return'=160
'sort'=162
'argsort'=163
'argmin'=164
'argmax'=165
'softmax'=166
'softmin'=167
'unique'=168
'flip'=169
'startswith'=170
'endswith'=171
'squeeze'=172
'unsqueeze'=173
'roll'=174
'cov'=175
'entropy'=177
'crop'=178
'+'=200
'-'=201
'*'=202
'/'=203
'%'=204
'^'=205
'<<'=206
'>>'=207
'>='=208
'>'=209
'<='=210
'<'=211
'=='=212
'='=213
'+='=214
'-='=215
'*='=216
'/='=217
'%='=218
'!='=219
'|'=220
'('=221
')'=222
','=223
';'=224
'->'=225
'['=226
']'=227
'?'=228
':'=229
'{'=230
'}'=231
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+252 -248
View File
@@ -85,153 +85,157 @@ REMAP=84
COSSIM=85
COUNT=86
KEYS=87
REPEAT=88
FLATTEN=89
APPEND=90
GET_VALUE=91
FLOW_APPLY=92
BATCH_SHUFFLE=93
MOTION_MASK=94
FLOW_TO_IMAGE=95
FLOW_MAG=96
FLOW_ANG=97
WHERE=98
HISTOGRAM=99
OVERLAY=100
PAD=101
CROSS=102
MATMUL=103
RIFE=104
BNOT=105
BITCOUNT=106
SHAPE=107
BAND=108
XOR=109
BOR=110
TENSOR=111
ADD_KEY=112
REMOVE_KEY=113
PUSH=114
POP=115
CLEAR=116
HAS=117
GET=118
CONCAT=119
INT=120
FLOAT=121
UPPER=122
LOWER=123
TRIM=124
SPLIT=125
JOIN=126
SUBSTRING=127
FIND=128
REPLACE=129
DILATE=130
ERODE=131
MORPH_OPEN=132
MORPH_CLOSE=133
RGB_TO_OKLAB=134
RGB_TO_CIELAB=135
OKLAB_TO_RGB=136
CIELAB_TO_RGB=137
RGB_TO_HSV=138
HSV_TO_RGB=139
INT_TO_RGB=140
RGB_TO_INT=141
INTERPOLATE_LINEAR=142
INTERPOLATE_AREA=143
INTERPOLATE_NEAREST=144
TEXT_IMAGE=145
AS_NESTED=146
SVD=147
DIAG=148
IF=149
ELSE=150
WHILE=151
FOR=152
IN=153
BREAK=154
CONTINUE=155
RETURN=156
TIMESTAMP=157
SORT=158
ARGSORT=159
ARGMIN=160
ARGMAX=161
SOFTMAX=162
SOFTMIN=163
UNIQUE=164
FLIP=165
STARTSWITH=166
ENDSWITH=167
SQUEEZE=168
UNSQUEEZE=169
ROLL=170
COV=171
CORR=172
ENTROPY=173
CROP=174
NONE=175
COORDS=176
NOISE=177
RAND=178
CAUCHY=179
EXPONENTIAL=180
LOGNORMAL=181
BERNOULLI=182
POISSON=183
GAMMADIST=184
BETADIST=185
LAPLACEDIST=186
GUMBELDIST=187
WEIBULLDIST=188
CHI2DIST=189
STUDENTTDIST=190
PERLIN=191
CELLULAR=192
PLASMA=193
RIDGED=194
DOMAIN_WARP=195
PLUS=196
MINUS=197
MULT=198
DIV=199
MOD=200
POW=201
LSHIFT=202
RSHIFT=203
GE=204
GT=205
LE=206
LT=207
EQ=208
EQUEALS=209
PLUS_EQ=210
MINUS_EQ=211
MULT_EQ=212
DIV_EQ=213
MOD_EQ=214
NE=215
PIPE=216
LPAREN=217
RPAREN=218
COMMA=219
SEMICOLON=220
ARROW=221
LBRACKET=222
RBRACKET=223
QUESTION=224
COLON=225
LBRACE=226
RBRACE=227
NUMBER=228
CONSTANT=229
STRING=230
VARIABLE=231
SL_COMMENT=232
ML_COMMENT=233
WS=234
GET_CHANGED_KEYS=88
GET_ADDED_KEYS=89
GET_REMOVED_KEYS=90
GET_UNCHANGED_KEYS=91
REPEAT=92
FLATTEN=93
APPEND=94
GET_VALUE=95
FLOW_APPLY=96
BATCH_SHUFFLE=97
MOTION_MASK=98
FLOW_TO_IMAGE=99
FLOW_MAG=100
FLOW_ANG=101
WHERE=102
HISTOGRAM=103
OVERLAY=104
PAD=105
CROSS=106
MATMUL=107
RIFE=108
BNOT=109
BITCOUNT=110
SHAPE=111
BAND=112
XOR=113
BOR=114
TENSOR=115
ADD_KEY=116
REMOVE_KEY=117
PUSH=118
POP=119
CLEAR=120
HAS=121
GET=122
CONCAT=123
INT=124
FLOAT=125
UPPER=126
LOWER=127
TRIM=128
SPLIT=129
JOIN=130
SUBSTRING=131
FIND=132
REPLACE=133
DILATE=134
ERODE=135
MORPH_OPEN=136
MORPH_CLOSE=137
RGB_TO_OKLAB=138
RGB_TO_CIELAB=139
OKLAB_TO_RGB=140
CIELAB_TO_RGB=141
RGB_TO_HSV=142
HSV_TO_RGB=143
INT_TO_RGB=144
RGB_TO_INT=145
INTERPOLATE_LINEAR=146
INTERPOLATE_AREA=147
INTERPOLATE_NEAREST=148
TEXT_IMAGE=149
AS_NESTED=150
SVD=151
DIAG=152
IF=153
ELSE=154
WHILE=155
FOR=156
IN=157
BREAK=158
CONTINUE=159
RETURN=160
TIMESTAMP=161
SORT=162
ARGSORT=163
ARGMIN=164
ARGMAX=165
SOFTMAX=166
SOFTMIN=167
UNIQUE=168
FLIP=169
STARTSWITH=170
ENDSWITH=171
SQUEEZE=172
UNSQUEEZE=173
ROLL=174
COV=175
CORR=176
ENTROPY=177
CROP=178
NONE=179
COORDS=180
NOISE=181
RAND=182
CAUCHY=183
EXPONENTIAL=184
LOGNORMAL=185
BERNOULLI=186
POISSON=187
GAMMADIST=188
BETADIST=189
LAPLACEDIST=190
GUMBELDIST=191
WEIBULLDIST=192
CHI2DIST=193
STUDENTTDIST=194
PERLIN=195
CELLULAR=196
PLASMA=197
RIDGED=198
DOMAIN_WARP=199
PLUS=200
MINUS=201
MULT=202
DIV=203
MOD=204
POW=205
LSHIFT=206
RSHIFT=207
GE=208
GT=209
LE=210
LT=211
EQ=212
EQUEALS=213
PLUS_EQ=214
MINUS_EQ=215
MULT_EQ=216
DIV_EQ=217
MOD_EQ=218
NE=219
PIPE=220
LPAREN=221
RPAREN=222
COMMA=223
SEMICOLON=224
ARROW=225
LBRACKET=226
RBRACKET=227
QUESTION=228
COLON=229
LBRACE=230
RBRACE=231
NUMBER=232
CONSTANT=233
STRING=234
VARIABLE=235
SL_COMMENT=236
ML_COMMENT=237
WS=238
'sin'=1
'cos'=2
'tan'=3
@@ -302,104 +306,104 @@ WS=234
'smootherstep'=82
'remap'=84
'keys'=87
'repeat'=88
'flatten'=89
'append'=90
'get_value'=91
'flow_apply'=92
'motion_mask'=94
'flow_to_image'=95
'where'=98
'overlay'=100
'pad'=101
'cross'=102
'matmul'=103
'rife'=104
'shape'=107
'tensor'=111
'add_key'=112
'stack_push'=114
'stack_pop'=115
'stack_clear'=116
'stack_has'=117
'stack_get'=118
'int'=120
'float'=121
'upper'=122
'lower'=123
'trim'=124
'split'=125
'join'=126
'find'=128
'replace'=129
'dilate'=130
'erode'=131
'morph_open'=132
'morph_close'=133
'rgb_to_oklab'=134
'rgb_to_cielab'=135
'oklab_to_rgb'=136
'cielab_to_rgb'=137
'rgb_to_hsv'=138
'hsv_to_rgb'=139
'int_to_rgb'=140
'rgb_to_int'=141
'interpolate_linear'=142
'interpolate_area'=143
'text_image'=145
'if'=149
'else'=150
'while'=151
'for'=152
'in'=153
'break'=154
'continue'=155
'return'=156
'sort'=158
'argsort'=159
'argmin'=160
'argmax'=161
'softmax'=162
'softmin'=163
'unique'=164
'flip'=165
'startswith'=166
'endswith'=167
'squeeze'=168
'unsqueeze'=169
'roll'=170
'cov'=171
'entropy'=173
'crop'=174
'+'=196
'-'=197
'*'=198
'/'=199
'%'=200
'^'=201
'<<'=202
'>>'=203
'>='=204
'>'=205
'<='=206
'<'=207
'=='=208
'='=209
'+='=210
'-='=211
'*='=212
'/='=213
'%='=214
'!='=215
'|'=216
'('=217
')'=218
','=219
';'=220
'->'=221
'['=222
']'=223
'?'=224
':'=225
'{'=226
'}'=227
'repeat'=92
'flatten'=93
'append'=94
'get_value'=95
'flow_apply'=96
'motion_mask'=98
'flow_to_image'=99
'where'=102
'overlay'=104
'pad'=105
'cross'=106
'matmul'=107
'rife'=108
'shape'=111
'tensor'=115
'add_key'=116
'stack_push'=118
'stack_pop'=119
'stack_clear'=120
'stack_has'=121
'stack_get'=122
'int'=124
'float'=125
'upper'=126
'lower'=127
'trim'=128
'split'=129
'join'=130
'find'=132
'replace'=133
'dilate'=134
'erode'=135
'morph_open'=136
'morph_close'=137
'rgb_to_oklab'=138
'rgb_to_cielab'=139
'oklab_to_rgb'=140
'cielab_to_rgb'=141
'rgb_to_hsv'=142
'hsv_to_rgb'=143
'int_to_rgb'=144
'rgb_to_int'=145
'interpolate_linear'=146
'interpolate_area'=147
'text_image'=149
'if'=153
'else'=154
'while'=155
'for'=156
'in'=157
'break'=158
'continue'=159
'return'=160
'sort'=162
'argsort'=163
'argmin'=164
'argmax'=165
'softmax'=166
'softmin'=167
'unique'=168
'flip'=169
'startswith'=170
'endswith'=171
'squeeze'=172
'unsqueeze'=173
'roll'=174
'cov'=175
'entropy'=177
'crop'=178
'+'=200
'-'=201
'*'=202
'/'=203
'%'=204
'^'=205
'<<'=206
'>>'=207
'>='=208
'>'=209
'<='=210
'<'=211
'=='=212
'='=213
'+='=214
'-='=215
'*='=216
'/='=217
'%='=218
'!='=219
'|'=220
'('=221
')'=222
','=223
';'=224
'->'=225
'['=226
']'=227
'?'=228
':'=229
'{'=230
'}'=231
@@ -2222,6 +2222,42 @@ class MathExprListener(ParseTreeListener):
pass
# Enter a parse tree produced by MathExprParser#GetChangedKeysFunc.
def enterGetChangedKeysFunc(self, ctx:MathExprParser.GetChangedKeysFuncContext):
pass
# Exit a parse tree produced by MathExprParser#GetChangedKeysFunc.
def exitGetChangedKeysFunc(self, ctx:MathExprParser.GetChangedKeysFuncContext):
pass
# Enter a parse tree produced by MathExprParser#GetAddedKeysFunc.
def enterGetAddedKeysFunc(self, ctx:MathExprParser.GetAddedKeysFuncContext):
pass
# Exit a parse tree produced by MathExprParser#GetAddedKeysFunc.
def exitGetAddedKeysFunc(self, ctx:MathExprParser.GetAddedKeysFuncContext):
pass
# Enter a parse tree produced by MathExprParser#GetRemovedKeysFunc.
def enterGetRemovedKeysFunc(self, ctx:MathExprParser.GetRemovedKeysFuncContext):
pass
# Exit a parse tree produced by MathExprParser#GetRemovedKeysFunc.
def exitGetRemovedKeysFunc(self, ctx:MathExprParser.GetRemovedKeysFuncContext):
pass
# Enter a parse tree produced by MathExprParser#GetUnchangedKeysFunc.
def enterGetUnchangedKeysFunc(self, ctx:MathExprParser.GetUnchangedKeysFuncContext):
pass
# Exit a parse tree produced by MathExprParser#GetUnchangedKeysFunc.
def exitGetUnchangedKeysFunc(self, ctx:MathExprParser.GetUnchangedKeysFuncContext):
pass
# Enter a parse tree produced by MathExprParser#NoiseFunc.
def enterNoiseFunc(self, ctx:MathExprParser.NoiseFuncContext):
pass
File diff suppressed because it is too large Load Diff
@@ -1239,6 +1239,26 @@ class MathExprVisitor(ParseTreeVisitor):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#GetChangedKeysFunc.
def visitGetChangedKeysFunc(self, ctx:MathExprParser.GetChangedKeysFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#GetAddedKeysFunc.
def visitGetAddedKeysFunc(self, ctx:MathExprParser.GetAddedKeysFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#GetRemovedKeysFunc.
def visitGetRemovedKeysFunc(self, ctx:MathExprParser.GetRemovedKeysFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#GetUnchangedKeysFunc.
def visitGetUnchangedKeysFunc(self, ctx:MathExprParser.GetUnchangedKeysFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#NoiseFunc.
def visitNoiseFunc(self, ctx:MathExprParser.NoiseFuncContext):
return self.visitChildren(ctx)
+9 -1
View File
@@ -6,7 +6,7 @@ INBUILT_CONSTANTS = {
'e', 'pi'
}
INBUILT_FUNCTIONS = {
'abs', 'acos', 'acosh', 'add_key', 'all', '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', 'bxor', 'cat', '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', 'cubic', 'cubic_ease', 'cumprod', 'cumsum', 'diag', 'diagonal_matrix', 'dilate', 'dist', 'distance', 'domain_warp', 'domain_warp_noise', 'dot', 'edge', 'elastic', 'elastic_ease', 'endswith', 'entropy', 'erf', 'erfinv', 'erode', 'exp', 'ezconv', 'ezconvolution', 'fft', 'find', 'flatten', 'flip', 'float', 'floor', 'flow_ang', 'flow_angle', 'flow_apply', 'flow_mag', 'flow_magnitude', 'flow_to_image', 'fract', 'gamma', 'gaussian', 'gelu', 'get_value', 'hist', 'histogram', 'hsv_to_rgb', 'ifft', 'int', 'int_to_rgb', 'interpolate_area', 'interpolate_linear', 'interpolate_nearest', 'interpolate_nearest_exact', 'join', 'keys', 'length', 'lerp', 'linspace', 'ln', 'log', 'logspace', 'lower', 'map', 'matmul', 'mean', 'median', 'mode', 'moment', 'morph_close', 'morph_open', 'motion_mask', 'nan_to_num', 'noise', 'now', 'nvl', 'oklab_to_rgb', 'overlay', 'pad', 'percentile', 'perlin', 'perlin_noise', 'perm', 'permute', 'pinv', 'plasma', 'plasma_noise', 'popcnt', 'popcount', 'pow', 'prcnt', 'print', 'print_shape', 'pshp', 'quantile', 'quartil', 'quartile', 'rand', 'randb', 'randbeta', 'randc', 'rande', 'randg', 'randgumbel', 'randchi2', 'randl', 'randln', 'randn', 'random_bernoulli', 'random_beta', 'random_cauchy', 'random_exponential', 'random_gamma', 'random_gumbel', 'random_chi2', 'random_laplace', 'random_log_normal', 'random_normal', 'random_poisson', 'random_studentt', 'random_uniform', 'random_weibull', 'randp', 'randt', 'randu', 'randw', 'range', 'relu', 'remap', 'remove_key', 'repeat', 'replace', 'reshape', 'rgb_to_cielab', 'rgb_to_hsv', 'rgb_to_int', 'rgb_to_oklab', 'ridged', 'ridged_noise', 'rife', 'rm_key', 'roll', 'round', 'rshp', 'select', 'shape', 'shuffle', 'sigm', 'sign', 'sin', 'sine', 'sine_ease', 'singular_value_decomposition', 'sinh', 'smax', 'smin', 'smootherstep', 'smoothstep', 'snorm', 'softmax', 'softmin', 'softplus', 'sort', 'split', 'sqrt', 'squeeze', 'stack_clear', 'stack_get', 'stack_has', 'stack_pop', 'stack_push', 'startswith', 'std', 'step', 'substr', 'substring', 'sum', 'svd', 'swap', 'tan', 'tanh', 'tensor', 'text_image', 'timestamp', 'tmax', 'tmin', 'tnorm', 'topk', 'topk_ind', 'topk_indices', 'trim', 'turbulence', 'unique', 'unsqueeze', 'upper', 'var', 'voronoi', 'voronoi_noise', 'where', 'worley'
'abs', 'acos', 'acosh', 'add_key', 'added_keys', 'all', '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', 'bxor', 'cat', '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', 'cubic', 'cubic_ease', 'cumprod', 'cumsum', 'diag', 'diagonal_matrix', 'dilate', 'dist', 'distance', 'domain_warp', 'domain_warp_noise', 'dot', 'edge', 'elastic', 'elastic_ease', 'endswith', 'entropy', 'erf', 'erfinv', 'erode', 'exp', 'ezconv', 'ezconvolution', 'fft', 'find', 'flatten', 'flip', 'float', 'floor', 'flow_ang', 'flow_angle', 'flow_apply', 'flow_mag', 'flow_magnitude', 'flow_to_image', 'fract', 'gamma', 'gaussian', 'gelu', 'get_added_keys', 'get_changed_keys', 'get_removed_keys', 'get_unchanged_keys', 'get_value', 'hist', 'histogram', 'hsv_to_rgb', 'changed_keys', 'ifft', 'int', 'int_to_rgb', 'interpolate_area', 'interpolate_linear', 'interpolate_nearest', 'interpolate_nearest_exact', 'join', 'keys', 'length', 'lerp', 'linspace', 'ln', 'log', 'logspace', 'lower', 'map', 'matmul', 'mean', 'median', 'mode', 'moment', 'morph_close', 'morph_open', 'motion_mask', 'nan_to_num', 'noise', 'now', 'nvl', 'oklab_to_rgb', 'overlay', 'pad', 'percentile', 'perlin', 'perlin_noise', 'perm', 'permute', 'pinv', 'plasma', 'plasma_noise', 'popcnt', 'popcount', 'pow', 'prcnt', 'print', 'print_shape', 'pshp', 'quantile', 'quartil', 'quartile', 'rand', 'randb', 'randbeta', 'randc', 'rande', 'randg', 'randgumbel', 'randchi2', 'randl', 'randln', 'randn', 'random_bernoulli', 'random_beta', 'random_cauchy', 'random_exponential', 'random_gamma', 'random_gumbel', 'random_chi2', 'random_laplace', 'random_log_normal', 'random_normal', 'random_poisson', 'random_studentt', 'random_uniform', 'random_weibull', 'randp', 'randt', 'randu', 'randw', 'range', 'relu', 'remap', 'remove_key', 'removed_keys', 'repeat', 'replace', 'reshape', 'rgb_to_cielab', 'rgb_to_hsv', 'rgb_to_int', 'rgb_to_oklab', 'ridged', 'ridged_noise', 'rife', 'rm_key', 'roll', 'round', 'rshp', 'select', 'shape', 'shuffle', 'sigm', 'sign', 'sin', 'sine', 'sine_ease', 'singular_value_decomposition', 'sinh', 'smax', 'smin', 'smootherstep', 'smoothstep', 'snorm', 'softmax', 'softmin', 'softplus', 'sort', 'split', 'sqrt', 'squeeze', 'stack_clear', 'stack_get', 'stack_has', 'stack_pop', 'stack_push', 'startswith', 'std', 'step', 'substr', 'substring', 'sum', 'svd', 'swap', 'tan', 'tanh', 'tensor', 'text_image', 'timestamp', 'tmax', 'tmin', 'tnorm', 'topk', 'topk_ind', 'topk_indices', 'trim', 'turbulence', 'unchanged_keys', 'unique', 'unsqueeze', 'upper', 'var', 'voronoi', 'voronoi_noise', 'where', 'worley'
}
INBUILT_FUNCTION_META = {
@@ -115,6 +115,14 @@ INBUILT_FUNCTION_META = {
'cnt': {'min_args': 1, 'max_args': 1, 'snippet': 'cnt(x)', 'description': 'returns the number of elements in x'},
'length': {'min_args': 1, 'max_args': 1, 'snippet': 'length(x)', 'description': 'returns the number of elements in x'},
'keys': {'min_args': 1, 'max_args': 1, 'snippet': 'keys(x)', 'description': 'returns a list of dictionary keys in insertion order'},
'get_changed_keys': {'min_args': 1, 'max_args': 1, 'snippet': 'get_changed_keys(d)', 'description': 'returns list of keys that were modified or added in ChangeTrackingDict d'},
'changed_keys': {'min_args': 1, 'max_args': 1, 'snippet': 'changed_keys(d)', 'description': 'returns list of keys that were modified or added in ChangeTrackingDict d'},
'get_added_keys': {'min_args': 1, 'max_args': 1, 'snippet': 'get_added_keys(d)', 'description': 'returns list of keys that were added (newly created) in ChangeTrackingDict d'},
'added_keys': {'min_args': 1, 'max_args': 1, 'snippet': 'added_keys(d)', 'description': 'returns list of keys that were added (newly created) in ChangeTrackingDict d'},
'get_removed_keys': {'min_args': 1, 'max_args': 1, 'snippet': 'get_removed_keys(d)', 'description': 'returns list of keys that were removed from ChangeTrackingDict d'},
'removed_keys': {'min_args': 1, 'max_args': 1, 'snippet': 'removed_keys(d)', 'description': 'returns list of keys that were removed from ChangeTrackingDict d'},
'get_unchanged_keys': {'min_args': 1, 'max_args': 1, 'snippet': 'get_unchanged_keys(d)', 'description': 'returns list of keys that remain unchanged in ChangeTrackingDict d'},
'unchanged_keys': {'min_args': 1, 'max_args': 1, 'snippet': 'unchanged_keys(d)', 'description': 'returns list of keys that remain unchanged in ChangeTrackingDict d'},
'repeat': {'min_args': 2, 'max_args': 3, 'snippet': 'repeat(x, count, dims)', 'description': 'repeats tensor elements; count may be scalar or per-dim list'},
'flatten': {'min_args': 1, 'max_args': 1, 'snippet': 'flatten(x)', 'description': 'flattens tensor into a 1D tensor'},
'append': {'min_args': 2, 'max_args': 2, 'snippet': 'append(x, y)', 'description': 'appends y to the end of x. If inputs are tensors use concatenate(x,...,dim)'},
File diff suppressed because one or more lines are too long
+252 -248
View File
@@ -85,153 +85,157 @@ REMAP=84
COSSIM=85
COUNT=86
KEYS=87
REPEAT=88
FLATTEN=89
APPEND=90
GET_VALUE=91
FLOW_APPLY=92
BATCH_SHUFFLE=93
MOTION_MASK=94
FLOW_TO_IMAGE=95
FLOW_MAG=96
FLOW_ANG=97
WHERE=98
HISTOGRAM=99
OVERLAY=100
PAD=101
CROSS=102
MATMUL=103
RIFE=104
BNOT=105
BITCOUNT=106
SHAPE=107
BAND=108
XOR=109
BOR=110
TENSOR=111
ADD_KEY=112
REMOVE_KEY=113
PUSH=114
POP=115
CLEAR=116
HAS=117
GET=118
CONCAT=119
INT=120
FLOAT=121
UPPER=122
LOWER=123
TRIM=124
SPLIT=125
JOIN=126
SUBSTRING=127
FIND=128
REPLACE=129
DILATE=130
ERODE=131
MORPH_OPEN=132
MORPH_CLOSE=133
RGB_TO_OKLAB=134
RGB_TO_CIELAB=135
OKLAB_TO_RGB=136
CIELAB_TO_RGB=137
RGB_TO_HSV=138
HSV_TO_RGB=139
INT_TO_RGB=140
RGB_TO_INT=141
INTERPOLATE_LINEAR=142
INTERPOLATE_AREA=143
INTERPOLATE_NEAREST=144
TEXT_IMAGE=145
AS_NESTED=146
SVD=147
DIAG=148
IF=149
ELSE=150
WHILE=151
FOR=152
IN=153
BREAK=154
CONTINUE=155
RETURN=156
TIMESTAMP=157
SORT=158
ARGSORT=159
ARGMIN=160
ARGMAX=161
SOFTMAX=162
SOFTMIN=163
UNIQUE=164
FLIP=165
STARTSWITH=166
ENDSWITH=167
SQUEEZE=168
UNSQUEEZE=169
ROLL=170
COV=171
CORR=172
ENTROPY=173
CROP=174
NONE=175
COORDS=176
NOISE=177
RAND=178
CAUCHY=179
EXPONENTIAL=180
LOGNORMAL=181
BERNOULLI=182
POISSON=183
GAMMADIST=184
BETADIST=185
LAPLACEDIST=186
GUMBELDIST=187
WEIBULLDIST=188
CHI2DIST=189
STUDENTTDIST=190
PERLIN=191
CELLULAR=192
PLASMA=193
RIDGED=194
DOMAIN_WARP=195
PLUS=196
MINUS=197
MULT=198
DIV=199
MOD=200
POW=201
LSHIFT=202
RSHIFT=203
GE=204
GT=205
LE=206
LT=207
EQ=208
EQUEALS=209
PLUS_EQ=210
MINUS_EQ=211
MULT_EQ=212
DIV_EQ=213
MOD_EQ=214
NE=215
PIPE=216
LPAREN=217
RPAREN=218
COMMA=219
SEMICOLON=220
ARROW=221
LBRACKET=222
RBRACKET=223
QUESTION=224
COLON=225
LBRACE=226
RBRACE=227
NUMBER=228
CONSTANT=229
STRING=230
VARIABLE=231
SL_COMMENT=232
ML_COMMENT=233
WS=234
GET_CHANGED_KEYS=88
GET_ADDED_KEYS=89
GET_REMOVED_KEYS=90
GET_UNCHANGED_KEYS=91
REPEAT=92
FLATTEN=93
APPEND=94
GET_VALUE=95
FLOW_APPLY=96
BATCH_SHUFFLE=97
MOTION_MASK=98
FLOW_TO_IMAGE=99
FLOW_MAG=100
FLOW_ANG=101
WHERE=102
HISTOGRAM=103
OVERLAY=104
PAD=105
CROSS=106
MATMUL=107
RIFE=108
BNOT=109
BITCOUNT=110
SHAPE=111
BAND=112
XOR=113
BOR=114
TENSOR=115
ADD_KEY=116
REMOVE_KEY=117
PUSH=118
POP=119
CLEAR=120
HAS=121
GET=122
CONCAT=123
INT=124
FLOAT=125
UPPER=126
LOWER=127
TRIM=128
SPLIT=129
JOIN=130
SUBSTRING=131
FIND=132
REPLACE=133
DILATE=134
ERODE=135
MORPH_OPEN=136
MORPH_CLOSE=137
RGB_TO_OKLAB=138
RGB_TO_CIELAB=139
OKLAB_TO_RGB=140
CIELAB_TO_RGB=141
RGB_TO_HSV=142
HSV_TO_RGB=143
INT_TO_RGB=144
RGB_TO_INT=145
INTERPOLATE_LINEAR=146
INTERPOLATE_AREA=147
INTERPOLATE_NEAREST=148
TEXT_IMAGE=149
AS_NESTED=150
SVD=151
DIAG=152
IF=153
ELSE=154
WHILE=155
FOR=156
IN=157
BREAK=158
CONTINUE=159
RETURN=160
TIMESTAMP=161
SORT=162
ARGSORT=163
ARGMIN=164
ARGMAX=165
SOFTMAX=166
SOFTMIN=167
UNIQUE=168
FLIP=169
STARTSWITH=170
ENDSWITH=171
SQUEEZE=172
UNSQUEEZE=173
ROLL=174
COV=175
CORR=176
ENTROPY=177
CROP=178
NONE=179
COORDS=180
NOISE=181
RAND=182
CAUCHY=183
EXPONENTIAL=184
LOGNORMAL=185
BERNOULLI=186
POISSON=187
GAMMADIST=188
BETADIST=189
LAPLACEDIST=190
GUMBELDIST=191
WEIBULLDIST=192
CHI2DIST=193
STUDENTTDIST=194
PERLIN=195
CELLULAR=196
PLASMA=197
RIDGED=198
DOMAIN_WARP=199
PLUS=200
MINUS=201
MULT=202
DIV=203
MOD=204
POW=205
LSHIFT=206
RSHIFT=207
GE=208
GT=209
LE=210
LT=211
EQ=212
EQUEALS=213
PLUS_EQ=214
MINUS_EQ=215
MULT_EQ=216
DIV_EQ=217
MOD_EQ=218
NE=219
PIPE=220
LPAREN=221
RPAREN=222
COMMA=223
SEMICOLON=224
ARROW=225
LBRACKET=226
RBRACKET=227
QUESTION=228
COLON=229
LBRACE=230
RBRACE=231
NUMBER=232
CONSTANT=233
STRING=234
VARIABLE=235
SL_COMMENT=236
ML_COMMENT=237
WS=238
'sin'=1
'cos'=2
'tan'=3
@@ -302,104 +306,104 @@ WS=234
'smootherstep'=82
'remap'=84
'keys'=87
'repeat'=88
'flatten'=89
'append'=90
'get_value'=91
'flow_apply'=92
'motion_mask'=94
'flow_to_image'=95
'where'=98
'overlay'=100
'pad'=101
'cross'=102
'matmul'=103
'rife'=104
'shape'=107
'tensor'=111
'add_key'=112
'stack_push'=114
'stack_pop'=115
'stack_clear'=116
'stack_has'=117
'stack_get'=118
'int'=120
'float'=121
'upper'=122
'lower'=123
'trim'=124
'split'=125
'join'=126
'find'=128
'replace'=129
'dilate'=130
'erode'=131
'morph_open'=132
'morph_close'=133
'rgb_to_oklab'=134
'rgb_to_cielab'=135
'oklab_to_rgb'=136
'cielab_to_rgb'=137
'rgb_to_hsv'=138
'hsv_to_rgb'=139
'int_to_rgb'=140
'rgb_to_int'=141
'interpolate_linear'=142
'interpolate_area'=143
'text_image'=145
'if'=149
'else'=150
'while'=151
'for'=152
'in'=153
'break'=154
'continue'=155
'return'=156
'sort'=158
'argsort'=159
'argmin'=160
'argmax'=161
'softmax'=162
'softmin'=163
'unique'=164
'flip'=165
'startswith'=166
'endswith'=167
'squeeze'=168
'unsqueeze'=169
'roll'=170
'cov'=171
'entropy'=173
'crop'=174
'+'=196
'-'=197
'*'=198
'/'=199
'%'=200
'^'=201
'<<'=202
'>>'=203
'>='=204
'>'=205
'<='=206
'<'=207
'=='=208
'='=209
'+='=210
'-='=211
'*='=212
'/='=213
'%='=214
'!='=215
'|'=216
'('=217
')'=218
','=219
';'=220
'->'=221
'['=222
']'=223
'?'=224
':'=225
'{'=226
'}'=227
'repeat'=92
'flatten'=93
'append'=94
'get_value'=95
'flow_apply'=96
'motion_mask'=98
'flow_to_image'=99
'where'=102
'overlay'=104
'pad'=105
'cross'=106
'matmul'=107
'rife'=108
'shape'=111
'tensor'=115
'add_key'=116
'stack_push'=118
'stack_pop'=119
'stack_clear'=120
'stack_has'=121
'stack_get'=122
'int'=124
'float'=125
'upper'=126
'lower'=127
'trim'=128
'split'=129
'join'=130
'find'=132
'replace'=133
'dilate'=134
'erode'=135
'morph_open'=136
'morph_close'=137
'rgb_to_oklab'=138
'rgb_to_cielab'=139
'oklab_to_rgb'=140
'cielab_to_rgb'=141
'rgb_to_hsv'=142
'hsv_to_rgb'=143
'int_to_rgb'=144
'rgb_to_int'=145
'interpolate_linear'=146
'interpolate_area'=147
'text_image'=149
'if'=153
'else'=154
'while'=155
'for'=156
'in'=157
'break'=158
'continue'=159
'return'=160
'sort'=162
'argsort'=163
'argmin'=164
'argmax'=165
'softmax'=166
'softmin'=167
'unique'=168
'flip'=169
'startswith'=170
'endswith'=171
'squeeze'=172
'unsqueeze'=173
'roll'=174
'cov'=175
'entropy'=177
'crop'=178
'+'=200
'-'=201
'*'=202
'/'=203
'%'=204
'^'=205
'<<'=206
'>>'=207
'>='=208
'>'=209
'<='=210
'<'=211
'=='=212
'='=213
'+='=214
'-='=215
'*='=216
'/='=217
'%='=218
'!='=219
'|'=220
'('=221
')'=222
','=223
';'=224
'->'=225
'['=226
']'=227
'?'=228
':'=229
'{'=230
'}'=231
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+252 -248
View File
@@ -85,153 +85,157 @@ REMAP=84
COSSIM=85
COUNT=86
KEYS=87
REPEAT=88
FLATTEN=89
APPEND=90
GET_VALUE=91
FLOW_APPLY=92
BATCH_SHUFFLE=93
MOTION_MASK=94
FLOW_TO_IMAGE=95
FLOW_MAG=96
FLOW_ANG=97
WHERE=98
HISTOGRAM=99
OVERLAY=100
PAD=101
CROSS=102
MATMUL=103
RIFE=104
BNOT=105
BITCOUNT=106
SHAPE=107
BAND=108
XOR=109
BOR=110
TENSOR=111
ADD_KEY=112
REMOVE_KEY=113
PUSH=114
POP=115
CLEAR=116
HAS=117
GET=118
CONCAT=119
INT=120
FLOAT=121
UPPER=122
LOWER=123
TRIM=124
SPLIT=125
JOIN=126
SUBSTRING=127
FIND=128
REPLACE=129
DILATE=130
ERODE=131
MORPH_OPEN=132
MORPH_CLOSE=133
RGB_TO_OKLAB=134
RGB_TO_CIELAB=135
OKLAB_TO_RGB=136
CIELAB_TO_RGB=137
RGB_TO_HSV=138
HSV_TO_RGB=139
INT_TO_RGB=140
RGB_TO_INT=141
INTERPOLATE_LINEAR=142
INTERPOLATE_AREA=143
INTERPOLATE_NEAREST=144
TEXT_IMAGE=145
AS_NESTED=146
SVD=147
DIAG=148
IF=149
ELSE=150
WHILE=151
FOR=152
IN=153
BREAK=154
CONTINUE=155
RETURN=156
TIMESTAMP=157
SORT=158
ARGSORT=159
ARGMIN=160
ARGMAX=161
SOFTMAX=162
SOFTMIN=163
UNIQUE=164
FLIP=165
STARTSWITH=166
ENDSWITH=167
SQUEEZE=168
UNSQUEEZE=169
ROLL=170
COV=171
CORR=172
ENTROPY=173
CROP=174
NONE=175
COORDS=176
NOISE=177
RAND=178
CAUCHY=179
EXPONENTIAL=180
LOGNORMAL=181
BERNOULLI=182
POISSON=183
GAMMADIST=184
BETADIST=185
LAPLACEDIST=186
GUMBELDIST=187
WEIBULLDIST=188
CHI2DIST=189
STUDENTTDIST=190
PERLIN=191
CELLULAR=192
PLASMA=193
RIDGED=194
DOMAIN_WARP=195
PLUS=196
MINUS=197
MULT=198
DIV=199
MOD=200
POW=201
LSHIFT=202
RSHIFT=203
GE=204
GT=205
LE=206
LT=207
EQ=208
EQUEALS=209
PLUS_EQ=210
MINUS_EQ=211
MULT_EQ=212
DIV_EQ=213
MOD_EQ=214
NE=215
PIPE=216
LPAREN=217
RPAREN=218
COMMA=219
SEMICOLON=220
ARROW=221
LBRACKET=222
RBRACKET=223
QUESTION=224
COLON=225
LBRACE=226
RBRACE=227
NUMBER=228
CONSTANT=229
STRING=230
VARIABLE=231
SL_COMMENT=232
ML_COMMENT=233
WS=234
GET_CHANGED_KEYS=88
GET_ADDED_KEYS=89
GET_REMOVED_KEYS=90
GET_UNCHANGED_KEYS=91
REPEAT=92
FLATTEN=93
APPEND=94
GET_VALUE=95
FLOW_APPLY=96
BATCH_SHUFFLE=97
MOTION_MASK=98
FLOW_TO_IMAGE=99
FLOW_MAG=100
FLOW_ANG=101
WHERE=102
HISTOGRAM=103
OVERLAY=104
PAD=105
CROSS=106
MATMUL=107
RIFE=108
BNOT=109
BITCOUNT=110
SHAPE=111
BAND=112
XOR=113
BOR=114
TENSOR=115
ADD_KEY=116
REMOVE_KEY=117
PUSH=118
POP=119
CLEAR=120
HAS=121
GET=122
CONCAT=123
INT=124
FLOAT=125
UPPER=126
LOWER=127
TRIM=128
SPLIT=129
JOIN=130
SUBSTRING=131
FIND=132
REPLACE=133
DILATE=134
ERODE=135
MORPH_OPEN=136
MORPH_CLOSE=137
RGB_TO_OKLAB=138
RGB_TO_CIELAB=139
OKLAB_TO_RGB=140
CIELAB_TO_RGB=141
RGB_TO_HSV=142
HSV_TO_RGB=143
INT_TO_RGB=144
RGB_TO_INT=145
INTERPOLATE_LINEAR=146
INTERPOLATE_AREA=147
INTERPOLATE_NEAREST=148
TEXT_IMAGE=149
AS_NESTED=150
SVD=151
DIAG=152
IF=153
ELSE=154
WHILE=155
FOR=156
IN=157
BREAK=158
CONTINUE=159
RETURN=160
TIMESTAMP=161
SORT=162
ARGSORT=163
ARGMIN=164
ARGMAX=165
SOFTMAX=166
SOFTMIN=167
UNIQUE=168
FLIP=169
STARTSWITH=170
ENDSWITH=171
SQUEEZE=172
UNSQUEEZE=173
ROLL=174
COV=175
CORR=176
ENTROPY=177
CROP=178
NONE=179
COORDS=180
NOISE=181
RAND=182
CAUCHY=183
EXPONENTIAL=184
LOGNORMAL=185
BERNOULLI=186
POISSON=187
GAMMADIST=188
BETADIST=189
LAPLACEDIST=190
GUMBELDIST=191
WEIBULLDIST=192
CHI2DIST=193
STUDENTTDIST=194
PERLIN=195
CELLULAR=196
PLASMA=197
RIDGED=198
DOMAIN_WARP=199
PLUS=200
MINUS=201
MULT=202
DIV=203
MOD=204
POW=205
LSHIFT=206
RSHIFT=207
GE=208
GT=209
LE=210
LT=211
EQ=212
EQUEALS=213
PLUS_EQ=214
MINUS_EQ=215
MULT_EQ=216
DIV_EQ=217
MOD_EQ=218
NE=219
PIPE=220
LPAREN=221
RPAREN=222
COMMA=223
SEMICOLON=224
ARROW=225
LBRACKET=226
RBRACKET=227
QUESTION=228
COLON=229
LBRACE=230
RBRACE=231
NUMBER=232
CONSTANT=233
STRING=234
VARIABLE=235
SL_COMMENT=236
ML_COMMENT=237
WS=238
'sin'=1
'cos'=2
'tan'=3
@@ -302,104 +306,104 @@ WS=234
'smootherstep'=82
'remap'=84
'keys'=87
'repeat'=88
'flatten'=89
'append'=90
'get_value'=91
'flow_apply'=92
'motion_mask'=94
'flow_to_image'=95
'where'=98
'overlay'=100
'pad'=101
'cross'=102
'matmul'=103
'rife'=104
'shape'=107
'tensor'=111
'add_key'=112
'stack_push'=114
'stack_pop'=115
'stack_clear'=116
'stack_has'=117
'stack_get'=118
'int'=120
'float'=121
'upper'=122
'lower'=123
'trim'=124
'split'=125
'join'=126
'find'=128
'replace'=129
'dilate'=130
'erode'=131
'morph_open'=132
'morph_close'=133
'rgb_to_oklab'=134
'rgb_to_cielab'=135
'oklab_to_rgb'=136
'cielab_to_rgb'=137
'rgb_to_hsv'=138
'hsv_to_rgb'=139
'int_to_rgb'=140
'rgb_to_int'=141
'interpolate_linear'=142
'interpolate_area'=143
'text_image'=145
'if'=149
'else'=150
'while'=151
'for'=152
'in'=153
'break'=154
'continue'=155
'return'=156
'sort'=158
'argsort'=159
'argmin'=160
'argmax'=161
'softmax'=162
'softmin'=163
'unique'=164
'flip'=165
'startswith'=166
'endswith'=167
'squeeze'=168
'unsqueeze'=169
'roll'=170
'cov'=171
'entropy'=173
'crop'=174
'+'=196
'-'=197
'*'=198
'/'=199
'%'=200
'^'=201
'<<'=202
'>>'=203
'>='=204
'>'=205
'<='=206
'<'=207
'=='=208
'='=209
'+='=210
'-='=211
'*='=212
'/='=213
'%='=214
'!='=215
'|'=216
'('=217
')'=218
','=219
';'=220
'->'=221
'['=222
']'=223
'?'=224
':'=225
'{'=226
'}'=227
'repeat'=92
'flatten'=93
'append'=94
'get_value'=95
'flow_apply'=96
'motion_mask'=98
'flow_to_image'=99
'where'=102
'overlay'=104
'pad'=105
'cross'=106
'matmul'=107
'rife'=108
'shape'=111
'tensor'=115
'add_key'=116
'stack_push'=118
'stack_pop'=119
'stack_clear'=120
'stack_has'=121
'stack_get'=122
'int'=124
'float'=125
'upper'=126
'lower'=127
'trim'=128
'split'=129
'join'=130
'find'=132
'replace'=133
'dilate'=134
'erode'=135
'morph_open'=136
'morph_close'=137
'rgb_to_oklab'=138
'rgb_to_cielab'=139
'oklab_to_rgb'=140
'cielab_to_rgb'=141
'rgb_to_hsv'=142
'hsv_to_rgb'=143
'int_to_rgb'=144
'rgb_to_int'=145
'interpolate_linear'=146
'interpolate_area'=147
'text_image'=149
'if'=153
'else'=154
'while'=155
'for'=156
'in'=157
'break'=158
'continue'=159
'return'=160
'sort'=162
'argsort'=163
'argmin'=164
'argmax'=165
'softmax'=166
'softmin'=167
'unique'=168
'flip'=169
'startswith'=170
'endswith'=171
'squeeze'=172
'unsqueeze'=173
'roll'=174
'cov'=175
'entropy'=177
'crop'=178
'+'=200
'-'=201
'*'=202
'/'=203
'%'=204
'^'=205
'<<'=206
'>>'=207
'>='=208
'>'=209
'<='=210
'<'=211
'=='=212
'='=213
'+='=214
'-='=215
'*='=216
'/='=217
'%='=218
'!='=219
'|'=220
'('=221
')'=222
','=223
';'=224
'->'=225
'['=226
']'=227
'?'=228
':'=229
'{'=230
'}'=231
@@ -2222,6 +2222,42 @@ class MathExprListener(ParseTreeListener):
pass
# Enter a parse tree produced by MathExprParser#GetChangedKeysFunc.
def enterGetChangedKeysFunc(self, ctx:MathExprParser.GetChangedKeysFuncContext):
pass
# Exit a parse tree produced by MathExprParser#GetChangedKeysFunc.
def exitGetChangedKeysFunc(self, ctx:MathExprParser.GetChangedKeysFuncContext):
pass
# Enter a parse tree produced by MathExprParser#GetAddedKeysFunc.
def enterGetAddedKeysFunc(self, ctx:MathExprParser.GetAddedKeysFuncContext):
pass
# Exit a parse tree produced by MathExprParser#GetAddedKeysFunc.
def exitGetAddedKeysFunc(self, ctx:MathExprParser.GetAddedKeysFuncContext):
pass
# Enter a parse tree produced by MathExprParser#GetRemovedKeysFunc.
def enterGetRemovedKeysFunc(self, ctx:MathExprParser.GetRemovedKeysFuncContext):
pass
# Exit a parse tree produced by MathExprParser#GetRemovedKeysFunc.
def exitGetRemovedKeysFunc(self, ctx:MathExprParser.GetRemovedKeysFuncContext):
pass
# Enter a parse tree produced by MathExprParser#GetUnchangedKeysFunc.
def enterGetUnchangedKeysFunc(self, ctx:MathExprParser.GetUnchangedKeysFuncContext):
pass
# Exit a parse tree produced by MathExprParser#GetUnchangedKeysFunc.
def exitGetUnchangedKeysFunc(self, ctx:MathExprParser.GetUnchangedKeysFuncContext):
pass
# Enter a parse tree produced by MathExprParser#NoiseFunc.
def enterNoiseFunc(self, ctx:MathExprParser.NoiseFuncContext):
pass
File diff suppressed because one or more lines are too long
@@ -1239,6 +1239,26 @@ class MathExprVisitor(ParseTreeVisitor):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#GetChangedKeysFunc.
def visitGetChangedKeysFunc(self, ctx:MathExprParser.GetChangedKeysFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#GetAddedKeysFunc.
def visitGetAddedKeysFunc(self, ctx:MathExprParser.GetAddedKeysFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#GetRemovedKeysFunc.
def visitGetRemovedKeysFunc(self, ctx:MathExprParser.GetRemovedKeysFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#GetUnchangedKeysFunc.
def visitGetUnchangedKeysFunc(self, ctx:MathExprParser.GetUnchangedKeysFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#NoiseFunc.
def visitNoiseFunc(self, ctx:MathExprParser.NoiseFuncContext):
return self.visitChildren(ctx)
+1 -1
View File
@@ -211,7 +211,7 @@ def calculate_lora_dict_dict_mode(Expr, V, F, pbar=None, mapping=None, stack=[],
visitor_device = compute_device if compute_device is not None else next(iter(references.values())).device
result = UnifiedMathVisitor(variables, device=visitor_device, state_storage=stack).visit(parse_expr(Expr) if isinstance(Expr, str) else Expr)
if not isinstance(result, MathDict):
if not isinstance(result, (MathDict, dict)):
if isinstance(result, (float, int)):
result = MathDict({key: torch.full_like(reference, result) for key, reference in references.items()})
else:
+1 -1
View File
@@ -498,7 +498,7 @@ def calculate_patches_dict_mode(Expr, V, F, pbar=None, mapping=None, stack=[], u
v0_dict = variables.get("V0", MathDict({key: torch.zeros_like(reference) for key, reference in references.items()}))
originals = MathDict({k: (v.clone() if isinstance(v, torch.Tensor) else v) for k, v in v0_dict.items()})
result = UnifiedMathVisitor(variables, device=visitor_device, state_storage=stack).visit(tree)
if not isinstance(result, MathDict):
if not isinstance(result, (MathDict, dict)):
if isinstance(result, (float, int)):
result = MathDict({key: torch.full_like(reference, result) for key, reference in references.items()})
else:
+9 -1
View File
@@ -9,7 +9,7 @@ export const CONSTANTS = new Set([
]);
export const FUNCTIONS = new Set([
"abs", "acos", "acosh", "add_key", "all", "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", "bxor", "cat", "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", "cubic", "cubic_ease", "cumprod", "cumsum", "diag", "diagonal_matrix", "dilate", "dist", "distance", "domain_warp", "domain_warp_noise", "dot", "edge", "elastic", "elastic_ease", "endswith", "entropy", "erf", "erfinv", "erode", "exp", "ezconv", "ezconvolution", "fft", "find", "flatten", "flip", "float", "floor", "flow_ang", "flow_angle", "flow_apply", "flow_mag", "flow_magnitude", "flow_to_image", "fract", "gamma", "gaussian", "gelu", "get_value", "hist", "histogram", "hsv_to_rgb", "ifft", "int", "int_to_rgb", "interpolate_area", "interpolate_linear", "interpolate_nearest", "interpolate_nearest_exact", "join", "keys", "length", "lerp", "linspace", "ln", "log", "logspace", "lower", "map", "matmul", "mean", "median", "mode", "moment", "morph_close", "morph_open", "motion_mask", "nan_to_num", "noise", "now", "nvl", "oklab_to_rgb", "overlay", "pad", "percentile", "perlin", "perlin_noise", "perm", "permute", "pinv", "plasma", "plasma_noise", "popcnt", "popcount", "pow", "prcnt", "print", "print_shape", "pshp", "quantile", "quartil", "quartile", "rand", "randb", "randbeta", "randc", "rande", "randg", "randgumbel", "randchi2", "randl", "randln", "randn", "random_bernoulli", "random_beta", "random_cauchy", "random_exponential", "random_gamma", "random_gumbel", "random_chi2", "random_laplace", "random_log_normal", "random_normal", "random_poisson", "random_studentt", "random_uniform", "random_weibull", "randp", "randt", "randu", "randw", "range", "relu", "remap", "remove_key", "repeat", "replace", "reshape", "rgb_to_cielab", "rgb_to_hsv", "rgb_to_int", "rgb_to_oklab", "ridged", "ridged_noise", "rife", "rm_key", "roll", "round", "rshp", "select", "shape", "shuffle", "sigm", "sign", "sin", "sine", "sine_ease", "singular_value_decomposition", "sinh", "smax", "smin", "smootherstep", "smoothstep", "snorm", "softmax", "softmin", "softplus", "sort", "split", "sqrt", "squeeze", "stack_clear", "stack_get", "stack_has", "stack_pop", "stack_push", "startswith", "std", "step", "substr", "substring", "sum", "svd", "swap", "tan", "tanh", "tensor", "text_image", "timestamp", "tmax", "tmin", "tnorm", "topk", "topk_ind", "topk_indices", "trim", "turbulence", "unique", "unsqueeze", "upper", "var", "voronoi", "voronoi_noise", "where", "worley"
"abs", "acos", "acosh", "add_key", "added_keys", "all", "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", "bxor", "cat", "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", "cubic", "cubic_ease", "cumprod", "cumsum", "diag", "diagonal_matrix", "dilate", "dist", "distance", "domain_warp", "domain_warp_noise", "dot", "edge", "elastic", "elastic_ease", "endswith", "entropy", "erf", "erfinv", "erode", "exp", "ezconv", "ezconvolution", "fft", "find", "flatten", "flip", "float", "floor", "flow_ang", "flow_angle", "flow_apply", "flow_mag", "flow_magnitude", "flow_to_image", "fract", "gamma", "gaussian", "gelu", "get_added_keys", "get_changed_keys", "get_removed_keys", "get_unchanged_keys", "get_value", "hist", "histogram", "hsv_to_rgb", "changed_keys", "ifft", "int", "int_to_rgb", "interpolate_area", "interpolate_linear", "interpolate_nearest", "interpolate_nearest_exact", "join", "keys", "length", "lerp", "linspace", "ln", "log", "logspace", "lower", "map", "matmul", "mean", "median", "mode", "moment", "morph_close", "morph_open", "motion_mask", "nan_to_num", "noise", "now", "nvl", "oklab_to_rgb", "overlay", "pad", "percentile", "perlin", "perlin_noise", "perm", "permute", "pinv", "plasma", "plasma_noise", "popcnt", "popcount", "pow", "prcnt", "print", "print_shape", "pshp", "quantile", "quartil", "quartile", "rand", "randb", "randbeta", "randc", "rande", "randg", "randgumbel", "randchi2", "randl", "randln", "randn", "random_bernoulli", "random_beta", "random_cauchy", "random_exponential", "random_gamma", "random_gumbel", "random_chi2", "random_laplace", "random_log_normal", "random_normal", "random_poisson", "random_studentt", "random_uniform", "random_weibull", "randp", "randt", "randu", "randw", "range", "relu", "remap", "remove_key", "removed_keys", "repeat", "replace", "reshape", "rgb_to_cielab", "rgb_to_hsv", "rgb_to_int", "rgb_to_oklab", "ridged", "ridged_noise", "rife", "rm_key", "roll", "round", "rshp", "select", "shape", "shuffle", "sigm", "sign", "sin", "sine", "sine_ease", "singular_value_decomposition", "sinh", "smax", "smin", "smootherstep", "smoothstep", "snorm", "softmax", "softmin", "softplus", "sort", "split", "sqrt", "squeeze", "stack_clear", "stack_get", "stack_has", "stack_pop", "stack_push", "startswith", "std", "step", "substr", "substring", "sum", "svd", "swap", "tan", "tanh", "tensor", "text_image", "timestamp", "tmax", "tmin", "tnorm", "topk", "topk_ind", "topk_indices", "trim", "turbulence", "unchanged_keys", "unique", "unsqueeze", "upper", "var", "voronoi", "voronoi_noise", "where", "worley"
]);
export const FUNCTION_META = {
@@ -118,6 +118,14 @@ export const FUNCTION_META = {
"cnt": { minArgs: 1, maxArgs: 1, snippet: "cnt(x)", description: "returns the number of elements in x" },
"length": { minArgs: 1, maxArgs: 1, snippet: "length(x)", description: "returns the number of elements in x" },
"keys": { minArgs: 1, maxArgs: 1, snippet: "keys(x)", description: "returns a list of dictionary keys in insertion order" },
"get_changed_keys": { minArgs: 1, maxArgs: 1, snippet: "get_changed_keys(d)", description: "returns list of keys that were modified or added in ChangeTrackingDict d" },
"changed_keys": { minArgs: 1, maxArgs: 1, snippet: "changed_keys(d)", description: "returns list of keys that were modified or added in ChangeTrackingDict d" },
"get_added_keys": { minArgs: 1, maxArgs: 1, snippet: "get_added_keys(d)", description: "returns list of keys that were added (newly created) in ChangeTrackingDict d" },
"added_keys": { minArgs: 1, maxArgs: 1, snippet: "added_keys(d)", description: "returns list of keys that were added (newly created) in ChangeTrackingDict d" },
"get_removed_keys": { minArgs: 1, maxArgs: 1, snippet: "get_removed_keys(d)", description: "returns list of keys that were removed from ChangeTrackingDict d" },
"removed_keys": { minArgs: 1, maxArgs: 1, snippet: "removed_keys(d)", description: "returns list of keys that were removed from ChangeTrackingDict d" },
"get_unchanged_keys": { minArgs: 1, maxArgs: 1, snippet: "get_unchanged_keys(d)", description: "returns list of keys that remain unchanged in ChangeTrackingDict d" },
"unchanged_keys": { minArgs: 1, maxArgs: 1, snippet: "unchanged_keys(d)", description: "returns list of keys that remain unchanged in ChangeTrackingDict d" },
"repeat": { minArgs: 2, maxArgs: 3, snippet: "repeat(x, count, dims)", description: "repeats tensor elements; count may be scalar or per-dim list" },
"flatten": { minArgs: 1, maxArgs: 1, snippet: "flatten(x)", description: "flattens tensor into a 1D tensor" },
"append": { minArgs: 2, maxArgs: 2, snippet: "append(x, y)", description: "appends y to the end of x. If inputs are tensors use concatenate(x,...,dim)" },