Commit 094fc680 by Yong Wu Committed by Yizhi Liu

[Relay][Frontend] add log op in tf frontend (#3111)

* [Relay][Frontend] add log op in tf frontend

* address comment
parent 88daa2bc
......@@ -1094,6 +1094,7 @@ _convert_map = {
'ArgMin' : _argx(_op.argmin, 'argmin'),
'AvgPool' : _pooling('avg_pool'),
'BatchNormWithGlobalNormalization' : _batch_norm(),
'BatchToSpaceND' : _batch_to_space_nd(),
'BiasAdd' : _bias_add(),
'Cast' : _cast(),
'Ceil' : AttrCvt('ceil'),
......@@ -1119,6 +1120,7 @@ _convert_map = {
'LeakyRelu' : AttrCvt('leaky_relu'),
'Less' : _broadcast('less'),
'LessEqual' : _broadcast('less_equal'),
'Log' : AttrCvt('log'),
'LogicalAnd' : _logical('logical_and'),
'LogicalOr' : _logical('logical_or'),
'LogicalNot' : _logical('logical_not'),
......@@ -1151,6 +1153,7 @@ _convert_map = {
'Sign' : AttrCvt('sign'),
'Slice' : _slice(),
'Softmax' : _softmax(),
'SpaceToBatchND' : _space_to_batch_nd(),
'Split' : _split(False),
'SplitV' : _split(True),
'Square' : _square(),
......@@ -1162,8 +1165,7 @@ _convert_map = {
'Tile' : _tile(),
'Transpose' : _transpose(),
'Unpack' : _unpack(),
'SpaceToBatchND' : _space_to_batch_nd(),
'BatchToSpaceND' : _batch_to_space_nd(),
}
def _LSTMBlockCell():
......
......@@ -1440,6 +1440,23 @@ def test_forward_pow_exp():
compare_tf_with_tvm([np_in1, np_in2], ['in1:0', 'in2:0'], 'pow:0')
compare_tf_with_tvm([np_in1], ['in1:0'], 'exp:0')
def test_forward_log():
"""test Log """
np_data = np.random.uniform(1, 100, size=(2, 3, 5)).astype(np.float32)
tf.reset_default_graph()
in_data = tf.placeholder(tf.float32, (2, 3, 5), name="in_data")
tf.log(in_data, name="log")
compare_tf_with_tvm([np_data], ['in_data:0'], 'log:0')
def test_forward_rsqrt():
"""test Rsqrt """
np_data = np.random.uniform(1, 100, size=(5, 7, 11)).astype(np.float32)
tf.reset_default_graph()
in_data = tf.placeholder(tf.float32, (5, 7, 11), name="in_data")
tf.rsqrt(in_data, name="rsqrt")
print(tf.get_default_graph().as_graph_def())
compare_tf_with_tvm([np_data], ['in_data:0'], 'rsqrt:0')
#######################################################################
# Mean
# ----
......@@ -1525,6 +1542,8 @@ if __name__ == '__main__':
test_forward_reverse_v2()
test_forward_pow_exp()
test_forward_sign()
test_forward_log()
test_forward_rsqrt()
test_forward_expand_dims()
# Reductions
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment