From 207d1f3b3aa28e0b13d1d85c3f5b5d2005f90245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Kolarovszki?= Date: Thu, 20 Jul 2023 17:08:24 +0200 Subject: [PATCH] fix(fock/pure): Fix interferometer typing Some typing errors have been fixed. The typing has to be consistent, especially when calculating with tensorflow. --- piquasso/_backends/fock/pure/calculations/passive_linear.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/piquasso/_backends/fock/pure/calculations/passive_linear.py b/piquasso/_backends/fock/pure/calculations/passive_linear.py index 2be4dca5..797fadf1 100644 --- a/piquasso/_backends/fock/pure/calculations/passive_linear.py +++ b/piquasso/_backends/fock/pure/calculations/passive_linear.py @@ -42,7 +42,7 @@ def passive_linear( interferometer: np.ndarray = instruction._get_passive_block( state._calculator, state._config - ).astype(np.complex128) + ).astype(state._config.complex_dtype) subspace = state._get_subspace(dim=len(interferometer)) @@ -318,7 +318,7 @@ def interferometer_gradient(*upstream): "ij,ij", upstream[i], fallback_np.conj(subspace_grad[i]) ) - return calculator.np.array(full_kl_grad) + return calculator.np.array(full_kl_grad, dtype=interferometer.dtype) return interferometer_gradient