# Path: tensorflow_model_remediation/min_diff/keras/utils/structure_utils.py
# def _flatten_min_diff_structure(struct, run_validation=False):
# def _pack_min_diff_sequence_as(struct, flat_sequence):
# def _assert_same_min_diff_structure(struct1, struct2):
#   def _err_msg(specifics_template, use_dict_keys=False):
# def _is_min_diff_element(element, element_type=None):
# def validate_min_diff_structure(struct,
#                                 struct_name="struct",
#                                 element_type=None):


import collections
import tensorflow as tf
from tensorflow_model_remediation.min_diff.keras.utils import structure_utils
    `sensitive_group_dataset` and `0.0` for `nonsensitive_group_dataset`).
  - `min_diff_sample_weight`: is formed by concatenating the `sample_weight`
    components of the paired datasets. If both are `None`, then this will be set
    to `None`. If only one is `None`, it is replaced with a `Tensor` of ones of
    the appropriate shape.

  Returns:
    A `tf.data.Dataset` whose output is a tuple or structure (matching the
      structure of the inputs) of `(min_diff_x, min_diff_membership,
      min_diff_sample_weight)`.

  Raises:
    ValueError: If either `sensitive_group_dataset` or
      `nonsensitive_group_dataset` is not a valid MinDiff structure (unnested
      dict).
    ValueError: If `sensitive_group_dataset` and `nonsensitive_group_dataset` do
      not have the same structure.
  """
  # pyformat: enable
  # validate structures.
  structure_utils.validate_min_diff_structure(
      sensitive_group_dataset,
      struct_name="sensitive_group_dataset",
      element_type=tf.data.Dataset)
  structure_utils.validate_min_diff_structure(
      nonsensitive_group_dataset,
      struct_name="nonsensitive_group_dataset",
      element_type=tf.data.Dataset)
  try:


# Path: tensorflow_model_remediation/min_diff/keras/utils/structure_utils.py
# def _flatten_min_diff_structure(struct, run_validation=False):
# def _pack_min_diff_sequence_as(struct, flat_sequence):
# def _assert_same_min_diff_structure(struct1, struct2):
#   def _err_msg(specifics_template, use_dict_keys=False):
# def _is_min_diff_element(element, element_type=None):
# def validate_min_diff_structure(struct,
#                                 struct_name="struct",
#                                 element_type=None):


# Path: tensorflow_model_remediation/min_diff/keras/utils/input_utils.py
import collections
import tensorflow as tf
from tensorflow_model_remediation.min_diff.keras.utils import structure_utils

    `sensitive_group_dataset` and `0.0` for `nonsensitive_group_dataset`).
  - `min_diff_sample_weight`: is formed by concatenating the `sample_weight`
    components of the paired datasets. If both are `None`, then this will be set
    to `None`. If only one is `None`, it is replaced with a `Tensor` of ones of
    the appropriate shape.

  Returns:
    A `tf.data.Dataset` whose output is a tuple or structure (matching the
      structure of the inputs) of `(min_diff_x, min_diff_membership,
      min_diff_sample_weight)`.

  Raises:
    ValueError: If either `sensitive_group_dataset` or
      `nonsensitive_group_dataset` is not a valid MinDiff structure (unnested
      dict).
    ValueError: If `sensitive_group_dataset` and `nonsensitive_group_dataset` do
      not have the same structure.
  """
  # pyformat: enable
  # validate structures.
  structure_utils.validate_min_diff_structure(
      sensitive_group_dataset,
      struct_name="sensitive_group_dataset",
      element_type=tf.data.Dataset)
  structure_utils.validate_min_diff_structure(
      nonsensitive_group_dataset,
      struct_name="nonsensitive_group_dataset",
      element_type=tf.data.Dataset)
  try:


    structure_utils._assert_same_min_diff_structure(sensitive_group_dataset,