小弟使用tensorflow GNN建立模型,跟著範例(如下方連結)操作完全無誤,改成自己的資料時,出現模型輸出後,卻讀不進來的狀況,已經鎖定是新增特徵的寫法有誤,想問問解決方向,謝謝
'讀模型失敗'
from keras.models import load_model
edge_model.save(path + "edge_model")
edge_model = tf.keras.models.load_model(path + "edge_model",custom_objects=None, compile=True, options=None)
'可能錯誤的地方 : Concatenate,測試 axis = -1、2、1、0 皆失敗'
def set_initial_node_state(node_set, node_set_name):
features = [
tf.keras.layers.Dense(32,activation="relu")(node_set['buy'])
]
return tf.keras.layers.Concatenate()(features)
def set_initial_edge_state(edge_set, edge_set_name):
features = [
tf.keras.layers.Dense(32,activation="relu")(edge_set['same_ph2'])
]
return tf.keras.layers.Concatenate()(features)
錯誤代碼
Exception encountered when calling layer "concatenate" (type Concatenate).
A merge layer should be called on a list of inputs. Received: inputs=Tensor("Placeholder:0", shape=(None, 32), dtype=float32) (not a list of tensors)
Call arguments received by layer "concatenate" (type Concatenate):
• inputs=tf.Tensor(shape=(None, 32), dtype=float32)
照字面看,input需要是list。