code: def test_activity_regularization(self):
      class ActivityRegularizer(layers.Layer):
          def call(self, x):
              return x
  
      layer = ActivityRegularizer(activity_regularizer="l1")
      layer(np.ones((1,)))
      self.assertLen(layer.losses, 1)
      self.assertAllClose(layer.losses[0], 0.01)
  
      # losses are reset upon call
      layer(np.ones((1,)))
      self.assertLen(layer.losses, 1)
      self.assertAllClose(layer.losses[0], 0.01)
  
      # KerasTensors are no op
      layer = ActivityRegularizer(activity_regularizer="l1")
      layer(layers.Input(batch_shape=(2, 2)))
      self.assertLen(layer.losses, 0)
  
imports: import numpy
  import pytest
  from keras import backend
  from keras import layers
  from keras import metrics
  from keras import models
  from keras import ops
  from keras import testing
label_desc: Use image node_id 7 for calling the LayerTest obj's underlying member method code with example usage: obj.test_activity_regularization() and returns: x