# Path: tensorboardX/summary.py
# _INVALID_TAG_CHARACTERS = _re.compile(r'[^-/\w\.]')
#     PLUGIN_NAME = 'hparams'
#     PLUGIN_DATA_VERSION = 0
#     EXPERIMENT_TAG = '_hparams_/experiment'
#     SESSION_START_INFO_TAG = '_hparams_/session_start_info'
#     SESSION_END_INFO_TAG = '_hparams_/session_end_info'
#     _MINIMUM_COUNT = 1e-7
# def _clean_tag(name):
# def _draw_single_box(image, xmin, ymin, xmax, ymax, display_str, color='black', color_text='black', thickness=2):
# def hparams(hparam_dict=None, metric_dict=None):
# def scalar(name, scalar, display_name="", summary_description=""):
# def histogram_raw(name, min, max, num, sum, sum_squares, bucket_limits, bucket_counts):
# def histogram(name, values, bins, max_bins=None):
# def make_histogram(values, bins, max_bins=None):
# def image(tag, tensor, rescale=1, dataformats='CHW'):
# def image_boxes(tag, tensor_image, tensor_boxes, rescale=1, dataformats='CHW', labels=None):
# def draw_boxes(disp_image, boxes, labels=None):
# def make_image(tensor, rescale=1, rois=None, labels=None):
# def video(tag, tensor, fps=4, dataformats="NTCHW"):
# def make_video(tensor, fps):
# def audio(tag, tensor, sample_rate=44100):
# def custom_scalars(layout):
# def text(tag, text):
# def pr_curve_raw(tag, tp, fp, tn, fn, precision, recall, num_thresholds=127, weights=None):
# def pr_curve(tag, labels, predictions, num_thresholds=127, weights=None):
# def compute_curve(labels, predictions, num_thresholds=None, weights=None):
# def _get_tensor_summary(tag, tensor, content_type, json_config):
# def mesh(tag, vertices, colors, faces, config_dict=None):
# 
# Path: tests/expect_reader.py
# def compare_proto(str_to_compare, function_ptr):
#     module_id = function_ptr.__class__.__module__
#     functionName = function_ptr.id().split('.')[-1]
#     test_file = os.path.realpath(sys.modules[module_id].__file__)
#     expected_file = os.path.join(os.path.dirname(test_file),
#                         "expect",
#                         module_id.split('.')[-1] + '.' + functionName + ".expect")
#     print("expected_file: %s" % expected_file)
#     assert os.path.exists(expected_file)
#     with open(expected_file) as f:
#         expected = f.read()
#     str_to_compare = str(str_to_compare)
#     print("str_to_compare:", removeWhiteChar(str_to_compare))
#     print("expected:", removeWhiteChar(expected))
#     assert removeWhiteChar(str_to_compare) == removeWhiteChar(expected)
# 
# def write_proto(str_to_compare, function_ptr):
#     module_id = function_ptr.__class__.__module__
#     functionName = function_ptr.id().split('.')[-1]
#     test_file = os.path.realpath(sys.modules[module_id].__file__)
#     expected_file = os.path.join(os.path.dirname(test_file),
#                     "expect",
#                     module_id.split('.')[-1] + '.' + functionName + ".expect")
#     print(expected_file)
#     with open(expected_file, 'w') as f:
#         f.write(str(str_to_compare))


from tensorboardX import summary
from .expect_reader import compare_proto, write_proto
import numpy as np
import pytest
import unittest
            import moviepy
            [-1, 1, -1],
        ]], dtype=float)
        colors_tensor = np.array([[
            [255, 0, 0],
            [0, 255, 0],
            [0, 0, 255],
            [255, 0, 255],
        ]], dtype=int)
        faces_tensor = np.array([[
            [0, 2, 3],
            [0, 3, 1],
            [0, 1, 2],
            [1, 3, 2],
        ]], dtype=int)
        compare_proto(summary.mesh('my_mesh', vertices=vertices_tensor, colors=colors_tensor, faces=faces_tensor), self)

    # It's hard to get dictionary sorted with same result in various envs. So only use one key per dict.
    def test_hparams(self):
        hp = {'lr': 0.1}
        mt = {'accuracy': 0.1}
        compare_proto(summary.hparams(hp, mt), self)

    def test_hparams_bool(self):
        hp = {'bool_var': True}
        mt = {'accuracy': 0.1}
        compare_proto(summary.hparams(hp, mt), self)

    def test_hparams_string(self):
        hp = {'string_var': "hi"}
        mt = {'accuracy': 0.1}

# Path: tensorboardX/summary.py
# _INVALID_TAG_CHARACTERS = _re.compile(r'[^-/\w\.]')
#     PLUGIN_NAME = 'hparams'
#     PLUGIN_DATA_VERSION = 0
#     EXPERIMENT_TAG = '_hparams_/experiment'
#     SESSION_START_INFO_TAG = '_hparams_/session_start_info'
#     SESSION_END_INFO_TAG = '_hparams_/session_end_info'
#     _MINIMUM_COUNT = 1e-7
# def _clean_tag(name):
# def _draw_single_box(image, xmin, ymin, xmax, ymax, display_str, color='black', color_text='black', thickness=2):
# def hparams(hparam_dict=None, metric_dict=None):
# def scalar(name, scalar, display_name="", summary_description=""):
# def histogram_raw(name, min, max, num, sum, sum_squares, bucket_limits, bucket_counts):
# def histogram(name, values, bins, max_bins=None):
# def make_histogram(values, bins, max_bins=None):
# def image(tag, tensor, rescale=1, dataformats='CHW'):
# def image_boxes(tag, tensor_image, tensor_boxes, rescale=1, dataformats='CHW', labels=None):
# def draw_boxes(disp_image, boxes, labels=None):
# def make_image(tensor, rescale=1, rois=None, labels=None):
# def video(tag, tensor, fps=4, dataformats="NTCHW"):
# def make_video(tensor, fps):
# def audio(tag, tensor, sample_rate=44100):
# def custom_scalars(layout):
# def text(tag, text):
# def pr_curve_raw(tag, tp, fp, tn, fn, precision, recall, num_thresholds=127, weights=None):
# def pr_curve(tag, labels, predictions, num_thresholds=127, weights=None):
# def compute_curve(labels, predictions, num_thresholds=None, weights=None):
# def _get_tensor_summary(tag, tensor, content_type, json_config):
# def mesh(tag, vertices, colors, faces, config_dict=None):
# 
# Path: tests/expect_reader.py
# def compare_proto(str_to_compare, function_ptr):
#     module_id = function_ptr.__class__.__module__
#     functionName = function_ptr.id().split('.')[-1]
#     test_file = os.path.realpath(sys.modules[module_id].__file__)
#     expected_file = os.path.join(os.path.dirname(test_file),
#                         "expect",
#                         module_id.split('.')[-1] + '.' + functionName + ".expect")
#     print("expected_file: %s" % expected_file)
#     assert os.path.exists(expected_file)
#     with open(expected_file) as f:
#         expected = f.read()
#     str_to_compare = str(str_to_compare)
#     print("str_to_compare:", removeWhiteChar(str_to_compare))
#     print("expected:", removeWhiteChar(expected))
#     assert removeWhiteChar(str_to_compare) == removeWhiteChar(expected)
# 
# def write_proto(str_to_compare, function_ptr):
#     module_id = function_ptr.__class__.__module__
#     functionName = function_ptr.id().split('.')[-1]
#     test_file = os.path.realpath(sys.modules[module_id].__file__)
#     expected_file = os.path.join(os.path.dirname(test_file),
#                     "expect",
#                     module_id.split('.')[-1] + '.' + functionName + ".expect")
#     print(expected_file)
#     with open(expected_file, 'w') as f:
#         f.write(str(str_to_compare))


# Path: tests/test_summary.py
from tensorboardX import summary
from .expect_reader import compare_proto, write_proto
import numpy as np
import pytest
import unittest
            import moviepy

            [-1, 1, -1],
        ]], dtype=float)
        colors_tensor = np.array([[
            [255, 0, 0],
            [0, 255, 0],
            [0, 0, 255],
            [255, 0, 255],
        ]], dtype=int)
        faces_tensor = np.array([[
            [0, 2, 3],
            [0, 3, 1],
            [0, 1, 2],
            [1, 3, 2],
        ]], dtype=int)
        compare_proto(summary.mesh('my_mesh', vertices=vertices_tensor, colors=colors_tensor, faces=faces_tensor), self)

    # It's hard to get dictionary sorted with same result in various envs. So only use one key per dict.
    def test_hparams(self):
        hp = {'lr': 0.1}
        mt = {'accuracy': 0.1}
        compare_proto(summary.hparams(hp, mt), self)

    def test_hparams_bool(self):
        hp = {'bool_var': True}
        mt = {'accuracy': 0.1}
        compare_proto(summary.hparams(hp, mt), self)

    def test_hparams_string(self):
        hp = {'string_var': "hi"}
        mt = {'accuracy': 0.1}

        compare_proto(summary.hparams(hp, mt), self)