def trainable_variables(self):
        """List of all trainable layer state.

        This is equivalent to `layer.trainable_weights`.
        """
        if not self.trainable:
            return []
        return [v for v in self.variables if v.trainable]
List of all trainable layer state.

        This is equivalent to `layer.trainable_weights`.
        
keras/src/layers/layer.py