class_docstr: Launch MLP in C++
  
  Args:
      mlp_sizes (list of int): MLP sizes. Example: [1024,1024,1024] will create 2 MLP layers with shape 1024x1024
      bias (bool): Default True:
      relu (bool): Default True
class_docstr_tok: ["Launch","MLP","in","C++","Args",":","mlp_sizes","(","list","of","int",")",":","MLP","sizes",".","Example",":","[","1024,1024,1024","]","will","create","2","MLP","layers","with","shape","1024x1024","bias","(","bool",")",":","Default","True",":","relu","(","bool",")",":","Default","True"]
code: def __init__(self, mlp_sizes, bias=True, activation="relu"):
      super().__init__()
      self.num_layers = len(mlp_sizes) - 1
      self.mlp_sizes = copy(mlp_sizes)
      self.bias = 1 if bias else 0
  
      if activation == "none":
          self.activation = 0
      elif activation == "relu":
          self.activation = 1
      elif activation == "sigmoid":
          self.activation = 2
      else:
          raise TypeError("activation must be relu or none.")
  
      self.weights = []
      self.biases = []
      for i in range(self.num_layers):
          w = torch.nn.Parameter(
              torch.empty(mlp_sizes[i + 1], mlp_sizes[i])
          )
          self.weights.append(w)
          name = "weight_{}".format(i)
          setattr(self, name, w)
          if self.bias:
              b = torch.nn.Parameter(torch.empty(mlp_sizes[i + 1]))
              self.biases.append(b)
              name = "bias_{}".format(i)
              setattr(self, name, b)
  
      self.reset_parameters()
  
file_path: apex/apex/mlp/mlp.py
imports: from copy import copy
  import math
  import torch
  from torch import nn
  from apex._autocast_utils import _cast_if_autocast_enabled
  import mlp_cuda
label_desc: Use image node_id 1 to create a new MLP object from inherited base classes: torch.nn with example: obj = MLP(mlp_sizes, bias, activation)