4
最も近い例は、この問題にあります。この最小再現可能なコードでhttps://github.com/tensorflow/tensorflow/issues/899TensorFlow:モデルのFLOPSを測定する方法はありますか?私は得ることができます
:
import tensorflow as tf
import tensorflow.python.framework.ops as ops
g = tf.Graph()
with g.as_default():
A = tf.Variable(tf.random_normal([25,16]))
B = tf.Variable(tf.random_normal([16,9]))
C = tf.matmul(A,B) # shape=[25,9]
for op in g.get_operations():
flops = ops.get_stats_for_node_def(g, op.node_def, 'flops').value
if flops is not None:
print 'Flops should be ~',2*25*16*9
print '25 x 25 x 9 would be',2*25*25*9 # ignores internal dim, repeats first
print 'TF stats gives',flops
しかし、FLOPSが返さ常にNoneです。特にPBファイルでFLOPSを具体的に測定する方法はありますか?