-
Notifications
You must be signed in to change notification settings - Fork 531
Open
Description
When I measure FLOPs of a Convolution layer with 3x3 kernel, 128 output channels, (1, 1, 128, 128) input data, "VALID" padding, thop and Tensorflow give me different results.
Tensorflow: 38612737
Torch: 20321280.0
Here is my code:
graph = tf.Graph()
with graph.as_default():
print("* Initialize network")
v = tf.keras.layers.Conv2D(128, (3, 3), padding="VALID", data_format="channels_first")(tf.placeholder(tf.float32, (1, 1, 128, 128)))
print("Tensorflow:", tf.profiler.profile(graph, options=tf.profiler.ProfileOptionBuilder.float_operation()).total_float_ops)
print("Torch:", thop.profile(torch.nn.Conv2d(1, 128, (3, 3)), inputs=(torch.zeros((1, 1, 128, 128)),), verbose=False)[0])
Why?
sytelus
Metadata
Metadata
Assignees
Labels
No labels