Added distribution method nodes that take 2d tensor as input

This commit is contained in:
HowToSD
2025-03-18 13:45:55 -07:00
parent 39421a4f8b
commit f8e06e965e
21 changed files with 564 additions and 23 deletions
+5 -5
View File
@@ -12,7 +12,7 @@ class PtdmCdf:
Args:
distribution (torch.distributions.distribution.Distribution): Distribution.
v (float): Value
x (float): Value
category: PyTorch wrapper - Distribution
"""
@@ -28,7 +28,7 @@ class PtdmCdf:
return {
"required": {
"distribution": ("PTDISTRIBUTION", {}),
"v": ("STRING", {"default": ""})
"x": ("STRING", {"default": ""})
}
}
@@ -36,18 +36,18 @@ class PtdmCdf:
FUNCTION: str = "f"
CATEGORY: str = "Distribution"
def f(self, distribution: torch.distributions.Distribution, v: str) -> tuple:
def f(self, distribution: torch.distributions.Distribution, x: str) -> tuple:
"""
Computes the cumulative distribution function for the input distribution.
Args:
distribution (torch.distributions.Distribution): Distribution.
v (str): Value
x (str): Value
Returns:
tuple containing the probability
"""
v2 = ast.literal_eval(v)
v2 = ast.literal_eval(x)
if isinstance(v2, int) is False and isinstance(v2, float) is False :
if isinstance(distribution, Dirichlet) is False:
raise ValueError("You need to specify a float or an int.")