Do not use TfLitePtrUnion.raw, it's deprecated; use .data instead.

PiperOrigin-RevId: 306484150
Change-Id: Ia2b1194a96ce5ba5eb781258afd958613b58a11f
This commit is contained in:
Robert David 2020-04-14 11:53:27 -07:00 committed by TensorFlower Gardener
parent d58a4dfc54
commit aee44120b0

View File

@ -157,7 +157,7 @@ TfLiteStatus AllocationInfoBuilder::AddTensors(const SubGraph* subgraph,
current->bytes = runtime_tensors[i].bytes; current->bytes = runtime_tensors[i].bytes;
current->first_created = -1; current->first_created = -1;
current->last_used = -1; current->last_used = -1;
current->needs_allocating = (runtime_tensors[i].data.raw == nullptr) && current->needs_allocating = (runtime_tensors[i].data.data == nullptr) &&
(!subgraph->tensors()->Get(i)->is_variable()); (!subgraph->tensors()->Get(i)->is_variable());
} }
@ -296,8 +296,8 @@ TfLiteStatus InitializeRuntimeTensor(
if (array->size()) { if (array->size()) {
// We've found a buffer with valid data, so update the runtime tensor // We've found a buffer with valid data, so update the runtime tensor
// data structure to point to it. // data structure to point to it.
result->data.raw = result->data.data =
const_cast<char*>(reinterpret_cast<const char*>(array->data())); const_cast<void*>(static_cast<const void*>(array->data()));
// We set the data from a serialized buffer, so record tha. // We set the data from a serialized buffer, so record tha.
result->allocation_type = kTfLiteMmapRo; result->allocation_type = kTfLiteMmapRo;
} }
@ -311,7 +311,7 @@ TfLiteStatus InitializeRuntimeTensor(
// TODO(petewarden): Some of these paths aren't getting enough testing // TODO(petewarden): Some of these paths aren't getting enough testing
// coverage, so we should figure out some tests that exercise them. // coverage, so we should figure out some tests that exercise them.
if (!result->data.raw) { if (result->data.data == nullptr) {
// The tensor contents haven't been set from a serialized buffer, so // The tensor contents haven't been set from a serialized buffer, so
// make a note that they will be allocated from memory. The actual // make a note that they will be allocated from memory. The actual
// allocation won't happen until later. // allocation won't happen until later.