PR #37378: Add "AddV2" to tensorflow v1 flops calculation
Imported from GitHub PR https://github.com/tensorflow/tensorflow/pull/37378 Copybara import of the project: -- 4e517f884cc22ca24b5186bc6289cd85e325786d by tigertang <tigertang.zju@gmail.com>: Add "AddV2" to tensorflow v1 flops calculation -- a74820d5ae7ec9a41ee77f55800cdabdaf3716d4 by tigertang <tigertang.zju@gmail.com>: Add another space line PiperOrigin-RevId: 300333508 Change-Id: If104ba82b7831ab5dd4ca0ea574aec36b5394fde
This commit is contained in:
parent
2394cfb44e
commit
0dc61704dd
@ -25,53 +25,21 @@ from tensorflow.python.framework import ops
|
|||||||
# List of all ops which have implemented flops statistics.
|
# List of all ops which have implemented flops statistics.
|
||||||
IMPLEMENTED_OPS = set([
|
IMPLEMENTED_OPS = set([
|
||||||
# Unary ops
|
# Unary ops
|
||||||
"Reciprocal",
|
"Reciprocal", "Square", "Rsqrt", "Log", "Neg", "AssignSub", "AssignAdd",
|
||||||
"Square",
|
"L2Loss", "Softmax",
|
||||||
"Rsqrt",
|
|
||||||
"Log",
|
|
||||||
"Neg",
|
|
||||||
"AssignSub",
|
|
||||||
"AssignAdd",
|
|
||||||
"L2Loss",
|
|
||||||
"Softmax",
|
|
||||||
# Binary ops
|
# Binary ops
|
||||||
"Add",
|
"Add", "Sub", "Mul", "RealDiv", "Maximum", "Minimum", "Pow", "RsqrtGrad",
|
||||||
"AddV2",
|
"GreaterEqual", "Greater", "LessEqual", "Less", "Equal", "NotEqual",
|
||||||
"Sub",
|
|
||||||
"Mul",
|
|
||||||
"RealDiv",
|
|
||||||
"Maximum",
|
|
||||||
"Minimum",
|
|
||||||
"Pow",
|
|
||||||
"RsqrtGrad",
|
|
||||||
"GreaterEqual",
|
|
||||||
"Greater",
|
|
||||||
"LessEqual",
|
|
||||||
"Less",
|
|
||||||
"Equal",
|
|
||||||
"NotEqual",
|
|
||||||
"SquaredDifference",
|
"SquaredDifference",
|
||||||
# Reduction ops
|
# Reduction ops
|
||||||
"Mean",
|
"Mean", "Sum", "ArgMax", "ArgMin", "BiasAddGrad",
|
||||||
"Sum",
|
|
||||||
"ArgMax",
|
|
||||||
"ArgMin",
|
|
||||||
"BiasAddGrad",
|
|
||||||
# Convolution and pooling
|
# Convolution and pooling
|
||||||
"AvgPool",
|
"AvgPool", "MaxPool", "AvgPoolGrad", "MaxPoolGrad", "Conv2DBackpropInput",
|
||||||
"MaxPool",
|
|
||||||
"AvgPoolGrad",
|
|
||||||
"MaxPoolGrad",
|
|
||||||
"Conv2DBackpropInput",
|
|
||||||
"Conv2DBackpropFilter",
|
"Conv2DBackpropFilter",
|
||||||
# Other ops
|
# Other ops
|
||||||
"AddN",
|
"AddN",
|
||||||
# Ops implemented in core tensorflow:
|
# Ops implemented in core tensorflow:
|
||||||
"MatMul",
|
"MatMul", "Conv2D", "DepthwiseConv2dNative", "BiasAdd", "Dilation2D",
|
||||||
"Conv2D",
|
|
||||||
"DepthwiseConv2dNative",
|
|
||||||
"BiasAdd",
|
|
||||||
"Dilation2D",
|
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@ -177,7 +145,6 @@ def _binary_per_element_op_flops(graph, node, ops_per_element=1):
|
|||||||
|
|
||||||
|
|
||||||
@ops.RegisterStatistics("Add", "flops")
|
@ops.RegisterStatistics("Add", "flops")
|
||||||
@ops.RegisterStatistics("AddV2", "flops")
|
|
||||||
def _add_flops(graph, node):
|
def _add_flops(graph, node):
|
||||||
"""Compute flops for Add operation."""
|
"""Compute flops for Add operation."""
|
||||||
return _binary_per_element_op_flops(graph, node)
|
return _binary_per_element_op_flops(graph, node)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user