最近我使用 tf.profile 来计算 ResNet-v1-50 的 FLOPs。我得到 7084572224(7.08 GFLOPs ?)。但在原始论文中是 3.8 GFLOPs。
我在 VGG-19 上执行相同的操作,得到 5628853928(56.29 GFLOPs?),但它的实际价值是 196 亿 FLOPs。请注意,所有测试模型都在 tf.slim 中。
我的代码如下:
run_meta = tf.RunMetadata()
im = tf.placeholder(tf.float32, [1, 224, 224, 3])
with arg_scope(resnet_v1.resnet_arg_scope(use_batch_norm=True)):
ims, endpoints = resnet_v1.resnet_v1_50(im)
print(get_num_of_params(tf.get_default_graph()))
opts = tf.profiler.ProfileOptionBuilder.float_operation()
flops = tf.profiler.profile(tf.get_default_graph(), run_meta=run_meta, cmd='op', options=opts)
print(flops.total_float_ops)
请有人帮助我。