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","]"]
code: def __init__(
      self,
      in_size: int,
      out_size: int,
      bias: bool = True,
      activation: Union[
          torch.nn.Module,
          Callable[[torch.Tensor], torch.Tensor],
      ] = torch.relu,
      device: Optional[torch.device] = None,
      dtype: torch.dtype = torch.float32,
  ) -> None:
      super().__init__()
      torch._C._log_api_usage_once(
          f"torchrec.modules.{self.__class__.__name__}"
      )
      self._out_size = out_size
      self._in_size = in_size
      self._linear: nn.Linear = nn.Linear(
          self._in_size,
          self._out_size,
          bias=bias,
          device=device,
          dtype=dtype,
      )
      self._activation_fn: Callable[
          [torch.Tensor], torch.Tensor
      ] = activation
  
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 1 to create a new Perceptron object from inherited base classes: torch.nn with example: obj = Perceptron(in_size, out_size, bias, activation, device, dtype)