예제 #1
0
    def __init__(self, graph, op_log=None):
        """Constructor.

    Args:
      graph: tf.Graph.
      op_log: optional. tensorflow::tfprof::OpLogProto proto. Used to define
          extra op types.
    """
        self._graph = graph
        # pylint: disable=protected-access
        op_log = tfprof_logger._merge_default_with_oplog(self._graph,
                                                         op_log=op_log)
        # pylint: enable=protected-access

        print_mdl.NewProfiler(
            self._graph.as_graph_def(add_shapes=True).SerializeToString(),
            op_log.SerializeToString())
예제 #2
0
    def __init__(self, graph=None, op_log=None):
        """Constructor.

    Args:
      graph: tf.Graph. If None and eager execution is not enabled, use
          default graph.
      op_log: optional. tensorflow::tfprof::OpLogProto proto. Used to define
          extra op types.
    """
        if not graph and not context.executing_eagerly():
            graph = ops.get_default_graph()
        self._coverage = 0.0
        self._graph = graph
        # pylint: disable=protected-access
        op_log = tfprof_logger.merge_default_with_oplog(self._graph,
                                                        op_log=op_log)
        # pylint: enable=protected-access
        print_mdl.NewProfiler(_graph_string(self._graph),
                              op_log.SerializeToString())