deepvariant/attention_module.py
def attach_attention_module(net: tf.Tensor,
                            attention_module: str,
                            end_point: str = None) -> Tuple[str, tf.Tensor]:
  """Attaches attention module to InceptionV3.

  Args:
    net: tf.Tensor corresponding to end_point.
    attention_module: str defining type of attention_module.
    end_point: str defining intermediate layer of model.

  Returns:
    end_point: str defining intermediate layer of model after attaching
    attention_module.
    net: tf.Tensor corresponding to new end_point.

  Raises:
    Exception: The attention_module is not defined.
  """

  if attention_module == 'se_block':
    se_block_scope = 'se_block' if end_point is None else end_point + '_SE'
    end_point = se_block_scope
    net = se_block(net, se_block_scope)
  else:
    raise Exception(
        "'{}' is not a supported attention module".format(attention_module))

  return end_point, net
Attaches attention module to InceptionV3.

  Args:
    net: tf.Tensor corresponding to end_point.
    attention_module: str defining type of attention_module.
    end_point: str defining intermediate layer of model.

  Returns:
    end_point: str defining intermediate layer of model after attaching
    attention_module.
    net: tf.Tensor corresponding to new end_point.

  Raises:
    Exception: The attention_module is not defined.
  
Attaches attention module to InceptionV3.
Attaches attention module to InceptionV3 .
def attach_attention_module(net: tf.Tensor,
                            attention_module: str,
                            end_point: str = None) -> Tuple[str, tf.Tensor]:
  if attention_module == 'se_block':
    se_block_scope = 'se_block' if end_point is None else end_point + '_SE'
    end_point = se_block_scope
    net = se_block(net, se_block_scope)
  else:
    raise Exception(
        "'{}' is not a supported attention module".format(attention_module))
  return end_point, net
def attach_attention_module ( net : tf . Tensor , attention_module : str , end_point : str = None ) -> Tuple [ str , tf . Tensor ] : if attention_module == 'se_block' : se_block_scope = 'se_block' if end_point is None else end_point + '_SE' end_point = se_block_scope net = se_block ( net , se_block_scope ) else : raise Exception ( "'{}' is not a supported attention module" . format ( attention_module ) ) return end_point , net
Attaches attention module to InceptionV3.
Attaches attention module to InceptionV3 .
"""Attaches attention module to InceptionV3.

  Args:
    net: tf.Tensor corresponding to end_point.
    attention_module: str defining type of attention_module.
    end_point: str defining intermediate layer of model.

  Returns:
    end_point: str defining intermediate layer of model after attaching
    attention_module.
    net: tf.Tensor corresponding to new end_point.

  Raises:
    Exception: The attention_module is not defined.
  """
str defining intermediate layer of model after attaching
attention_module.
net: tf.Tensor corresponding to new end_point.
str defining intermediate layer of model after attaching attention_module . net : tf . Tensor corresponding to new end_point .
end_point
The attention_module is not defined.
The attention_module is not defined .
Exception
net
tf.Tensor
tf.Tensor corresponding to end_point.
tf . Tensor corresponding to end_point .
attention_module
str
str defining type of attention_module.
str defining type of attention_module .
end_point
str
str defining intermediate layer of model.
str defining intermediate layer of model .