def setUp(self):
        super(PluginTest, self).setUp()
        # Log dir to save temp events into.
        self._log_dir = self.get_temp_dir()
        self._eval_result_output_dir = os.path.join(self.get_temp_dir(),
                                                    "eval_result")
        if not os.path.isdir(self._eval_result_output_dir):
            os.mkdir(self._eval_result_output_dir)

        writer = tf.summary.create_file_writer(self._log_dir)

        with writer.as_default():
            summary_v2.FairnessIndicators(self._eval_result_output_dir, step=1)
        writer.close()

        # Start a server that will receive requests.
        self._multiplexer = event_multiplexer.EventMultiplexer({
            ".":
            self._log_dir,
        })
        self._context = base_plugin.TBContext(logdir=self._log_dir,
                                              multiplexer=self._multiplexer)
        self._plugin = plugin.FairnessIndicatorsPlugin(self._context)
        self._multiplexer.Reload()
        wsgi_app = application.TensorBoardWSGI([self._plugin])
        self._server = werkzeug_test.Client(wsgi_app, wrappers.BaseResponse)
        self._routes = self._plugin.get_plugin_apps()
Beispiel #2
0
def main(unused_argv):
    writer = tf.summary.create_file_writer(FLAGS.logdir)

    with writer.as_default():
        summary_v2.FairnessIndicators(FLAGS.eval_result_output_dir, step=1)
    writer.close()
 def _write_summary(self, eval_result_output_dir):
     writer = tf2.summary.create_file_writer(self.get_temp_dir())
     with writer.as_default():
         summary_v2.FairnessIndicators(eval_result_output_dir, step=1)
     writer.close()