[all-commits] [llvm/llvm-project] e4794f: [mlgo][nfc] Decouple TensorSpec from tensorflow.

Mircea Trofin via All-commits all-commits at lists.llvm.org
Thu Apr 21 15:37:19 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e4794ff5c685997c55f4308fac30a08eb8769758
      https://github.com/llvm/llvm-project/commit/e4794ff5c685997c55f4308fac30a08eb8769758
  Author: Mircea Trofin <mtrofin at google.com>
  Date:   2022-04-21 (Thu, 21 Apr 2022)

  Changed paths:
    M llvm/include/llvm/Analysis/Utils/TFUtils.h
    M llvm/lib/Analysis/TFUtils.cpp

  Log Message:
  -----------
  [mlgo][nfc] Decouple TensorSpec from tensorflow.

The motivation is twofold:

1) Allow plugging in a different training-time evaluator, e.g.
   TFLite-based, etc.

2) Allow using TensorSpec for AOT, too, to support evolution: we start
   by extracting a superset of the features currently supported by a
   model. For the tensors the model does not support, we just return a
   valid, but useless, buffer. This makes using a 'smaller' model (less
   supported tensors) transparent to the compiler. The key is to
   dimension the buffer appropriately, and we already have TensorSpec
   modeling that info.

The only coupling was due to the reliance of a TF internal API for
getting the element size, but for the types we are interested in,
`sizeof` is sufficient.

A subsequent change will yank out TensorSpec in its own module.

Differential Revision: https://reviews.llvm.org/D124045




More information about the All-commits mailing list