AI convert size variables to floats

This commit is contained in:
mcDandy
2026-02-27 12:19:25 +01:00
parent 9129653f40
commit 9f49c6d054
7 changed files with 49 additions and 49 deletions
+2 -2
View File
@@ -111,8 +111,8 @@ class AudioMathNode(io.ComfyNode):
"R": sample_rate,
"sample_rate": sample_rate,
"batch": getIndexTensorAlongDim(a_w, 0),
"T": a_w.shape[0],
"batch_count": a_w.shape[0],
"T": float(a_w.shape[0]),
"batch_count": float(a_w.shape[0]),
} | generate_dim_variables(a_w) | V_norm_waveforms | sample_rates
v_stacked, v_cnt = get_v_variable(V_norm_waveforms, length_mismatch=length_mismatch)
+8 -8
View File
@@ -134,14 +134,14 @@ class MathGuider:
"z": self.F.get("F3", 0.0),
"B": getIndexTensorAlongDim(eval_samples, batch_dim),
"batch": getIndexTensorAlongDim(eval_samples, batch_dim),
"W": eval_samples.shape[width_dim] if width_dim < ndim else 0,
"width": eval_samples.shape[width_dim] if width_dim < ndim else 0,
"H": eval_samples.shape[height_dim] if height_dim < ndim else 0,
"height": eval_samples.shape[height_dim] if height_dim < ndim else 0,
"T": frame_count,
"batch_count": eval_samples.shape[0],
"N": eval_samples.shape[channel_dim] if channel_dim < ndim else 0,
"channel_count": eval_samples.shape[channel_dim] if channel_dim < ndim else 0,
"W": float(eval_samples.shape[width_dim]) if width_dim < ndim else 0.0,
"width": float(eval_samples.shape[width_dim]) if width_dim < ndim else 0.0,
"H": float(eval_samples.shape[height_dim]) if height_dim < ndim else 0.0,
"height": float(eval_samples.shape[height_dim]) if height_dim < ndim else 0.0,
"T": float(frame_count),
"batch_count": float(eval_samples.shape[0]),
"N": float(eval_samples.shape[channel_dim]) if channel_dim < ndim else 0.0,
"channel_count": float(eval_samples.shape[channel_dim]) if channel_dim < ndim else 0.0,
"sigma": sigma.item() if isinstance(sigma,torch.Tensor) else sigma,
"seed": seed if seed is not None else 0,
"steps": self.steps,
+8 -8
View File
@@ -97,14 +97,14 @@ class ImageMathNode(io.ComfyNode):
"batch": getIndexTensorAlongDim(ae, 0),
"C": getIndexTensorAlongDim(ae, 1),
"channel": getIndexTensorAlongDim(ae, 1),
"W": ae.shape[2],
"width": ae.shape[2],
"H": ae.shape[1],
"height": ae.shape[1],
"T": ae.shape[0],
"batch_count": ae.shape[0],
"N": ae.shape[3],
"channel_count": ae.shape[3],
"W": float(ae.shape[2]),
"width": float(ae.shape[2]),
"H": float(ae.shape[1]),
"height": float(ae.shape[1]),
"T": float(ae.shape[0]),
"batch_count": float(ae.shape[0]),
"N": float(ae.shape[3]),
"channel_count": float(ae.shape[3]),
} | generate_dim_variables(ae)
# Add all dynamic inputs
+8 -8
View File
@@ -151,14 +151,14 @@ class LatentMathNode(io.ComfyNode):
"batch": getIndexTensorAlongDim(ae, batch_dim),
"C": getIndexTensorAlongDim(ae, channel_dim),
"channel": getIndexTensorAlongDim(ae, channel_dim),
"W": ae.shape[width_dim],
"width": ae.shape[width_dim],
"H": ae.shape[height_dim],
"height": ae.shape[height_dim],
"T": frame_count,
"batch_count": ae.shape[batch_dim],
"N": ae.shape[channel_dim],
"channel_count": ae.shape[channel_dim],
"W": float(ae.shape[width_dim]),
"width": float(ae.shape[width_dim]),
"H": float(ae.shape[height_dim]),
"height": float(ae.shape[height_dim]),
"T": float(frame_count),
"batch_count": float(ae.shape[batch_dim]),
"N": float(ae.shape[channel_dim]),
"channel_count": float(ae.shape[channel_dim]),
} | generate_dim_variables(ae)
if time_dim is not None:
+6 -6
View File
@@ -92,12 +92,12 @@ class MaskMathNode(io.ComfyNode):
"Y": getIndexTensorAlongDim(ae, 1),
"B": getIndexTensorAlongDim(ae, 0),
"batch": getIndexTensorAlongDim(ae, 0),
"W": ae.shape[2],
"width": ae.shape[2],
"H": ae.shape[1],
"height": ae.shape[1],
"T": ae.shape[0],
"batch_count": ae.shape[0],
"W": float(ae.shape[2]),
"width": float(ae.shape[2]),
"H": float(ae.shape[1]),
"height": float(ae.shape[1]),
"T": float(ae.shape[0]),
"batch_count": float(ae.shape[0]),
} | generate_dim_variables(ae)
v_stacked, v_cnt = get_v_variable(V_norm, length_mismatch=length_mismatch)
+5 -5
View File
@@ -97,12 +97,12 @@ class NoiseExecutor:
"y": self.F.get("F2", 0.0),
"z": self.F.get("F3", 0.0),
"B": B, "batch": B,
"X": W, "width": samples.shape[width_dim],
"Y": H, "height": samples.shape[height_dim],
"X": W, "width": float(samples.shape[width_dim]),
"Y": H, "height": float(samples.shape[height_dim]),
"C": C, "channel": C,
"W": samples.shape[width_dim], "H": samples.shape[height_dim], "I": samples,
"T": frame_count, "N": samples.shape[channel_dim],
"batch_count": samples.shape[batch_dim], "channel_count": samples.shape[channel_dim],
"W": float(samples.shape[width_dim]), "H": float(samples.shape[height_dim]), "I": samples,
"T": float(frame_count), "N": float(samples.shape[channel_dim]),
"batch_count": float(samples.shape[batch_dim]), "channel_count": float(samples.shape[channel_dim]),
"input_latent": samples,
} | generate_dim_variables(samples) | vals | self.F
+12 -12
View File
@@ -33,8 +33,8 @@ class VideoMathNode(io.ComfyNode):
io.String.Input("Expression_pi", default="I0*(1-F0)+I1*F0", multiline=False),
types=[io.String,MrmthParseTree],
tooltip="Expression to apply on pooled_input part of conditioning",
),
io.Combo.Input(
)
, io.Combo.Input(
id="length_mismatch",
options=["do nothing","error","tile", "pad"],
display_name="on size mismatch",
@@ -98,14 +98,14 @@ class VideoMathNode(io.ComfyNode):
"batch": getIndexTensorAlongDim(ae, 0),
"C": getIndexTensorAlongDim(ae, 1),
"channel": getIndexTensorAlongDim(ae, 1),
"W": ae.shape[2],
"width": ae.shape[2],
"H": ae.shape[1],
"height": ae.shape[1],
"T": ae.shape[0],
"batch_count": ae.shape[0],
"N": ae.shape[3],
"channel_count": ae.shape[3],
"W": float(ae.shape[2]),
"width": float(ae.shape[2]),
"H": float(ae.shape[1]),
"height": float(ae.shape[1]),
"T": float(ae.shape[0]),
"batch_count": float(ae.shape[0]),
"N": float(ae.shape[3]),
"channel_count": float(ae.shape[3]),
} | generate_dim_variables(ae)
v_stacked, v_cnt = get_v_variable(V_norm, length_mismatch=length_mismatch)
@@ -177,8 +177,8 @@ class VideoMathNode(io.ComfyNode):
"R": sample_rate,
"sample_rate": sample_rate,
"batch": getIndexTensorAlongDim(a_w, 0),
"T": a_w.shape[0],
"batch_count": a_w.shape[0],
"T": float(a_w.shape[0]),
"batch_count": float(a_w.shape[0]),
} | generate_dim_variables(a_w) | V_norm_waveforms | sample_rates
v_stacked, v_cnt = get_v_variable(V_norm_waveforms, length_mismatch=length_mismatch)