This is an archive of the discontinued LLVM Phabricator instance.

[mlgo][nfc] Decouple TensorSpec from tensorflow.
ClosedPublic

Authored by mtrofin on Apr 19 2022, 2:29 PM.

Details

Summary

The motivation is twofold:

  1. Allow plugging in a different training-time evaluator, e.g. TFLite-based, etc.
  1. 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.

Diff Detail

Event Timeline

mtrofin created this revision.Apr 19 2022, 2:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 19 2022, 2:29 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
mtrofin requested review of this revision.Apr 19 2022, 2:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 19 2022, 2:29 PM
gjain accepted this revision.Apr 21 2022, 12:38 PM
This revision is now accepted and ready to land.Apr 21 2022, 12:38 PM
This revision was landed with ongoing or failed builds.Apr 21 2022, 3:37 PM
This revision was automatically updated to reflect the committed changes.