otx.algorithms.visual_prompting.adapters.pytorch_lightning.models.utils.mlp_block#

MLP block module.

Classes

MLPBlock(embedding_dim, mlp_dim, act)

MLPBlock module.

class otx.algorithms.visual_prompting.adapters.pytorch_lightning.models.utils.mlp_block.MLPBlock(embedding_dim: int, mlp_dim: int, act: ~typing.Type[~torch.nn.modules.module.Module] = <class 'torch.nn.modules.activation.GELU'>)[source]#

Bases: Module

MLPBlock module.

Reference: facebookresearch/segment-anything

Parameters:
  • embedding_dim (int) – Embedding dimension.

  • mlp_dim (int) – MLP dimension.

  • act (Type[nn.Module], optional) – Activation function. Defaults to nn.GELU.

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

forward(x: Tensor) Tensor[source]#

Forward function of MLPBlock.

Parameters:

x (Tensor) – Input tensor.

Returns:

Output tensor.

Return type:

Tensor