text: import torch.nn as nn
  
  
  def build_backbone(sizes, activation):
      layers = []
      for j in range(len(sizes) - 2):
          layers += [nn.Linear(sizes[j], sizes[j + 1]), activation]
      return layers
  
  
  def build_mlp(sizes, activation, output_activation=nn.Identity()):
      layers = []
      for j in range(len(sizes) - 1):
          act = activation if j < len(sizes) - 2 else output_activation
          layers += [nn.Linear(sizes[j], sizes[j + 1]), act]
      return nn.Sequential(*layers)
  