tqchen commented on code in PR #17053:
URL: https://github.com/apache/tvm/pull/17053#discussion_r1622485706


##########
tests/python/frontend/nnef/test_forward.py:
##########
@@ -0,0 +1,1627 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import os
+
+import numpy as np
+
+import _nnef
+import nnef
+import nnef_tools.interpreter.pytorch as interpreter
+
+import tvm
+import tvm.testing
+from tvm import relay
+
+
+graphs_dir = os.path.join("tests", "python", "frontend", "nnef", "cases")
+
+
+def get_nnef_outputs(path, inputs):
+    ip = interpreter.Interpreter(path, None, None)
+    inputs = [inputs[tensor.name] for tensor in ip.input_details()]
+    return ip(inputs)
+
+
+def get_type(val):
+    if val == "scalar":
+        return "float32"
+    if val == "integer":
+        return "int32"
+    if val == "logical":
+        return "bool"
+    if val == "string":
+        return "string"
+
+
+def verify_model(
+    model_path,

Review Comment:
   Historically we test correctness via the execution results. This however, 
leads to compound running time of the tests, and less unit testcases. As such 
tests needs to run for frontend/backend pairs.
   
   As the intermediate operators getting stablizes, we are getting to a world 
where we can unit test the frontend conversion independently. By validating 
they goes into the right structural form of IR. The backend correctness are 
then tested separately.
   
   So we would now instead move toward structural equality tests for unit tests 
when bringing in new frontends, to reduce the cost in that front. See the FX 
importer for an example. 
   
https://github.com/apache/tvm/blob/main/tests/python/relax/test_frontend_from_fx.py#L39
   
   The execution tests can still be used, please bring them to 
python/nightly/frontend, so they won't be triggered per PR
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to