class_docstr: Applies a linear transformation and activation.
  
  Args:
      in_size (int): number of elements in each input sample.
      out_size (int): number of elements in each output sample.
      bias (bool): if set to ``False``, the layer will not learn an additive bias.
          Default: ``True``.
      activation (Union[torch.nn.Module, Callable[[torch.Tensor], torch.Tensor]]):
          the activation function to apply to the output of linear transformation.
          Default: torch.relu.
      device (Optional[torch.device]): default compute device.
  
  Example::
  
      batch_size = 3
      in_size = 40
      input = torch.randn(batch_size, in_size)
  
      out_size = 16
      perceptron = Perceptron(in_size, out_size, bias=True)
  
      output = perceptron(input)
      assert list(output) == [batch_size, out_size]
class_docstr_tok: ["Applies","a","linear","transformation","and","activation",".","Args",":","in_size","(","int",")",":","number","of","elements","in","each","input","sample",".","out_size","(","int",")",":","number","of","elements","in","each","output","sample",".","bias","(","bool",")",":","if","set","to","``","False","``",",","the","layer","will","not","learn","an","additive","bias",".","Default",":","``","True","``",".","activation","(","Union","[","torch.nn.Module",",","Callable","[","[","torch.Tensor","]",",","torch.Tensor","]","]",")",":","the","activation","function","to","apply","to","the","output","of","linear","transformation",".","Default",":","torch.relu",".","device","(","Optional","[","torch.device","]",")",":","default","compute","device",".","Example",":",":","batch_size","=","3","in_size","=","40","input","=","torch.randn","(","batch_size",",","in_size",")","out_size","=","16","perceptron","=","Perceptron","(","in_size",",","out_size",",","bias=True",")","output","=","perceptron","(","input",")","assert","list","(","output",")","==","[","batch_size",",","out_size","]"]
docstr: Args:
      input (torch.Tensor): tensor of shape (B, I) where I is number of elements
          in each input sample.
  
  Returns:
      torch.Tensor: tensor of shape (B, O) where O is number of elements per
          channel in each output sample (i.e. `out_size`).
docstr_tok: ["Args",":","input","(","torch.Tensor",")",":","tensor","of","shape","(","B",",","I",")","where","I","is","number","of","elements","in","each","input","sample",".","Returns",":","torch.Tensor",":","tensor","of","shape","(","B",",","O",")","where","O","is","number","of","elements","per","channel","in","each","output","sample","(","i.e",".","`","out_size","`",")","."]
code: def forward(self, input: torch.Tensor) -> torch.Tensor:
      """
      Args:
          input (torch.Tensor): tensor of shape (B, I) where I is number of elements
              in each input sample.
  
      Returns:
          torch.Tensor: tensor of shape (B, O) where O is number of elements per
              channel in each output sample (i.e. `out_size`).
      """
      return self._activation_fn(self._linear(input))
  
file_path: torchrec/torchrec/modules/mlp.py
imports: from typing import Callable, List, Optional, Union
  import torch
  from torch import nn
  from torchrec.modules.activation import SwishLayerNorm
  from torchrec.modules.utils import extract_module_or_tensor_callable
label_desc: Use image node_id 2 for calling the Perceptron obj's underlying member method code with example usage: obj.forward(input) and returns: self