如果用上面注释中的keras代码,test的时候就加载不了dense_1/bias
,用了下面的代码就正常了。真的rubbish
class Project_layer(object):
def __init__(self,num_classes):
# self.multiclass_dense_layer = K.layers.Dense(num_classes,activation='relu')
# super()
self.linear_model = tf.layers.Dense(units=num_classes,activation='relu')
def __call__(self,x):
# return self.multiclass_dense_layer(x)
# return subgraph(x)
return self.linear_model(x)
# return tf.layers.dense(x,self.num_classes,activation='relu')