Skip to content

Commit b044512

Browse files
committed
Sync from upstream TF.
1 parent ef64591 commit b044512

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

tensorflow/lite/core/c/c_api_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ extern "C" {
6161
#ifdef TFL_COMPILE_LIBRARY
6262
#define TFL_CAPI_EXPORT __declspec(dllexport)
6363
#else
64-
#define TFL_CAPI_EXPORT __declspec(dllimport)
64+
#define TFL_CAPI_EXPORT
6565
#endif // TFL_COMPILE_LIBRARY
6666
#else
6767
#define TFL_CAPI_EXPORT __attribute__((visibility("default")))

tensorflow/lite/core/c/common.cc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,8 @@ TfLiteAllocationStrategy TfLiteTensorGetAllocationStrategy(
404404
return kTfLiteAllocationStrategyUnknown;
405405
case kTfLiteVariantObject:
406406
return kTfLiteAllocationStrategyNew;
407+
case kTfLiteNonCpu:
408+
return kTfLiteAllocationStrategyUnknown;
407409
}
408410
return kTfLiteAllocationStrategyUnknown;
409411
}
@@ -428,6 +430,8 @@ TfLiteRunStability TfLiteTensorGetBufferAddressStability(
428430
return kTfLiteRunStabilityUnknown;
429431
case kTfLiteVariantObject:
430432
return kTfLiteRunStabilityAcrossRuns;
433+
case kTfLiteNonCpu:
434+
return kTfLiteRunStabilityUnknown;
431435
}
432436
return kTfLiteRunStabilityUnknown;
433437
}
@@ -451,6 +455,8 @@ TfLiteRunStability TfLiteTensorGetDataStability(const TfLiteTensor* const t) {
451455
return kTfLiteRunStabilityUnknown;
452456
case kTfLiteVariantObject:
453457
return kTfLiteRunStabilitySingleRun;
458+
case kTfLiteNonCpu:
459+
return kTfLiteRunStabilityUnknown;
454460
}
455461
return kTfLiteRunStabilityUnknown;
456462
}
@@ -477,11 +483,13 @@ TfLiteRunStep TfLiteTensorGetDataKnownStep(const TfLiteTensor* t) {
477483
return kTfLiteRunStepUnknown;
478484
case kTfLiteVariantObject:
479485
return kTfLiteRunStepEval;
486+
case kTfLiteNonCpu:
487+
return kTfLiteRunStepUnknown;
480488
}
481489
return kTfLiteRunStepUnknown;
482490
}
483491

484-
// Returns the operation steop when the shape of a tensor is computed.
492+
// Returns the operation step when the shape of a tensor is computed.
485493
//
486494
// Some operations can precompute the shape of their results before the
487495
// evaluation step. This makes the shape available earlier for subsequent
@@ -504,6 +512,8 @@ TfLiteRunStep TfLiteTensorGetShapeKnownStep(const TfLiteTensor* t) {
504512
return kTfLiteRunStepUnknown;
505513
case kTfLiteVariantObject:
506514
return kTfLiteRunStepEval;
515+
case kTfLiteNonCpu:
516+
return kTfLiteRunStepUnknown;
507517
}
508518
return kTfLiteRunStepUnknown;
509519
}

tensorflow/lite/core/c/common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,9 @@ typedef union TfLitePtrUnion {
396396
/// * `kTfLiteVariantObject`: Allocation is an arbitrary type-erased C++
397397
/// object.
398398
/// Allocation and deallocation are done through `new` and `delete`.
399+
/// * `kTfLiteNonCpu`: Tensor buffer is in non-CPU memory, such as AHWB, GPU
400+
/// memory. This tensor is not accessed by the CPU.
401+
/// This is only used by LiteRt API.
399402
typedef enum TfLiteAllocationType {
400403
kTfLiteMemNone = 0,
401404
kTfLiteMmapRo,
@@ -405,6 +408,7 @@ typedef enum TfLiteAllocationType {
405408
kTfLitePersistentRo,
406409
kTfLiteCustom,
407410
kTfLiteVariantObject,
411+
kTfLiteNonCpu,
408412
} TfLiteAllocationType;
409413

410414
/// Memory allocation strategies.

0 commit comments

Comments
 (0)