【问题标题】:Does tensorflow's tfprof output theoretical FLOPS?tensorflow 的 tfprof 输出理论 FLOPS 吗?
【发布时间】:2017-12-15 11:53:59
【问题描述】:

我使用 tfprof 来分析机器学习算法。这是示例输出: ==================模型分析报告====================== 节点名 | # float_ops _TFProfRoot (--/3163.86b 触发器) InceptionResnetV2/InceptionResnetV2/Mixed_6a/Branch_1/Conv2d_0b_3x3/convolution(173.41b/173.41b flops) InceptionResnetV2/InceptionResnetV2/Conv2d_4a_3x3/convolution(167.25b/167.25b flops)

这里,在“167.25b/167.25b flops”中,第二个 167.25b 表示什么?是理论上的失败吗?

【问题讨论】:

    标签: machine-learning tensorflow profiling flops


    【解决方案1】:

    是的,这是理论上的失败。 Ops 可以使用RegisterStatistics 注解注册统计信息。

    Here 是此类注册的一个示例:

    @ops.RegisterStatistics("MatMul", "flops")
    def _calc_mat_mul_flops(graph, node):
      """Calculates the compute resources needed for MatMul."""
      transpose_a = node.attr["transpose_a"].b
      a_shape = graph_util.tensor_shape_from_node_def_name(graph, node.input[0])
      a_shape.assert_is_fully_defined()
      if transpose_a:
        k = int(a_shape[0])
      else:
        k = int(a_shape[1])
      output_shape = graph_util.tensor_shape_from_node_def_name(graph, node.name)
      output_shape.assert_is_fully_defined()
      output_count = np.prod(output_shape.as_list())
      return ops.OpStats("flops", (k * output_count * 2))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-18
      • 1970-01-01
      相关资源
      最近更新 更多