Closed saurabh-shringarpure closed 2 months ago
So tensorflow
is a bit annoying about requiring tensor types match even when how to cast them is obvious. Can you try explicitly casting (you can call tn.astype_()
) to make sure all the input TNs have the exact same dtype, both the target and constant ones?
I tried to cast with tn_guess.astype_(U)
but now I get another similar error:
TypeError:
xand
ymust have the same dtype, got tf.float64 != tf.complex128.
The argument to ‘astype’ should be a dtype specifier, like ‘complex128’, or you could inherit dynamically using ‘astype(U.dtype)’.
The error about type mismatch persists even with tn.astype_(U.dtype)
. Are there any additional constraints on tn for input to TNOptimizer
?
What is your issue?
I am using these functions modified from the docs:
for normalizing mpo:
for loss:
I get the following error when trying to use TNOptimizer with a custom MPO:
Custom MPO and target U: