parameters: (self, inputs, state)
return_statement: return new_y, new_state
docstring: Run one step of the Intersection RNN.
  
      Args:
        inputs: input Tensor, 2D, batch x input size.
        state: state Tensor, 2D, batch x num units.
  
      Returns:
        new_y: batch x num units, Tensor representing the output of the +RNN
          after reading `inputs` when previous state was `state`.
        new_state: batch x num units, Tensor representing the state of the +RNN
          after reading `inputs` when previous state was `state`.
  
      Raises:
        ValueError: If input size cannot be inferred from `inputs` via
          static shape inference.
        ValueError: If input size != output size (these must be equal when
          using the Intersection RNN).
docstring_summary: Run one step of the Intersection RNN.
docstring_tokens: Run one step of the Intersection RNN .
function: def call(self, inputs, state):
      """Run one step of the Intersection RNN.
  
      Args:
        inputs: input Tensor, 2D, batch x input size.
        state: state Tensor, 2D, batch x num units.
  
      Returns:
        new_y: batch x num units, Tensor representing the output of the +RNN
          after reading `inputs` when previous state was `state`.
        new_state: batch x num units, Tensor representing the state of the +RNN
          after reading `inputs` when previous state was `state`.
  
      Raises:
        ValueError: If input size cannot be inferred from `inputs` via
          static shape inference.
        ValueError: If input size != output size (these must be equal when
          using the Intersection RNN).
      """
      sigmoid = math_ops.sigmoid
      tanh = math_ops.tanh
  
      input_size = inputs.get_shape().with_rank(2)[1]
      if input_size.value is None:
        raise ValueError("Could not infer input size from inputs.get_shape()[-1]")
  
      with vs.variable_scope(vs.get_variable_scope(),
                             initializer=self._initializer):
        # read-in projections (should be used for first layer in deep +RNN
        # to transform size of inputs from I --> N)
        if input_size.value != self._num_units:
          if self._num_input_proj:
            with vs.variable_scope("in_projection"):
              if self._linear1 is None:
                self._linear1 = _Linear(inputs, self._num_units, True)
              inputs = self._linear1(inputs)
          else:
            raise ValueError("Must have input size == output size for "
                             "Intersection RNN. To fix, num_in_proj should "
                             "be set to num_units at cell init.")
  
        n_dim = i_dim = self._num_units
        cell_inputs = array_ops.concat([inputs, state], 1)
        if self._linear2 is None:
          self._linear2 = _Linear(cell_inputs, 2*n_dim + 2*i_dim, True)
        rnn_matrix = self._linear2(cell_inputs)
  
        gh_act = rnn_matrix[:, :n_dim]                           # b x n
        h_act = rnn_matrix[:, n_dim:2*n_dim]                     # b x n
        gy_act = rnn_matrix[:, 2*n_dim:2*n_dim+i_dim]            # b x i
        y_act = rnn_matrix[:, 2*n_dim+i_dim:2*n_dim+2*i_dim]     # b x i
  
        h = tanh(h_act)
        y = self._y_activation(y_act)
        gh = sigmoid(gh_act + self._forget_bias)
        gy = sigmoid(gy_act + self._forget_bias)
  
        new_state = gh * state + (1.0 - gh) * h  # passed thru time
        new_y = gy * inputs + (1.0 - gy) * y  # passed thru depth
  
      return new_y, new_state
function_tokens: def call ( self , inputs , state ) : sigmoid = math_ops . sigmoid tanh = math_ops . tanh input_size = inputs . get_shape ( ) . with_rank ( 2 ) [ 1 ] if input_size . value is None : raise ValueError ( "Could not infer input size from inputs.get_shape()[-1]" ) with vs . variable_scope ( vs . get_variable_scope ( ) , initializer = self . _initializer ) : # read-in projections (should be used for first layer in deep +RNN # to transform size of inputs from I --> N) if input_size . value != self . _num_units : if self . _num_input_proj : with vs . variable_scope ( "in_projection" ) : if self . _linear1 is None : self . _linear1 = _Linear ( inputs , self . _num_units , True ) inputs = self . _linear1 ( inputs ) else : raise ValueError ( "Must have input size == output size for " "Intersection RNN. To fix, num_in_proj should " "be set to num_units at cell init." ) n_dim = i_dim = self . _num_units cell_inputs = array_ops . concat ( [ inputs , state ] , 1 ) if self . _linear2 is None : self . _linear2 = _Linear ( cell_inputs , 2 * n_dim + 2 * i_dim , True ) rnn_matrix = self . _linear2 ( cell_inputs ) gh_act = rnn_matrix [ : , : n_dim ] # b x n h_act = rnn_matrix [ : , n_dim : 2 * n_dim ] # b x n gy_act = rnn_matrix [ : , 2 * n_dim : 2 * n_dim + i_dim ] # b x i y_act = rnn_matrix [ : , 2 * n_dim + i_dim : 2 * n_dim + 2 * i_dim ] # b x i h = tanh ( h_act ) y = self . _y_activation ( y_act ) gh = sigmoid ( gh_act + self . _forget_bias ) gy = sigmoid ( gy_act + self . _forget_bias ) new_state = gh * state + ( 1.0 - gh ) * h # passed thru time new_y = gy * inputs + ( 1.0 - gy ) * y # passed thru depth return new_y , new_state