with tf.Session() as sess:
run_meta = tf.RunMetadata()
opts = tf.profiler.ProfileOptionBuilder.float_operation()
flops = tf.profiler.profile(graph=sess.graph,run_meta=run_meta,cmd=‘op’,options=opts)
print(‘Sum\t\t\t\t\t\t’,flops.total_float_ops/1e9,‘Gfloat_ops’)
tensorflow计算flops
最新推荐文章于 2024-02-07 15:04:03 发布