Пример #1
0
    def profile_operations(self, options):
        """Profile the statistics of the Operation types (e.g. MatMul, Conv2D).

    Args:
      options: A dict of profiler options.
    Returns:
      a TFMultiGraphNodeProto that records the results.
    """
        opts = _build_options(options)
        tfprof_node = tfprof_output_pb2.TFMultiGraphNodeProto()
        tfprof_node.ParseFromString(
            print_mdl.Profile('op'.encode('utf-8'), opts.SerializeToString()))
        return tfprof_node
Пример #2
0
    def profile_graph(self, options):
        """Profile the statistics of graph nodes, organized by dataflow graph.

    Args:
      options: A dict of profiler options.
    Returns:
      a TFGraphNodeProto that records the results.
    """
        opts = _build_options(options)
        tfprof_node = tfprof_output_pb2.TFGraphNodeProto()
        tfprof_node.ParseFromString(
            print_mdl.Profile('graph'.encode('utf-8'),
                              opts.SerializeToString()))
        return tfprof_node
Пример #3
0
    def advise(self, options=ALL_ADVICE):  # pylint: disable=dangerous-default-value
        """Automatically detect problems and generate reports.

    Args:
      options: A dict of options.
    Returns:
      A Advise proto that conains the reports from all checkers.
    """
        advise_pb = tfprof_output_pb2.AdviceProto()
        opts = _build_advisor_options(options)
        advise_pb.ParseFromString(
            print_mdl.Profile('advise'.encode('utf-8'),
                              opts.SerializeToString()))
        return advise_pb
Пример #4
0
    def profile_python_codes(self, options):
        """Profile the statistics of the Python codes.

      Hint: set options['show_name_regexes'] = ['.*my_code.py.*']

    Args:
      options: A dict of profiler options.
    Returns:
      a TFMultiGraphNodeProto that records the results.
    """
        opts = _build_options(options)
        tfprof_node = tfprof_output_pb2.TFMultiGraphNodeProto()
        tfprof_node.ParseFromString(
            print_mdl.Profile('code'.encode('utf-8'),
                              opts.SerializeToString()))
        return tfprof_node