class_docstr: MNASNet, as described in https://arxiv.org/abs/1807.11626. This
  implements the B1 variant of the model.
  >>> model = MNASNet(1.0, num_classes=1000)
  >>> x = torch.rand(1, 3, 224, 224)
  >>> y = model(x)
  >>> y.dim()
  2
  >>> y.nelement()
  1000
class_docstr_tok: ["MNASNet",",","as","described","in","https",":","\/\/arxiv.org\/abs\/1807.11626",".","This","implements","the","B1","variant","of","the","model",".",">",">",">","model","=","MNASNet","(","1.0",",","num_classes=1000",")",">",">",">","x","=","torch.rand","(","1",",","3",",","224",",","224",")",">",">",">","y","=","model","(","x",")",">",">",">","y.dim","(",")","2",">",">",">","y.nelement","(",")","1000"]
code: def __init__(
      self, alpha: float, num_classes: int = 1000, dropout: float = 0.2
  ) -> None:
      super().__init__()
      _log_api_usage_once(self)
      if alpha <= 0.0:
          raise ValueError(
              f"alpha should be greater than 0.0 instead of {alpha}"
          )
      self.alpha = alpha
      self.num_classes = num_classes
      depths = _get_depths(alpha)
      layers = [
          # First layer: regular conv.
          nn.Conv2d(3, depths[0], 3, padding=1, stride=2, bias=False),
          nn.BatchNorm2d(depths[0], momentum=_BN_MOMENTUM),
          nn.ReLU(inplace=True),
          # Depthwise separable, no skip.
          nn.Conv2d(
              depths[0],
              depths[0],
              3,
              padding=1,
              stride=1,
              groups=depths[0],
              bias=False,
          ),
          nn.BatchNorm2d(depths[0], momentum=_BN_MOMENTUM),
          nn.ReLU(inplace=True),
          nn.Conv2d(
              depths[0], depths[1], 1, padding=0, stride=1, bias=False
          ),
          nn.BatchNorm2d(depths[1], momentum=_BN_MOMENTUM),
          # MNASNet blocks: stacks of inverted residuals.
          _stack(depths[1], depths[2], 3, 2, 3, 3, _BN_MOMENTUM),
          _stack(depths[2], depths[3], 5, 2, 3, 3, _BN_MOMENTUM),
          _stack(depths[3], depths[4], 5, 2, 6, 3, _BN_MOMENTUM),
          _stack(depths[4], depths[5], 3, 1, 6, 2, _BN_MOMENTUM),
          _stack(depths[5], depths[6], 5, 2, 6, 4, _BN_MOMENTUM),
          _stack(depths[6], depths[7], 3, 1, 6, 1, _BN_MOMENTUM),
          # Final mapping to classifier input.
          nn.Conv2d(
              depths[7], 1280, 1, padding=0, stride=1, bias=False
          ),
          nn.BatchNorm2d(1280, momentum=_BN_MOMENTUM),
          nn.ReLU(inplace=True),
      ]
      self.layers = nn.Sequential(*layers)
      self.classifier = nn.Sequential(
          nn.Dropout(p=dropout, inplace=True),
          nn.Linear(1280, num_classes),
      )
  
      for m in self.modules():
          if isinstance(m, nn.Conv2d):
              nn.init.kaiming_normal_(
                  m.weight, mode="fan_out", nonlinearity="relu"
              )
              if m.bias is not None:
                  nn.init.zeros_(m.bias)
          elif isinstance(m, nn.BatchNorm2d):
              nn.init.ones_(m.weight)
              nn.init.zeros_(m.bias)
          elif isinstance(m, nn.Linear):
              nn.init.kaiming_uniform_(
                  m.weight, mode="fan_out", nonlinearity="sigmoid"
              )
              nn.init.zeros_(m.bias)
  
imports: import warnings
  from functools import partial
  from typing import Any, Dict, List, Optional
  import torch
  import torch.nn
  from torch import Tensor
  from ..transforms._presets import ImageClassification
  from ..utils import _log_api_usage_once
  from ._api import register_model, Weights, WeightsEnum
  from ._meta import _IMAGENET_CATEGORIES
  from ._utils import _ovewrite_named_param, handle_legacy_interface
label_desc: Use image node_id 1 to create a new MNASNet object from inherited base classes: torch.nn with example: obj = MNASNet(alpha, num_classes, dropout)