class_docstr: A `Highway layer <https://arxiv.org/abs/1505.00387>`_ does a gated combination of a linear
  transformation and a non-linear transformation of its input.  :math:`y = g * x + (1 - g) *
  f(A(x))`, where :math:`A` is a linear transformation, :math:`f` is an element-wise
  non-linearity, and :math:`g` is an element-wise gate, computed as :math:`sigmoid(B(x))`.
  
  This module will apply a fixed number of highway layers to its input, returning the final
  result.
  
  Parameters
  ----------
  input_dim : ``int``
      The dimensionality of :math:`x`.  We assume the input has shape ``(batch_size, ...,
      input_dim)``.
  num_layers : ``int``, optional (default=``1``)
      The number of highway layers to apply to the input.
  activation : ``Callable[[torch.Tensor], torch.Tensor]``, optional (default=``torch.nn.functional.relu``)
      The non-linearity to use in the highway layers.
class_docstr_tok: ["A","`","Highway","layer","<","https",":","\/\/arxiv.org\/abs\/1505.00387",">","`","_","does","a","gated","combination","of","a","linear","transformation","and","a","non-linear","transformation","of","its","input",".",":","math",":","`","y","=","g","*","x","+","(","1","-","g",")","*","f","(","A","(","x",")",")","`",",","where",":","math",":","`","A","`","is","a","linear","transformation",",",":","math",":","`","f","`","is","an","element-wise","non-linearity",",","and",":","math",":","`","g","`","is","an","element-wise","gate",",","computed","as",":","math",":","`","sigmoid","(","B","(","x",")",")","`",".","This","module","will","apply","a","fixed","number","of","highway","layers","to","its","input",",","returning","the","final","result",".","Parameters","--","--","--","--","--","input_dim",":","``","int","``","The","dimensionality","of",":","math",":","`","x","`",".","We","assume","the","input","has","shape","``","(","batch_size",",","...",",","input_dim",")","``",".","num_layers",":","``","int","``",",","optional","(","default=","``","1","``",")","The","number","of","highway","layers","to","apply","to","the","input",".","activation",":","``","Callable","[","[","torch.Tensor","]",",","torch.Tensor","]","``",",","optional","(","default=","``","torch.nn.functional.relu","``",")","The","non-linearity","to","use","in","the","highway","layers","."]
code: def forward(self, inputs):  # pylint: disable=arguments-differ
      current_input = inputs
      for layer in self._layers:
          projected_input = layer(current_input)
          linear_part = current_input
          # NOTE: if you modify this, think about whether you should modify the initialization
          # above, too.
          nonlinear_part, gate = projected_input.chunk(2, dim=-1)
          nonlinear_part = self._activation(nonlinear_part)
          gate = torch.sigmoid(gate)
          current_input = (
              gate * linear_part + (1 - gate) * nonlinear_part
          )
      return current_input
  
imports: from __future__ import absolute_import
  import torch
label_desc: Use image node_id 2 for calling the Highway obj's underlying member method code with example usage: obj.forward(inputs) and returns: current_input