renamed previous mul to matmul (#1254)
author윤현식/동작제어Lab(SR)/Principal Engineer/삼성전자 <hyunsik.yoon@samsung.com>
Thu, 17 May 2018 23:31:23 +0000 (08:31 +0900)
committer박세희/동작제어Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Thu, 17 May 2018 23:31:23 +0000 (08:31 +0900)
In previous PR (#1238), `mul` was added for two matrix multiplication.
However, it turned out that `mul` must be element-wise mul, not matmul (matrix mul).
For this reason previous `mul` was renamed to `matmul` and test was changed to `disabled`.
Also, 'matmul2x2.tflite` was uploaded into `npuarchive.mooo.com`.
(previous `mul2x2.tflite` in `npuarchive.mooo.com` will be deleted after this PR is merged.)

Signed-off-by: Hyun Sik Yoon <hyunsik.yoon@samsung.com>
tests/framework/tests/mul/matmul2x2/config.sh [new file with mode: 0644]
tests/framework/tests/mul/mul2x2/config.sh [deleted file]
tools/tensorflow_model_freezer/sample/matmul2x2_freezer.py [moved from tools/tensorflow_model_freezer/sample/mul2x2_freezer.py with 79% similarity]
tools/tensorflow_model_freezer/sample/run_converter.py

diff --git a/tests/framework/tests/mul/matmul2x2/config.sh b/tests/framework/tests/mul/matmul2x2/config.sh
new file mode 100644 (file)
index 0000000..ddbe389
--- /dev/null
@@ -0,0 +1,9 @@
+MODELFILE_SERVER="http://npuarchive.mooo.com/archive/nnfw/nn_framework_test"
+MODELFILE_NAME="matmul2x2.tflite"
+MODELFILE_MD5SUM="e53e10402fb6ab40f0dbba493ffe455d"
+STATUS="disabled"
+
+# this tflite is matmul (2x2 input, 2x2 const tensor)
+# the second 2x2 const tensor is [[1.1, 2.1],[3.1, 4.1]]
+#
+# enable this when we need to support matmul
diff --git a/tests/framework/tests/mul/mul2x2/config.sh b/tests/framework/tests/mul/mul2x2/config.sh
deleted file mode 100644 (file)
index b130450..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-MODELFILE_SERVER="http://npuarchive.mooo.com/archive/nnfw/nn_framework_test"
-MODELFILE_NAME="mul2x2.tflite"
-MODELFILE_MD5SUM="6a8fb24aaaf1688ed00afbf937e54110"
-
-# this tflite is mul (2x2 input, 2x2 const tensor)
-# the second 2x2 const tensor is [[1.1, 2.1],[3.1, 4.1]]
-# this is added to check if tensorflow lite calls MUL operation of NN api
@@ -21,22 +21,22 @@ import base_freezer
 
 
 # -----------
-class Mul2x2Freezer(base_freezer.BaseFreezer):
+class MatMul2x2Freezer(base_freezer.BaseFreezer):
     '''
-    class to generate tflite file that contains mul(x, y) where y is 2x2 const
+    class to generate tflite file that contains matmul(x, y) where y is 2x2 const
     '''
 
     def __init__(self, path):
         super(self.__class__, self).__init__(path)
 
     def getOutputDirectory(self):
-        return os.path.join(self.root_output_path, 'mul2x2')
+        return os.path.join(self.root_output_path, 'matmul2x2')
 
     def getTopNodeName(self):
-        return "MUL2X2_TOP"
+        return "MATMUL2X2_TOP"
 
     def getModelName(self):
-        return "mul(2x2, 2x2)"
+        return "matmul(2x2, 2x2)"
 
     def buildModel(self, sess):
 
@@ -46,9 +46,7 @@ class Mul2x2Freezer(base_freezer.BaseFreezer):
         y = tf.get_variable(
             "y_var", [2, 2], dtype=tf.float32, initializer=tf.zeros_initializer())
 
-        y_val = [[1.1, 2.1], [3.1, 4.1]]
-
-        mulTop = tf.matmul(x_input, y, name=self.getTopNodeName())
+        matmulTop = tf.matmul(x_input, y, name=self.getTopNodeName())
 
         init_op = tf.global_variables_initializer()
 
@@ -60,7 +58,7 @@ class Mul2x2Freezer(base_freezer.BaseFreezer):
         # Note if we use tf.const() instead of tf.get_variable(),
         # an error will be thrown while generating checkpoint file (before freezing)
         y_value = [[1.1, 2.1], [3.1, 4.1]]
-        sess.run(tf.assign(y, y_val))
+        sess.run(tf.assign(y, y_value))
 
         # returning (input_node_list, output_node_list)
-        return ([x_input], [mulTop])
+        return ([x_input], [matmulTop])
index 1380230..0c82dc7 100644 (file)
@@ -22,7 +22,7 @@ import relu_freezer
 import softmax_freezer
 import add1x1_freezer
 import add5x5_freezer
-import mul2x2_freezer
+import matmul2x2_freezer
 
 
 # --------
@@ -50,8 +50,8 @@ def main():
     freezer = add5x5_freezer.Add5x5Freezer(root_output_path)
     freezer.createSaveFreezeModel()
 
-    # generate TFLITE file for MUL (vector of shape [2,2], vector of shape [2,2])
-    freezer = mul2x2_freezer.Mul2x2Freezer(root_output_path)
+    # generate TFLITE file for MATMUL (vector of shape [2,2], vector of shape [2,2])
+    freezer = matmul2x2_freezer.MatMul2x2Freezer(root_output_path)
     freezer.createSaveFreezeModel()