更新时间:2023-12-01 21:28:10
您正在运行一个期望张量为NumPy ndarray
的操作.不幸的是,这是行不通的.您只需要使用 张量运算符来重新实现自定义操作.
You are running an operation which expects a NumPy ndarray
on tensors. Unfortunately this will not work. You need to reimplement the custom operation using only tensor operators.
说过,直接使用Tensorflow中的函数也可以,例如import tensorflow
中的函数,并在自定义层中使用这些函数,可能会比单独提供Keras后端给您更多的功能.
Having said that, using functions from Tensorflow directly is OK as well, say from import tensorflow
and use those inside a custom layer might give you more functions than Keras backend alone.