parameters: (layers,
                           x,
                           use_skip_connections=False,
                           hidden_are_factored=False,
                           hidden_activation=nn.ReLU)
return_statement: return layers[-1](x)
docstring: Evaluates `layers` as a feedforward neural network on `x`.
  
    Args:
      layers: The neural network layers (`torch.Tensor` -> `torch.Tensor`
        callables).
      x: The array-like input to evaluate. Must be trivially convertible to a
        matrix (tensor rank <= 2).
      use_skip_connections: Whether or not to use skip connections between layers.
        If the layer input has too few features to be added to the layer output,
        then the end of input is padded with zeros. If it has too many features,
        then the input is truncated.
      hidden_are_factored: Whether or not hidden logical layers are factored into
        two separate linear transformations stored as adjacent elements of
        `layers`.
      hidden_activation: the activation function following the hidden layers.
  
    Returns:
      The `torch.Tensor` evaluation result.
  
    Raises:
      ValueError: If `x` has a rank greater than 2.
docstring_summary: Evaluates `layers` as a feedforward neural network on `x`.
docstring_tokens: Evaluates layers as a feedforward neural network on x .
function: def feedforward_evaluate(layers,
                           x,
                           use_skip_connections=False,
                           hidden_are_factored=False,
                           hidden_activation=nn.ReLU):
    """Evaluates `layers` as a feedforward neural network on `x`.
  
    Args:
      layers: The neural network layers (`torch.Tensor` -> `torch.Tensor`
        callables).
      x: The array-like input to evaluate. Must be trivially convertible to a
        matrix (tensor rank <= 2).
      use_skip_connections: Whether or not to use skip connections between layers.
        If the layer input has too few features to be added to the layer output,
        then the end of input is padded with zeros. If it has too many features,
        then the input is truncated.
      hidden_are_factored: Whether or not hidden logical layers are factored into
        two separate linear transformations stored as adjacent elements of
        `layers`.
      hidden_activation: the activation function following the hidden layers.
  
    Returns:
      The `torch.Tensor` evaluation result.
  
    Raises:
      ValueError: If `x` has a rank greater than 2.
    """
    x = tensor_to_matrix(x)
    i = 0
    while i < len(layers) - 1:
      if isinstance(layers[i], hidden_activation):
        x = layers[i](x)
        i += 1
        continue
      y = layers[i](x)
      i += 1
      if hidden_are_factored:
        y = layers[i](y)
        i += 1
      if use_skip_connections:
        my_num_features = x.shape[1]
        padding = y.shape[1] - my_num_features
        if padding > 0:
          zeros = torch.zeros([x.shape[0], padding])
          x = torch.cat([x, zeros], axis=1)
        elif padding < 0:
          x = x[0:x.shape[0], 0:y.shape[1]]
        y = x + y
      x = y
    return layers[-1](x)
function_tokens: def feedforward_evaluate ( layers , x , use_skip_connections = False , hidden_are_factored = False , hidden_activation = nn . ReLU ) : x = tensor_to_matrix ( x ) i = 0 while i < len ( layers ) - 1 : if isinstance ( layers [ i ] , hidden_activation ) : x = layers [ i ] ( x ) i += 1 continue y = layers [ i ] ( x ) i += 1 if hidden_are_factored : y = layers [ i ] ( y ) i += 1 if use_skip_connections : my_num_features = x . shape [ 1 ] padding = y . shape [ 1 ] - my_num_features if padding > 0 : zeros = torch . zeros ( [ x . shape [ 0 ] , padding ] ) x = torch . cat ( [ x , zeros ] , axis = 1 ) elif padding < 0 : x = x [ 0 : x . shape [ 0 ] , 0 : y . shape [ 1 ] ] y = x + y x = y return layers [ - 1 ] ( x )