elvin-n commented on code in PR #11161: URL: https://github.com/apache/tvm/pull/11161#discussion_r871368616
########## tests/python/relay/test_conv2d_nhwc_texture.py: ########## @@ -0,0 +1,651 @@ +# 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 tvm +import numpy as np +from tvm import relay +from tvm.relay import testing +from tvm.relay.transform import recast +from tvm.relay.transform import recast +from tvm.contrib import graph_runtime + + +def get_reference(mod, params1, input_shape, inputs): Review Comment: moved shared functions into utils/adreno_utils.py ########## tests/python/relay/test_conv2d_nchw_texture.py: ########## @@ -0,0 +1,490 @@ +# 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 tvm +import numpy as np +from tvm import relay +from tvm.relay import testing +from tvm.relay.transform import recast +from tvm.relay.transform import recast +from tvm.contrib import graph_runtime + + +def get_reference(mod, params1, input_shape, inputs): + mod_fp32 = recast(mod, "float32", "float32", ops=["nn.conv2d", "add", "nn.relu"]) + with relay.build_config(opt_level=3): + graph, lib, params = relay.build(mod_fp32, "llvm", params=params1) + ctx = tvm.cpu() + m = graph_runtime.create(graph, lib, ctx) + if isinstance(input_shape, dict): + for key in input_shape: + m.set_input(key, inputs[-1]) + else: + m.set_input("data", inputs[-1]) + m.set_input(**params) + m.run() + return [ + m.get_output(0).asnumpy(), + ] + + +# build module run with opencl and cpu, compare results +def build_run_compare( Review Comment: moved shared functions into utils/adreno_utils.py -- 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]
