且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

具有高级计算功能的Keras自定义图层

更新时间:2023-12-01 21:18:46

我认为这种过程应在模型之前应用,因为该过程不包含变量,因此无法进行优化.

i think that this kinda process should apply before the model because the process does not contain variables so it cant be optimized.

K.eval(inputs)不起作用,因为您正在尝试评估一个占位符,而不是变量占位符没有用于评估的值.如果要获取值,则应该输入它,或者可以使用tf.unstack()一张一张地从张量中列出一个列表

K.eval(inputs) does not work beacuse you are trying to evaluate a placeholder not variable placeholders has not values for evaluate. if you want get values you should feed it or you can make a list from tensors one by one with tf.unstack()

nparray = tf.unstack(tf.unstack(tf.unstack(inputs,96,0),96,0),3,0)

您的调用函数是错误的,因为返回变量,您应该返回常量:

your call function is wrong because returns a variable you should return a constant:

result = K.constant(nparray, dtype='float32')
return result