Skip to content

[Tracking Issue][TFLite] Expand unit test coverage for supported non-quantized operators #18971

@tlopex

Description

@tlopex

We just rebuilt the TFLite frontend.

Today, tests/python/relax/test_frontend_tflite.py already covers a subset of operators, including some via parametrized tests (for example RELU, RELU6, TANH, SOFTMAX, LOGISTIC, ARG_MIN, and ARG_MAX). However, its test coverage is still not enough.

This issue tracks adding operator-focused unit tests for supported non-quantized operators that are still under-tested or currently have no explicit coverage in the Relax TFLite frontend.

Candidate operators to cover

The list below is based on the current Relax frontend implementation and the current contents of tests/python/relax/test_frontend_tflite.py.

Shape / indexing / layout

  • SQUEEZE
  • STRIDED_SLICE
  • SLICE
  • SHAPE
  • SELECT / WHERE
  • GATHER
  • GATHER_ND
  • REVERSE_V2
  • REVERSE_SEQUENCE
  • TILE
  • UNPACK
  • ZEROS_LIKE
  • RANGE
  • SPLIT_V
  • SPACE_TO_BATCH_ND
  • BATCH_TO_SPACE_ND
  • DEPTH_TO_SPACE
  • SPACE_TO_DEPTH

Elementwise / activation / comparison / normalization

  • HARD_SWISH
  • LEAKY_RELU
  • RELU_N1_TO_1
  • PRELU
  • LOG
  • LOG_SOFTMAX
  • SQUARED_DIFFERENCE
  • GREATER
  • GREATER_EQUAL
  • L2_NORMALIZATION
  • LOCAL_RESPONSE_NORMALIZATION

Reductions

  • MEAN
  • REDUCE_MAX
  • REDUCE_MIN
  • REDUCE_PROD
  • SUM

Resize

  • RESIZE_BILINEAR
  • RESIZE_NEAREST_NEIGHBOR

Convolution / linear / pooling

  • FULLY_CONNECTED
  • DEPTHWISE_CONV_2D
  • TRANSPOSE_CONV
  • L2_POOL_2D

Padding / sparse / other

  • PAD
  • PADV2
  • MIRROR_PAD
  • ONE_HOT
  • MATRIX_DIAG
  • MATRIX_SET_DIAG
  • TOPK_V2
  • SPARSE_TO_DENSE
  • DENSIFY (sparse-to-dense tensor; may need a network-level test rather than a
    simple unit test)

Suggested contribution style

  • Small PRs are welcome. A PR can add coverage for one operator or a small related group
    of operators.
  • Please reuse the existing test style in tests/python/relax/test_frontend_tflite.py.
  • For simple conversions, checking the generated Relax IR with tvm.ir.assert_structural_equal is preferred. We really appreciate you provide Expected IRModule to test those ops
  • For larger operators, using the existing verify(...) helper pattern is also fine, following current tests in the file.
  • Numerical E2E checks should continue to follow the current nightly-only behavior guarded
    by CI_ENV_NIGHTLY.

Useful reference

The old Relay test file is a good source of test shapes, edge cases, and operator-specific scenarios:

  • tests/python/frontend/tflite/test_forward.py at commit 292ecfd210

Notes for contributors

This is a good-first-issue / parallelizable tracking issue:

  • each operator test is mostly independent
  • multiple PRs can land in parallel
  • contributors can reference this issue and check off the operator(s) covered by their PR

If you pick this up, please mention which operator(s) your PR adds coverage for.
And if you find some issues with existed ops when adding tests, you're welcome to fix them as well!

cc @leandron

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions