din里面加fm 不能save tf模型问题
Author: hepengfei-mlCreated Feb 5, 2021Updated Nov 3, 2022
Labelsto be solvedquestion
运行run_din.py 再din.py里面加了
din_logit = tf.keras.layers.Dense(1, use_bias=False,
kernel_initializer=tf.keras.initializers.glorot_normal(seed))(output)
sparse_feature_fm = embedding_lookup(embedding_dict, features, sparse_feature_columns,to_list=True)
fm_logit = FM()(concat_func(sparse_feature_fm,axis=1))
final_logit = add_func([fm_logit, din_logit])
output = PredictionLayer(task)(final_logit)
训练模型没有问题。但是保存的时候就会出现 ValueError: Dimension 0 in both shapes must be equal, but are 4 and 1. Shapes are [4] and [1]. for 'model/concatenate/concat_1' (op: 'ConcatV2') with input shapes: [?,1,4], [?,1,4], [?,1,1], [?,1,1], [] and with computed input tensors: input[4] = <1>.
Operating environment(运行环境):
- python version [e.g. 3.6]
- tensorflow version [e.g. 1.4.0, 1.5.0]
- deepctr version [e.g. 0.8.2,]
Source: shenweichen/DeepCTR