altanh commented on a change in pull request #7677: URL: https://github.com/apache/tvm/pull/7677#discussion_r596288595
########## File path: tests/python/relay/test_pass_concretize_like.py ########## @@ -0,0 +1,108 @@ +# 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. +"""Tests for the ConcretizeLike pass.""" +import tvm +import tvm.relay.testing +from tvm import relay +from tvm.relay.testing import run_infer_type + + +def test_reshape_like(): + data = relay.var("data", shape=(2, 3, 4), dtype="float32") + shape_like = relay.var("shape_like", shape=(6, 2, 2), dtype="float32") + f = relay.Function([data, shape_like], relay.reshape_like(data, shape_like)) + f_expected = relay.Function([data, shape_like], relay.reshape(data, (6, 2, 2))) Review comment: this is a good point that I was wondering about while I wrote the tests. However this might be complicated, as removing an parameter means we'll need to remove the argument at each callsite (and then maybe re-apply the optimization until fixed point). I imagine we won't want to remove the parameter from a global function as then the user will have to ensure they don't pass the removed argument. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
