# Path: disentanglement_lib/data/ground_truth/ground_truth_data.py
# class GroundTruthData(object):
#   def num_factors(self):
#   def factors_num_values(self):
#   def observation_shape(self):
#   def sample_factors(self, num, random_state):
#   def sample_observations_from_factors(self, factors, random_state):
#   def sample(self, num, random_state):
#   def sample_observations(self, num, random_state):
# 
# Path: disentanglement_lib/data/ground_truth/util.py
# def tf_data_set_from_ground_truth_data(ground_truth_data, random_seed):
#   def generator():
#   def __init__(self, factor_sizes, latent_factor_indices):
#   def num_latent_factors(self):
#   def sample_latent_factors(self, num, random_state):
#   def sample_all_factors(self, latent_factors, random_state):
#   def _sample_factor(self, i, num, random_state):
#   def __init__(self, factor_sizes, features):
#   def features_to_index(self, features):
#   def _features_to_state_space_index(self, features):
# class SplitDiscreteStateSpace(object):
# class StateSpaceAtomIndex(object):


import os
import numpy as np
import tensorflow.compat.v1 as tf
from disentanglement_lib.data.ground_truth import ground_truth_data
from disentanglement_lib.data.ground_truth import util
    elif mode == "mpi3d_realistic":
      mpi3d_path = os.path.join(
          os.environ.get("DISENTANGLEMENT_LIB_DATA", "."), "mpi3d_realistic",
          "mpi3d_realistic.npz")
      if not tf.io.gfile.exists(mpi3d_path):
        raise ValueError(
            "Dataset '{}' not found. Make sure the dataset is publicly available and downloaded correctly."
            .format(mode))
      else:
        with tf.io.gfile.GFile(mpi3d_path, "rb") as f:
          data = np.load(f)
      self.factor_sizes = [4, 4, 2, 3, 3, 40, 40]
    elif mode == "mpi3d_real":
      mpi3d_path = os.path.join(
          os.environ.get("DISENTANGLEMENT_LIB_DATA", "."), "mpi3d_real",
          "mpi3d_real.npz")
      if not tf.io.gfile.exists(mpi3d_path):
        raise ValueError(
            "Dataset '{}' not found. Make sure the dataset is publicly available and downloaded correctly."
            .format(mode))
      else:
        with tf.io.gfile.GFile(mpi3d_path, "rb") as f:
          data = np.load(f)
      self.factor_sizes = [6, 6, 2, 3, 3, 40, 40]
    else:
      raise ValueError("Unknown mode provided.")

    self.images = data["images"]
    self.latent_factor_indices = [0, 1, 2, 3, 4, 5, 6]
    self.num_total_factors = 7

# Path: disentanglement_lib/data/ground_truth/ground_truth_data.py
# class GroundTruthData(object):
#   def num_factors(self):
#   def factors_num_values(self):
#   def observation_shape(self):
#   def sample_factors(self, num, random_state):
#   def sample_observations_from_factors(self, factors, random_state):
#   def sample(self, num, random_state):
#   def sample_observations(self, num, random_state):
# 
# Path: disentanglement_lib/data/ground_truth/util.py
# def tf_data_set_from_ground_truth_data(ground_truth_data, random_seed):
#   def generator():
#   def __init__(self, factor_sizes, latent_factor_indices):
#   def num_latent_factors(self):
#   def sample_latent_factors(self, num, random_state):
#   def sample_all_factors(self, latent_factors, random_state):
#   def _sample_factor(self, i, num, random_state):
#   def __init__(self, factor_sizes, features):
#   def features_to_index(self, features):
#   def _features_to_state_space_index(self, features):
# class SplitDiscreteStateSpace(object):
# class StateSpaceAtomIndex(object):


# Path: disentanglement_lib/data/ground_truth/mpi3d.py
import os
import numpy as np
import tensorflow.compat.v1 as tf
from disentanglement_lib.data.ground_truth import ground_truth_data
from disentanglement_lib.data.ground_truth import util

    elif mode == "mpi3d_realistic":
      mpi3d_path = os.path.join(
          os.environ.get("DISENTANGLEMENT_LIB_DATA", "."), "mpi3d_realistic",
          "mpi3d_realistic.npz")
      if not tf.io.gfile.exists(mpi3d_path):
        raise ValueError(
            "Dataset '{}' not found. Make sure the dataset is publicly available and downloaded correctly."
            .format(mode))
      else:
        with tf.io.gfile.GFile(mpi3d_path, "rb") as f:
          data = np.load(f)
      self.factor_sizes = [4, 4, 2, 3, 3, 40, 40]
    elif mode == "mpi3d_real":
      mpi3d_path = os.path.join(
          os.environ.get("DISENTANGLEMENT_LIB_DATA", "."), "mpi3d_real",
          "mpi3d_real.npz")
      if not tf.io.gfile.exists(mpi3d_path):
        raise ValueError(
            "Dataset '{}' not found. Make sure the dataset is publicly available and downloaded correctly."
            .format(mode))
      else:
        with tf.io.gfile.GFile(mpi3d_path, "rb") as f:
          data = np.load(f)
      self.factor_sizes = [6, 6, 2, 3, 3, 40, 40]
    else:
      raise ValueError("Unknown mode provided.")

    self.images = data["images"]
    self.latent_factor_indices = [0, 1, 2, 3, 4, 5, 6]
    self.num_total_factors = 7

    self.state_space = util.SplitDiscreteStateSpace(self.factor_sizes,