def build(self, input_shape):
assert len(input_shape) == 2
input_dim = input_shape[1]
#self.input_spec = InputSpec(dtype=K.floatx(), shape=(None, input_dim))
self.input_spec = InputSpec(ndim=2, axes={1: input_dim})
self.W = self.add_weight(
shape=(input_dim, self.output_dim),
initializer=self.W_initializer,
name='SparseFullyConnected_W',
regularizer=self.W_regularizer,
constraint=self.W_constraint)
self.b = self.add_weight(
shape=(self.output_dim,),
initializer=self.b_initializer,
name='SparseFullyConnected_b',
regularizer=self.b_regularizer,
constraint=self.b_constraint)
if self.initial_weights is not None:
self.set_weights(self.initial_weights)
del self.initial_weights
#self.built = True
#super(SparseFullyConnectedLayer, self).build(input_shape)
评论列表
文章目录