AI: readme audit 2 pas

This commit is contained in:
mcDandy
2026-09-11 15:54:46 +02:00
parent fc3a628b95
commit 8cd9baa94d
8 changed files with 20 additions and 11 deletions
+1 -1
View File
@@ -1007,7 +1007,7 @@ XOR: 'bxor' | 'bitwise_xor';
BOR: 'bor' | 'bitwise_or';
TENSOR: 'tensor';
ADD_KEY: 'add_key';
REMOVE_KEY: 'remove_key' | 'rm_kay';
REMOVE_KEY: 'remove_key' | 'rm_key';
PUSH: 'stack_push';
POP: 'stack_pop';
CLEAR: 'stack_clear';
+11 -2
View File
@@ -1810,8 +1810,17 @@ class UnifiedMathVisitor(MathExprVisitor):
return float(torch.sum(self._bin_op(self._bin_op(x,a,torch.sub,lambda x, a: x - a,ctx),k,torch.pow,pow,ctx)).item())/x.numel()
def visitSortFunc(self, ctx):
val = self._promote_to_tensor((yield ctx.expr()))
sorted_val, _ = torch.sort(val)
val = (yield ctx.expr(0))
descending = False
dim = -1
if len(ctx.expr()) > 1:
descending = self._to_bool((yield ctx.expr(1)), ctx, "sort descending")
if len(ctx.expr()) > 2:
dim = self._to_int((yield ctx.expr(2)), ctx, "sort dim", strict=True)
if self._is_list(val):
return sorted(val, reverse=descending)
val = self._promote_to_tensor(val)
sorted_val, _ = torch.sort(val, dim=dim, descending=descending)
return sorted_val
def visitCossimFunc(self, ctx):
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -682,7 +682,7 @@ def serializedATN():
101,0,0,1458,1459,5,109,0,0,1459,1460,5,111,0,0,1460,1461,5,118,
0,0,1461,1462,5,101,0,0,1462,1463,5,95,0,0,1463,1464,5,107,0,0,1464,
1465,5,101,0,0,1465,1473,5,121,0,0,1466,1467,5,114,0,0,1467,1468,
5,109,0,0,1468,1469,5,95,0,0,1469,1470,5,107,0,0,1470,1471,5,97,
5,109,0,0,1468,1469,5,95,0,0,1469,1470,5,107,0,0,1470,1471,5,101,
0,0,1471,1473,5,121,0,0,1472,1456,1,0,0,0,1472,1466,1,0,0,0,1473,
226,1,0,0,0,1474,1475,5,115,0,0,1475,1476,5,116,0,0,1476,1477,5,
97,0,0,1477,1478,5,99,0,0,1478,1479,5,107,0,0,1479,1480,5,95,0,0,
+2 -2
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', 'randchi2', 'rande', 'randg', 'randgumbel', 'randl', 'randln', 'randn', 'random_bernoulli', 'random_beta', 'random_cauchy', 'random_chi2', 'random_exponential', 'random_gamma', 'random_gumbel', '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_kay', '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', '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', 'randchi2', 'rande', 'randg', 'randgumbel', 'randl', 'randln', 'randn', 'random_bernoulli', 'random_beta', 'random_cauchy', 'random_chi2', 'random_exponential', 'random_gamma', 'random_gumbel', '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'
}
INBUILT_FUNCTION_META = {
@@ -152,7 +152,7 @@ INBUILT_FUNCTION_META = {
'tensor': {'min_args': 1, 'max_args': 3, 'snippet': 'tensor(shape, value, dtype_template)', 'description': 'creates a tensor with specified shape and optional value/type. Default value is 0 and default format FP32'},
'add_key': {'min_args': 3, 'max_args': 3, 'snippet': 'add_key(dict, key, value)', 'description': 'adds or replaces a dictionary entry and returns the updated dictionary'},
'remove_key': {'min_args': 2, 'max_args': 2, 'snippet': 'remove_key(dict, key)', 'description': 'removes a dictionary entry and returns the updated dictionary'},
'rm_kay': {'min_args': 2, 'max_args': 2, 'snippet': 'rm_kay(dict, key)', 'description': 'removes a dictionary entry and returns the updated dictionary'},
'rm_key': {'min_args': 2, 'max_args': 2, 'snippet': 'rm_key(dict, key)', 'description': 'removes a dictionary entry and returns the updated dictionary'},
'stack_push': {'min_args': 2, 'max_args': 2, 'snippet': 'stack_push(slot, val)', 'description': 'pushes val onto the end of slot stack'},
'stack_pop': {'min_args': 1, 'max_args': 1, 'snippet': 'stack_pop(slot)', 'description': 'removes and returns the last element of slot stack'},
'stack_clear': {'min_args': 1, 'max_args': 1, 'snippet': 'stack_clear(slot)', 'description': 'clears the contents of slot stack'},
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -842,7 +842,7 @@ def serializedATN():
buf.write("\7g\2\2\u05b8\u05b9\7a\2\2\u05b9\u05ba\7m\2\2\u05ba\u05bb")
buf.write("\7g\2\2\u05bb\u05c3\7{\2\2\u05bc\u05bd\7t\2\2\u05bd\u05be")
buf.write("\7o\2\2\u05be\u05bf\7a\2\2\u05bf\u05c0\7m\2\2\u05c0\u05c1")
buf.write("\7c\2\2\u05c1\u05c3\7{\2\2\u05c2\u05b2\3\2\2\2\u05c2\u05bc")
buf.write("\7g\2\2\u05c1\u05c3\7{\2\2\u05c2\u05b2\3\2\2\2\u05c2\u05bc")
buf.write("\3\2\2\2\u05c3\u00e4\3\2\2\2\u05c4\u05c5\7u\2\2\u05c5")
buf.write("\u05c6\7v\2\2\u05c6\u05c7\7c\2\2\u05c7\u05c8\7e\2\2\u05c8")
buf.write("\u05c9\7m\2\2\u05c9\u05ca\7a\2\2\u05ca\u05cb\7r\2\2\u05cb")
+2 -2
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", "randchi2", "rande", "randg", "randgumbel", "randl", "randln", "randn", "random_bernoulli", "random_beta", "random_cauchy", "random_chi2", "random_exponential", "random_gamma", "random_gumbel", "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_kay", "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", "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", "randchi2", "rande", "randg", "randgumbel", "randl", "randln", "randn", "random_bernoulli", "random_beta", "random_cauchy", "random_chi2", "random_exponential", "random_gamma", "random_gumbel", "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"
]);
export const FUNCTION_META = {
@@ -155,7 +155,7 @@ export const FUNCTION_META = {
"tensor": { minArgs: 1, maxArgs: 3, snippet: "tensor(shape, value, dtype_template)", description: "creates a tensor with specified shape and optional value/type. Default value is 0 and default format FP32" },
"add_key": { minArgs: 3, maxArgs: 3, snippet: "add_key(dict, key, value)", description: "adds or replaces a dictionary entry and returns the updated dictionary" },
"remove_key": { minArgs: 2, maxArgs: 2, snippet: "remove_key(dict, key)", description: "removes a dictionary entry and returns the updated dictionary" },
"rm_kay": { minArgs: 2, maxArgs: 2, snippet: "rm_kay(dict, key)", description: "removes a dictionary entry and returns the updated dictionary" },
"rm_key": { minArgs: 2, maxArgs: 2, snippet: "rm_key(dict, key)", description: "removes a dictionary entry and returns the updated dictionary" },
"stack_push": { minArgs: 2, maxArgs: 2, snippet: "stack_push(slot, val)", description: "pushes val onto the end of slot stack" },
"stack_pop": { minArgs: 1, maxArgs: 1, snippet: "stack_pop(slot)", description: "removes and returns the last element of slot stack" },
"stack_clear": { minArgs: 1, maxArgs: 1, snippet: "stack_clear(slot)", description: "clears the contents of slot stack" },