MBConv3D#

pydantic model vision_architectures.blocks.mbconv_3d.MBConv3DConfig[source]#

Bases: CNNBlockConfig

Show JSON schema
{
   "title": "MBConv3DConfig",
   "type": "object",
   "properties": {
      "in_channels": {
         "default": null,
         "title": "In Channels",
         "type": "null"
      },
      "out_channels": {
         "default": null,
         "title": "Out Channels",
         "type": "null"
      },
      "kernel_size": {
         "default": 3,
         "title": "Kernel Size",
         "type": "integer"
      },
      "padding": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "items": {
                  "type": "integer"
               },
               "type": "array"
            },
            {
               "type": "string"
            }
         ],
         "default": "same",
         "title": "Padding"
      },
      "stride": {
         "default": 1,
         "title": "Stride",
         "type": "integer"
      },
      "conv_kwargs": {
         "additionalProperties": true,
         "default": {},
         "title": "Conv Kwargs",
         "type": "object"
      },
      "transposed": {
         "default": false,
         "description": "Whether to perform ConvTranspose instead of Conv",
         "title": "Transposed",
         "type": "boolean"
      },
      "normalization": {
         "default": "batchnorm3d",
         "title": "Normalization",
         "type": "string"
      },
      "normalization_pre_args": {
         "default": [],
         "items": {},
         "title": "Normalization Pre Args",
         "type": "array"
      },
      "normalization_post_args": {
         "default": [],
         "items": {},
         "title": "Normalization Post Args",
         "type": "array"
      },
      "normalization_kwargs": {
         "additionalProperties": true,
         "default": {},
         "title": "Normalization Kwargs",
         "type": "object"
      },
      "activation": {
         "default": "relu",
         "title": "Activation",
         "type": "string"
      },
      "activation_kwargs": {
         "additionalProperties": true,
         "default": {},
         "title": "Activation Kwargs",
         "type": "object"
      },
      "sequence": {
         "default": "CNA",
         "enum": [
            "C",
            "AC",
            "CA",
            "CD",
            "CN",
            "DC",
            "NC",
            "ACD",
            "ACN",
            "ADC",
            "ANC",
            "CAD",
            "CAN",
            "CDA",
            "CDN",
            "CNA",
            "CND",
            "DAC",
            "DCA",
            "DCN",
            "DNC",
            "NAC",
            "NCA",
            "NCD",
            "NDC",
            "ACDN",
            "ACND",
            "ADCN",
            "ADNC",
            "ANCD",
            "ANDC",
            "CADN",
            "CAND",
            "CDAN",
            "CDNA",
            "CNAD",
            "CNDA",
            "DACN",
            "DANC",
            "DCAN",
            "DCNA",
            "DNAC",
            "DNCA",
            "NACD",
            "NADC",
            "NCAD",
            "NCDA",
            "NDAC",
            "NDCA"
         ],
         "title": "Sequence",
         "type": "string"
      },
      "drop_prob": {
         "default": 0.0,
         "title": "Drop Prob",
         "type": "number"
      },
      "dim": {
         "title": "Dim",
         "type": "integer"
      },
      "out_dim": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Out Dim"
      },
      "expansion_ratio": {
         "default": 6.0,
         "title": "Expansion Ratio",
         "type": "number"
      },
      "se_reduction_ratio": {
         "default": 4.0,
         "title": "Se Reduction Ratio",
         "type": "number"
      }
   },
   "required": [
      "dim"
   ]
}

Config:
  • arbitrary_types_allowed: bool = True

  • extra: str = ignore

  • validate_default: bool = True

  • validate_assignment: bool = True

  • validate_return: bool = True

Fields:
Validators:
field dim: int [Required]#
Validated by:
field out_dim: int | None = None#
Validated by:
field expansion_ratio: float = 6.0#
Validated by:
field se_reduction_ratio: float = 4.0#
Validated by:
field kernel_size: int = 3#
Validated by:
field activation: str = 'relu'#
Validated by:
field normalization: str = 'batchnorm3d'#
Validated by:
field in_channels: None = None#
Validated by:
field out_channels: None = None#
Validated by:
property hidden_dim#
validator validate_before  »  all fields[source]#

Base class method for validating data before creating the model.

validator validate  »  all fields[source]#

Base method for validating the model after creation.

class vision_architectures.blocks.mbconv_3d.MBConv3D(config={}, checkpointing_level=0, **kwargs)[source]#

Bases: Module

__init__(config={}, checkpointing_level=0, **kwargs)[source]#

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(*args, **kwargs)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.