mirror of
https://github.com/zebrajr/tensorflow.git
synced 2025-12-06 00:19:58 +01:00
Use const references rather than constexpr for some constants
in the TF Lite C++ API. This is to enable better API compatibility with TF Lite in Play services while preserving the implementation flexibility of changing those constants in future releases. PiperOrigin-RevId: 693503483
This commit is contained in:
parent
0431df7fd4
commit
b72cbba113
|
|
@ -8,6 +8,14 @@
|
|||
|
||||
* <DOCUMENT BREAKING CHANGES HERE>
|
||||
* <THIS SECTION SHOULD CONTAIN API, ABI AND BEHAVIORAL BREAKING CHANGES>
|
||||
* `LiteRT`, a.k.a. `tf.lite`:
|
||||
* C++ API:
|
||||
* The public constants `tflite::Interpreter:kTensorsReservedCapacity`
|
||||
and `tflite::Interpreter:kTensorsCapacityHeadroom` are now const
|
||||
references, rather than `constexpr` compile-time constants.
|
||||
(This is to enable better API compatibility for TFLite in Play services
|
||||
while preserving the implementation flexibility to change the values of
|
||||
these constants in the future.)
|
||||
|
||||
### Known Caveats
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,9 @@ static_assert(sizeof(TfLiteFloat16) == sizeof(uint16_t),
|
|||
|
||||
namespace tflite {
|
||||
|
||||
const int& Interpreter::kTensorsReservedCapacity = 128;
|
||||
const int& Interpreter::kTensorsCapacityHeadroom = 16;
|
||||
|
||||
namespace {
|
||||
|
||||
// Gets the current TfLiteQuantization from the legacy TfLiteQuantizationParams.
|
||||
|
|
|
|||
|
|
@ -693,13 +693,14 @@ class Interpreter {
|
|||
/// \brief Gets the profiler used for op tracing.
|
||||
Profiler* GetProfiler();
|
||||
|
||||
// The default capacity of `tensors_` vector.
|
||||
static constexpr int kTensorsReservedCapacity = 128;
|
||||
/// The capacity headroom of `tensors_` vector before calling ops'
|
||||
/// `prepare` and `invoke` function. In these functions, it's guaranteed
|
||||
/// allocating up to `kTensorsCapacityHeadroom` more tensors won't invalidate
|
||||
/// The default capacity of the tensors vector.
|
||||
static const int& kTensorsReservedCapacity;
|
||||
|
||||
/// The capacity headroom of the tensors vector before calling ops'
|
||||
/// `prepare` and `invoke` function. In those functions, it's guaranteed
|
||||
/// allocating up to this many more tensors won't invalidate
|
||||
/// pointers to existing tensors.
|
||||
static constexpr int kTensorsCapacityHeadroom = 16;
|
||||
static const int& kTensorsCapacityHeadroom;
|
||||
|
||||
/// \warning This is an experimental API and subject to change. \n
|
||||
/// \brief Set if buffer handle output is allowed.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user