You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@tf.functiondeffastfunction(tensor):
print('hi')
qobj=qutip.Qobj(tensor)
qobj+=qobjreturnqobj.data._tffastfunction(tf.constant([10])) # prints hifastfunction(tf.constant([10])) # Does not print hi since it only executes the graph.
It does not work with the current version of TfTensor as the instantiation process does as first step:
data=tf.constant(data)
Not sure what the error message I get means, but removing this line of code makes the above compiled function to work. tf.constant is meant to create "constant" nodes in the graph, so it makes sense it complains as you are making a constant value from a variable input. The fix is quite easy, just check if it is a tensor an do not do the tf.constant in that case. However, having fastfunction accept Qobj as input is a little bit more involved and will most likely require us to create our own qtf.function. I believe it is doable though.
The text was updated successfully, but these errors were encountered:
I have been able to make the following code work:
It does not work with the current version of TfTensor as the instantiation process does as first step:
Not sure what the error message I get means, but removing this line of code makes the above compiled function to work. tf.constant is meant to create "constant" nodes in the graph, so it makes sense it complains as you are making a constant value from a variable input. The fix is quite easy, just check if it is a tensor an do not do the
tf.constant
in that case. However, havingfastfunction
acceptQobj
as input is a little bit more involved and will most likely require us to create our ownqtf.function
. I believe it is doable though.The text was updated successfully, but these errors were encountered: