我是keras的新手,我正在尝试为Keras创建新的指标,但是当使用符号Keras进行循环时,我遇到了一个问题。有人能帮助我吗?
def function(y_true, y_pred):
l_y_true = K.argmax(y_true, axis=1)
max_value = l_y_true.eval()
for val in range(len(max_value)):
pass
错误:
"/home/user/Documents/Playground/NeuralNetwork/Project/keras/GraphCNN.py", line 60, in my_metric label = l_y_true_max.eval()
File "/home/user/Documents/keras-env/lib/python3.5/site-packages/theano/gof/graph.py", line 520, in eval
self._fn_cache[inputs] = theano.function(inputs, self)
File "/home/user/Documents/keras-env/lib/python3.5/site-packages/theano/compile/function.py", line 320, in function
output_keys=output_keys)
File "/home/user/Documents/keras-env/lib/python3.5/site-packages/theano/compile/pfunc.py", line 479, in pfunc
output_keys=output_keys)
File "/home/user/Documents/keras-env/lib/python3.5/site-packages/theano/compile/function_module.py", line 1776, in orig_function
output_keys=output_keys).create(
File "/home/user/Documents/keras-env/lib/python3.5/site-packages/theano/compile/function_module.py", line 1428, in __init__
accept_inplace)
File "/home/user/Documents/keras-env/lib/python3.5/site-packages/theano/compile/function_module.py", line 177, in std_fgraph
update_mapping=update_mapping)
File "/home/user/Documents/keras-env/lib/python3.5/site-packages/theano/gof/fg.py", line 171, in __init__
self.__import_r__(output, reason="init")
File "/home/user/Documents/keras-env/lib/python3.5/site-packages/theano/gof/fg.py", line 360, in __import_r__
self.__import__(variable.owner, reason=reason)
File "/home/user/Documents/keras-env/lib/python3.5/site-packages/theano/gof/fg.py", line 474, in __import__
r)
theano.gof.fg.MissingInputError: ("An input of the graph, used to compute MaxAndArgmax(output_y_target, TensorConstant{(1,) of 1}), was not provided and not given a value.Use the Theano flag exception_verbosity='high',for more information on this error.", output_y_target)