[PATCH] D124045: [mlgo][nfc] Decouple TensorSpec from tensorflow.

Mircea Trofin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 14:29:28 PDT 2022


mtrofin created this revision.
mtrofin added reviewers: yundiqian, gjain, ebrevdo.
Herald added a subscriber: hiraditya.
Herald added a project: All.
mtrofin requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124045

Files:
  llvm/include/llvm/Analysis/Utils/TFUtils.h
  llvm/lib/Analysis/TFUtils.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124045.423739.patch
Type: text/x-patch
Size: 8306 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220419/5c0f9a24/attachment.bin>


More information about the llvm-commits mailing list