You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "RussellRao (via GitHub)" <gi...@apache.org> on 2023/06/09 07:52:44 UTC

[GitHub] [tvm] RussellRao opened a new issue, #15066: [Bug] [TFLite] AttributeError: 'ResizeBilinearOptions' object has no attribute 'HalfPixelCenters'

RussellRao opened a new issue, #15066:
URL: https://github.com/apache/tvm/issues/15066

   When I load a TFlite model with `relay.frontend.from_tflite` API, I get an AttributeError, as show below:
   
   
   ### Actual behavior
   
   `Traceback (most recent call last):
     File "tflite_main.py", line 59, in <module>
       mod, params = relay.frontend.from_tflite(tflite_model)
     File "/workspace/tvm/python/tvm/relay/frontend/tflite.py", line 4205, in from_tflite
       op_converter.convert_op_to_relay()
     File "/workspace/tvm/python/tvm/relay/frontend/tflite.py", line 276, in convert_op_to_relay
       ret = self.convert_map[op_code_str](op)
     File "/workspace/tvm/python/tvm/relay/frontend/tflite.py", line 748, in convert_resize_bilinear
       return self._convert_resize("linear", op)
     File "/workspace/tvm/python/tvm/relay/frontend/tflite.py", line 726, in _convert_resize
       half_pixel_centers = resize_options.HalfPixelCenters()
   AttributeError: 'ResizeBilinearOptions' object has no attribute 'HalfPixelCenters`
   
   ### Environment
   
   - TVM:0.13.dev0
   - TFLite:2.1.0
   
   ### Root Cause and Solution
   
   1. Because I followed the [documentation guide](https://tvm.apache.org/docs/how_to/compile_models/from_tflite.html#:~:text=pip%20install%20tflite%3D%3D2.1.0) and install the TFLite with version 2.1.0,so we can modify the documentation with a higher TFlite version(such as 2.10.0)
   2. We can modify this line https://github.com/apache/tvm/blob/f172f6c70d8e72556225877c7522ef13b7b250e2/python/tvm/relay/frontend/tflite.py#L726 with:
   `try:
          half_pixel_centers = resize_options.HalfPixelCenters()
    except AttributeError:
          half_pixel_centers = False`
   As for ResizeBilinear Op, this attribution default to be false:https://www.tensorflow.org/api_docs/cc/struct/tensorflow/ops/resize-bilinear/attrs#:~:text=TF_MUST_USE_RESULT%20Attrs-,Defaults%20to%20false.,-Public%20attributes
   
   Guys, do you have any suggestions?
   ### Triage
   * needs-triage
   * frontend:tflite
   


-- 
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: commits-unsubscribe@tvm.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org