我执行下面的代码时出现以下错误
AttributeError: 'Tensor' object has no attribute 'numpy'
inp = Input(shape=(TIME_STEPS, INPUT_DIM,))
inp_time = Input(shape=(1,))
print(tf.executing_eagerly()) # return True
print(inp_time.numpy()) # error
# inp_time=inp_time.eval()/ K.get_value()/ x.numpy()/ K.eval()
x = ConvAtteShare(inp_time=inp_time.numpy(),kernel=(32,32),stride=(16,16),filter_num=3)(inp)
x = Dense(kind_num,activation='softmax')(x)
m = Model(inputs=[inp,inp_time], outputs=[x], name='convatte-test')
print(m.summary())
print(inp_time.numpy())
AttributeError: 'Tensor' object has no attribute 'numpy'
如果我是正确的,.Numpy仅在我应该运行的急切模式下受支持(请参阅print(tf.executing_agreely())返回true)
需要帮助找出错误以及哪里可能出错
谢谢你的帮助
更新tensorflow软件包,如果无法更新,请尝试键入
在python脚本的开头执行
相关问题 更多 >
编程相关推荐