tvm
tvm copied to clipboard
[WIP][Pylint] Making frontend tests pylint compliant
Fix pylint issues in https://github.com/apache/tvm/issues/11414 List of files to complete:
- [x] tests/python/frontend/caffe/test_forward.py
- [x] tests/python/frontend/caffe2/model_zoo/init.py
- [x] tests/python/frontend/caffe2/test_forward.py
- [x] tests/python/frontend/coreml/model_zoo/init.py
- [x] tests/python/frontend/coreml/test_forward.py
- [x] tests/python/frontend/darknet/test_forward.py
- [x] tests/python/frontend/keras/test_forward.py
- [ ] tests/python/frontend/mxnet/model_zoo/init.py
- [ ] tests/python/frontend/mxnet/model_zoo/dqn.py
- [ ] tests/python/frontend/mxnet/model_zoo/inception_v3.py
- [ ] tests/python/frontend/mxnet/model_zoo/mlp.py
- [ ] tests/python/frontend/mxnet/model_zoo/resnet.py
- [ ] tests/python/frontend/mxnet/model_zoo/squeezenet.py
- [ ] tests/python/frontend/mxnet/model_zoo/vgg.py
- [ ] tests/python/frontend/mxnet/test_forward.py
- [ ] tests/python/frontend/mxnet/test_graph.py
- [ ] tests/python/frontend/mxnet/test_qnn_ops_utils.py
- [x] tests/python/frontend/oneflow/test_forward.py
- [x] tests/python/frontend/oneflow/test_vision_models.py
- [x] tests/python/frontend/onnx/test_forward.py
- [ ] tests/python/frontend/paddlepaddle/test_forward.py
- [ ] tests/python/frontend/pytorch/qnn_test.py
- [x] tests/python/frontend/pytorch/test_forward.py
- [ ] tests/python/frontend/pytorch/test_fx_quant.py
- [ ] tests/python/frontend/pytorch/test_lstm.py
- [ ] tests/python/frontend/pytorch/test_object_detection.py
- [ ] tests/python/frontend/pytorch/test_rnns.py
- [ ] tests/python/frontend/tensorflow/test_bn_dynamic.py
- [ ] tests/python/frontend/tensorflow/test_control_flow.py
- [ ] tests/python/frontend/tensorflow/test_debugging.py
- [x] tests/python/frontend/tensorflow/test_forward.py
- [ ] tests/python/frontend/tensorflow/test_no_op.py
- [ ] tests/python/frontend/tensorflow2/common.py
- [ ] tests/python/frontend/tensorflow2/test_functional_models.py
- [ ] tests/python/frontend/tensorflow2/test_sequential_models.py
- [ ] tests/python/frontend/test_common.py
- [x] tests/python/frontend/tflite/test_forward.py
Thanks for contributing to TVM! Please refer to guideline https://tvm.apache.org/docs/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from Reviewers by @ them in the pull request thread.
I have some minor suggestions but all in all this look good. Especially the conditions "!= None" should be changed to "is not None" in my opinion however.
LGTM! Thanks for your advice.
@areusch basically completed, there are still a few questions that need to be confirmed with you.
Got some problem when fixing dangerous-default-value
in pytorch/test_forward.py
.
https://github.com/apache/tvm/blob/39ffe0a5ce14c2105b7d48ee420e82e194787d8f/tests/python/frontend/pytorch/test_forward.py#L122-L124
I've tried several ways but none of them fully solve the problem as 64 62 show. Any idea? @areusch @SebastianBoblest
Got some problem when fixing
dangerous-default-value
inpytorch/test_forward.py
.https://github.com/apache/tvm/blob/39ffe0a5ce14c2105b7d48ee420e82e194787d8f/tests/python/frontend/pytorch/test_forward.py#L122-L124
I've tried several ways but none of them fully solve the problem as 64 62 show. Any idea? @areusch @SebastianBoblest
Hi, this function ''verify_model'' is really complicated and the relation between the arguments is quite complex. For example, if model_name is not a string, what should it be then? None or is something else also possible. This function alone actually requires extensive testing in my opinion. But I think this is a separate issue. Why does input_data = input_data or [] not work in this case? It should be as close as possible to an empty list as default argument.
Not work casue it will result in RuntimeError: Boolean value of Tensor with more than one value is ambiguous
as ci_60 show.
Not work casue it will result in
RuntimeError: Boolean value of Tensor with more than one value is ambiguous
as ci_60 show.
Ok in this case you might need the more explicit form of this: input_data = [] if input_data is None else input_data
Often, the shortened version input_data = input_data or [] is used, however, it has a problem with complex expressions like tensors or numpy arrays that cannot be simply evaluated to True or False. Sorry for that, that was actually my fault.
Not work casue it will result in
RuntimeError: Boolean value of Tensor with more than one value is ambiguous
as ci_60 show.Ok in this case you might need the more explicit form of this: input_data = [] if input_data is None else input_data
Often, the shortened version input_data = input_data or [] is used, however, it has a problem with complex expressions like tensors or numpy arrays that cannot be simply evaluated to True or False. Sorry for that, that was actually my fault.
Haha, my fault too. My first version is something like this input_data = [] if input_data is None else input_data
. But I took your version because it looks cooler and simpler
@areusch
cc @areusch
thanks @blackkker and sorry for yet another delay. i tried to resolve the merge conflicts myself here, hopefully it goes green and can merge.
Unfortunately, it doesn't go green and i fix the conflicts. This time, I hope you can merge as soon as possible beacuse solving conflicts is annoying. Cry with joy. @areusch
@tvm-bot merge
thanks @blackkker ! and so sorry for the delays here.