def call(self, inputs): if not hasattr(self, 'kernel'): embedding_layer = search_layer(inputs, self.embedding_name) if embedding_layer is None: raise Exception('Embedding layer not found') self.kernel = K.transpose(embedding_layer.embeddings) self.units = K.int_shape(self.kernel)[1] # <<< if not hasattr(self, 'bias') and self.use_bias: # <<< self.bias = self.add_weight(name='bias', shape=(self.units, ), initializer='zeros') outputs = K.dot(inputs, self.kernel) if self.use_bias: outputs = K.bias_add(outputs, self.bias) outputs = self.activation(outputs) return outputs
def call(self, inputs): outputs = K.dot(inputs, self.kernel) outputs = K.bias_add(outputs, self.bias) outputs = Activation(self.activation).call(outputs) return outputs