【发布时间】:2020-06-21 22:36:13
【问题描述】:
我正在查看 keras 合并层 (https://keras.io/layers/merge/),并想了解每个层操作的执行情况。我想它们的功能相当直观,但我想弄清楚如何查看给定示例的输出。
为了说明我的意思,我有两个形状为 (1,10) 的随机输入的数组,并且想看看如果我要连接这两个数组,输出会是什么。但是,当我执行以下操作时,出现以下错误:Layer concatenate_18 was called with an input that isn't a symbolic tensor. Received type: <class 'numpy.ndarray'>...All inputs to the layer should be tensors.
from keras.layers import concatenate
data1 = np.random.normal(0, 1, size = (1, 10))
data2 = np.random.normal(0, 1, size = (1, 10))
concatenation = concatenate([data1, data2])
print(concatenation) # I want to print the output of concatenating data1 and data2
根据该消息,我假设此错误与输入是 numpy 数组这一事实有关,但我不确定应该采用什么适当的格式?如何查看在示例中使用 concatenate 的输出?谢谢!
【问题讨论】:
标签: python numpy keras concatenation tensor