erf,erfinv
This commit is contained in:
@@ -104,6 +104,8 @@ You can also get the node from comfy manager under the name of More math.
|
||||
- `sigm(x)`: Sigmoid function (1 / (1 + e^-x)).
|
||||
- `softmax(x, dim)`: Softmax normalization along last dimension (converts to probabilities).
|
||||
- `softmin(x, dim)`: Softmin normalization along specified dimension (inverse softmax).
|
||||
- `erf(x)`: Error function.
|
||||
- `erfinv(x)`: Inverse error function.
|
||||
|
||||
### Interpolation
|
||||
|
||||
|
||||
@@ -152,6 +152,8 @@ func1:
|
||||
| ARGMAX LPAREN expr RPAREN # ArgmaxFunc
|
||||
| SOFTMAX LPAREN expr RPAREN # SoftmaxFunc
|
||||
| SOFTMIN LPAREN expr RPAREN # SoftminFunc
|
||||
| ERF LPAREN expr RPAREN # ErfFunc
|
||||
| ERFINV LPAREN expr RPAREN # ErfinvFunc
|
||||
| UNIQUE LPAREN expr RPAREN # UniqueFunc
|
||||
| FLATTEN LPAREN expr RPAREN # FlattenFunc
|
||||
| MOTION_MASK LPAREN expr RPAREN # MotionMaskFunc
|
||||
@@ -338,6 +340,8 @@ PERCENTILE: 'percentile' | 'prcnt';
|
||||
QUANTILE: 'quantile';
|
||||
DOT: 'dot';
|
||||
MOMENT: 'moment';
|
||||
ERF: 'erf';
|
||||
ERFINV: 'erfinv';
|
||||
|
||||
ANY: 'any';
|
||||
ALL: 'all';
|
||||
|
||||
@@ -3511,5 +3511,15 @@ class UnifiedMathVisitor(MathExprVisitor):
|
||||
dim = int(dim_val.item()) if self._is_tensor(dim_val) else int(dim_val)
|
||||
|
||||
return torch.roll(x, shifts=shift, dims=dim)
|
||||
|
||||
def visitErfFunc(self, ctx):
|
||||
"""erf(x) - error function"""
|
||||
x = self._promote_to_tensor((yield ctx.expr()))
|
||||
return torch.erf(x)
|
||||
|
||||
def visitErfinvFunc(self, ctx):
|
||||
"""erfinv(x) - inverse error function"""
|
||||
x = self._promote_to_tensor((yield ctx.expr()))
|
||||
return torch.erfinv(x)
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ const FUNCTIONS = new Set([
|
||||
"round", "gamma", "pow", "sigm", "clamp", "fft", "ifft", "angle", "print", "print_shape", "pshp", "nvl",
|
||||
"nan_to_num", "lerp", "step", "smoothstep", "fract", "relu", "softplus", "gelu", "sign", "map", "ezconvolution",
|
||||
"ezconv", "convolution", "conv", "swap", "permute", "perm", "reshape", "rshp", "range", "topk", "botk", "pinv",
|
||||
"sum", "mean", "std", "var", "quartile", "quartil", "percentile", "prcnt", "quantile", "dot", "moment", "any",
|
||||
"sum", "mean", "std", "var", "quartile", "quartil", "percentile", "prcnt", "quantile", "dot", "moment","erf","erfinv", "any",
|
||||
"all", "edge", "blur", "gaussian", "median", "mode", "cumsum", "cumprod", "topk_ind", "topk_indices", "botk_ind",
|
||||
"botk_indices", "cubic_ease", "cubic", "elastic_ease", "elastic", "sine_ease", "sine", "smootherstep", "dist",
|
||||
"distance", "remap", "cossim", "cosine_similarity", "count", "cnt", "length", "flatten", "append", "get_value",
|
||||
|
||||
Reference in New Issue
Block a user