def __init__(self, config, img_size):
    super(Embeddings, self).__init__()
    self.config = config
    down_factor = config.down_factor
    patch_size = _triple(config.patches['size'])
    n_patches = int(((((img_size[0] / (2 ** down_factor)) // patch_size[0]) * ((img_size[1] / (2 ** down_factor)) // patch_size[1])) * ((img_size[2] / (2 ** down_factor)) // patch_size[2])))
    self.hybrid_model = CNNEncoder(config, n_channels=2)
    in_channels = config['encoder_channels'][(- 1)]
    self.patch_embeddings = Conv3d(in_channels=in_channels, out_channels=config.hidden_size, kernel_size=patch_size, stride=patch_size)
    self.position_embeddings = nn.Parameter(torch.zeros(1, n_patches, config.hidden_size))
    self.dropout = Dropout(config.transformer['dropout_rate'])
def __init__(self, config, img_size):
    super(Embeddings, self).__init__()
    self.config = config
    down_factor = config.down_factor
    patch_size = _triple(config.patches['size'])
    n_patches = int(((((img_size[0] / (2 ** down_factor)) // patch_size[0]) * ((img_size[1] / (2 ** down_factor)) // patch_size[1])) * ((img_size[2] / (2 ** down_factor)) // patch_size[2])))
    self.hybrid_model = CNNEncoder(config, n_channels=2)
    in_channels = config['encoder_channels'][(- 1)]
    self.patch_embeddings = Conv3d(in_channels=in_channels, out_channels=config.hidden_size, kernel_size=patch_size, stride=patch_size)
    self.position_embeddings = nn.Parameter(torch.zeros(1, n_patches, config.hidden_size))
    self.dropout = Dropout(config.transformer['dropout_rate'])