# Path: disentanglement_lib/utils/convolute_hub.py
# def convolute_and_save(module_path, signature, export_path, transform_fn,
#                        transform_checkpoint_path, new_signature=None):
#   def module_fn():
# def save_numpy_arrays_to_checkpoint(checkpoint_path, **dict_with_arrays):
# def _placeholders_from_module(tfhub_module, signature):


import os
import numpy as np
import tensorflow.compat.v1 as tf
import tensorflow_hub as hub
from disentanglement_lib.utils import convolute_hub
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests for convolute_hub.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function


class ConvoluteHubTest(tf.test.TestCase):

  def test_convolute(self):

    # Create variables to use.
    random_state = np.random.RandomState(0)
    data = random_state.normal(size=(5, 10))
    variable1 = random_state.normal(size=(10, 6))
    variable2 = random_state.normal(size=(6, 2))

    # Save variables to checkpoint.
    checkpoint_path = os.path.join(self.get_temp_dir(), "checkpoint.ckpt")

# Path: disentanglement_lib/utils/convolute_hub.py
# def convolute_and_save(module_path, signature, export_path, transform_fn,
#                        transform_checkpoint_path, new_signature=None):
#   def module_fn():
# def save_numpy_arrays_to_checkpoint(checkpoint_path, **dict_with_arrays):
# def _placeholders_from_module(tfhub_module, signature):


# Path: disentanglement_lib/utils/convolute_hub_test.py
import os
import numpy as np
import tensorflow.compat.v1 as tf
import tensorflow_hub as hub
from disentanglement_lib.utils import convolute_hub

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests for convolute_hub.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function


class ConvoluteHubTest(tf.test.TestCase):

  def test_convolute(self):

    # Create variables to use.
    random_state = np.random.RandomState(0)
    data = random_state.normal(size=(5, 10))
    variable1 = random_state.normal(size=(10, 6))
    variable2 = random_state.normal(size=(6, 2))

    # Save variables to checkpoint.
    checkpoint_path = os.path.join(self.get_temp_dir(), "checkpoint.ckpt")

    convolute_hub.save_numpy_arrays_to_checkpoint(