code: def layer(op):
      '''Decorator for composable network layers.'''
  
      def layer_decorated(self, *args, **kwargs):
          # Automatically set a name if not provided.
          name = kwargs.setdefault('name', self.get_unique_name(op.__name__))
          # Figure out the layer inputs.
          if len(self.terminals) == 0:
              raise RuntimeError('No input variables found for layer %s.' % name)
          elif len(self.terminals) == 1:
              layer_input = self.terminals[0]
          else:
              layer_input = list(self.terminals)
          # Perform the operation and get the output.
          layer_output = op(self, layer_input, *args, **kwargs)
          # Add to layer LUT.
          self.layers[name] = layer_output
          # This output is now the input for the next layer.
          self.feed(layer_output)
          # Return self for chained calls.
          return self
  
      return layer_decoratef layer(op):
      '''Decorator for composable network layers.'''
  
      def layer_decorated(self, *args, **kwargs):
          # Automatically set a name if not provided.
          name = kwargs.setdefault('name', self.get_unique_name(op.__name__))
          # Figure out the layer inputs.
          if len(self.terminals) == 0:
              raise RuntimeError('No input variables found for layer %s.' % name)
          elif len(self.terminals) == 1:
              layer_input = self.terminals[0]
          else:
              layer_input = list(self.terminals)
          # Perform the operation and get the output.
          layer_output = op(self, layer_input, *args, **kwargs)
          # Add to layer LUT.
          self.layers[name] = layer_output
          # This output is now the input for the next layer.
          self.feed(layer_output)
          # Return self for chained calls.
          return self
  
      return layer_decorated
docs: Decorator for composable network layers.