【发布时间】:2018-03-28 03:48:18
【问题描述】:
run_meta = tf.RunMetadata()
enter codwith tf.Session(graph=tf.Graph()) as sess:
K.set_session(sess)
with tf.device('/cpu:0'):
base_model = MobileNet(alpha=1, weights=None, input_tensor=tf.placeholder('float32', shape=(1,224,224,3)))
opts = tf.profiler.ProfileOptionBuilder.float_operation()
flops = tf.profiler.profile(sess.graph, run_meta=run_meta, cmd='op', options=opts)
opts = tf.profiler.ProfileOptionBuilder.trainable_variables_parameter()
params = tf.profiler.profile(sess.graph, run_meta=run_meta, cmd='op', options=opts)
print("{:,} --- {:,}".format(flops.total_float_ops, params.total_parameters))
当我运行上面的代码时,我得到了以下结果
1,137,481,704 --- 4,253,864
这与论文中描述的失败不同。
手机网:https://arxiv.org/pdf/1704.04861.pdf
ShuffleNet:https://arxiv.org/pdf/1707.01083.pdf
如何计算论文中描述的精确翻牌?
【问题讨论】:
-
您可以使用以下 pip 包获取一些基本信息,例如模型的内存要求,不。参数,触发器等pypi.org/project/model-profiler
标签: deep-learning keras flops