Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion qbiocode/embeddings/embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ def data_map_func(x: np.ndarray) -> float:
float: the mapped value
"""
coeff = x[0] / 2 if len(x) == 1 else reduce(lambda m, n: (m * n) / 2, x)
return float(coeff)
try:
return float(coeff)
except TypeError:
# coeff is a symbolic ParameterExpression during circuit
# construction (unbound parameters) — return it unevaluated
# and let Qiskit bind real values later.
return coeff

else:
data_map_func = None
Expand Down