From 6663943eaebe0c947e459edc40e7af2a577be4f6 Mon Sep 17 00:00:00 2001 From: flaport Date: Fri, 17 Nov 2023 10:15:20 -0800 Subject: [PATCH] bugfix of the bugfix --- fdtd/backend.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fdtd/backend.py b/fdtd/backend.py index 497cda8..8639b4e 100644 --- a/fdtd/backend.py +++ b/fdtd/backend.py @@ -75,8 +75,12 @@ class Backend: def __repr__(self): return self.__class__.__name__ + @staticmethod def is_complex(x): """check if an object is a `ComplexFloat`""" + import torch + import numpy as np + return ( isinstance(x, complex) or (isinstance(x, np.ndarray) and x.dtype in (np.complex64, np.complex128))