Functions

tf_keras_vis.utils.is_mixed_precision(model)[source]

Check whether the model has any lower precision variable or not.

Parameters:

model (tf.keras.Model) – A model instance.

Returns:

When the model has any lower precision variable, True.

Return type:

bool

tf_keras_vis.utils.listify(value, return_empty_list_if_none=True, convert_tuple_to_list=True)[source]

Ensures that the value is a list.

If it is not a list, it creates a new list with value as an item.

Parameters:
  • value (object) – A list or something else.

  • return_empty_list_if_none (bool, optional) – When True (default), None you passed as value will be converted to a empty list (i.e., []). When False, None will be converted to a list that has an None (i.e., [None]). Defaults to True.

  • convert_tuple_to_list (bool, optional) – When True (default), a tuple you passed as value will be converted to a list. When False, a tuple will be unconverted (i.e., returning a tuple object that was passed as value). Defaults to True.

Returns:

A list. When value is a tuple and convert_tuple_to_list is False, a tuple.

Return type:

list

tf_keras_vis.utils.normalize(array, value_range=(1., 0.))[source]

Normalization.

Parameters:
  • array (np.ndarray) – A tensor.

  • value_range (tuple, optional) – array will be scaled in this range. Defaults to (1., 0.).

Returns:

Normalize array.

Return type:

np.ndarray

tf_keras_vis.utils.num_of_gpus()[source]

Return the number of physical and logical gpus.

Returns:

A tuple of the number of physical and logical gpus.

Return type:

Tuple[int, int]