MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / LayerWithLosses

Class LayerWithLosses

tensorflow/python/keras/custom_training_loop_test.py:35–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33
34
35class LayerWithLosses(keras.layers.Layer):
36
37 def build(self, input_shape):
38 self.v = self.add_weight(
39 name='hey',
40 shape=(),
41 initializer='ones',
42 regularizer=keras.regularizers.l1(100))
43
44 def call(self, inputs):
45 self.add_loss(math_ops.reduce_sum(inputs))
46 return self.v * inputs
47
48
49class LayerWithMetrics(keras.layers.Layer):

Callers 1

add_loss_stepFunction · 0.85

Calls

no outgoing calls

Tested by 1

add_loss_stepFunction · 0.68