Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Packages/com.github.asus4.mediapipe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
"license": "Apache License 2.0",
"unity": "2022.3",
"unityRelease": "0f1",
"version": "2.17.0",
"version": "2.19.0",
"hideInEditor": false,
"dependencies": {
"com.github.asus4.tflite": "2.17.0",
"com.github.asus4.tflite.common": "2.17.0"
"com.github.asus4.tflite": "2.19.0",
"com.github.asus4.tflite.common": "2.19.0"
},
"documentationUrl": "https://github.com/asus4/tf-lite-unity-sample",
"changelogUrl": "https://github.com/asus4/tf-lite-unity-sample/releases",
Expand Down
4 changes: 2 additions & 2 deletions Packages/com.github.asus4.tflite.common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"license": "Apache License 2.0",
"unity": "2022.3",
"unityRelease": "0f1",
"version": "2.17.0",
"version": "2.19.0",
"hideInEditor": false,
"dependencies": {
"com.unity.burst": "1.8.12",
"com.github.asus4.tflite": "2.17.0"
"com.github.asus4.tflite": "2.19.0"
},
"repository": {
"type": "git",
Expand Down
Git LFS file not shown

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Git LFS file not shown
4 changes: 2 additions & 2 deletions Packages/com.github.asus4.tflite/Plugins/Android/tensorflow-lite-gpu.aar
100644 → 100755
Git LFS file not shown
4 changes: 2 additions & 2 deletions Packages/com.github.asus4.tflite/Plugins/Android/tensorflow-lite.aar
100644 → 100755
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
#import <TensorFlowLiteC/operator.h>
#import <TensorFlowLiteC/profiler.h>
#import <TensorFlowLiteC/telemetry_setting.h>
#import <TensorFlowLiteC/tflite_types.h>
#import <TensorFlowLiteC/types.h>
#import <TensorFlowLiteC/xnnpack_delegate.h>
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ typedef enum {
kTfLiteBuiltinStablehloRngBitGenerator = 204,
kTfLiteBuiltinReduceWindow = 205,
kTfLiteBuiltinStablehloComposite = 206,
kTfLiteBuiltinStablehloShiftLeft = 207,
kTfLiteBuiltinStablehloCbrt = 208,
kTfLiteBuiltinStablehloCase = 209,
} TfLiteBuiltinOperator;

#ifdef __cplusplus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ TFL_CAPI_EXPORT extern void TfLiteSetAllowBufferHandleOutput(
/// SignatureRunner APIs

/// Attempts to cancel in flight invocation if any.
/// This will not affect calls to `Invoke` that happend after this.
/// This will not affect calls to `Invoke` that happen after this.
/// Non blocking and thread safe.
/// Returns kTfLiteError if cancellation is not enabled, otherwise returns
/// kTfLiteOk.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,14 @@ typedef struct TfLiteIntArray TfLiteIntArray;
TFL_CAPI_EXPORT extern TfLiteStatus TfLiteOpaqueContextGetExecutionPlan(
TfLiteOpaqueContext* opaque_context, TfLiteIntArray** execution_plan);

/// Returns the external context of the specified type associated with the
/// provided `opaque_context`. Returns `kTfLiteOk` if the external context was
/// successfully loaded. A return value different from `kTfLiteOk` indicates a
/// failure and the `external_context` will be left in an unspecified state.
TFL_CAPI_EXPORT extern TfLiteStatus TfLiteOpaqueContextGetExternalContext(
TfLiteOpaqueContext* opaque_context, void** external_context,
TfLiteExternalContextType type);

/// Given the specified 'opaque_context' and 'node_index', load the caller's
/// opaque '*node' and '*registration_external' pointer. Return 'kTfLiteOk' if
/// both the '*node' as well as the '*registration_external' have been loaded
Expand Down Expand Up @@ -639,6 +647,17 @@ TFL_CAPI_EXPORT
TfLiteStatus TfLiteOpaqueContextGetSizeOfType(TfLiteOpaqueContext* context,
TfLiteType type, size_t* bytes);

/// Retrieves named metadata buffer from the TFLite model.
/// Returns kTfLiteOk if metadata is successfully obtained from the flatbuffer
/// model. That is, there exists a `metadata` entry with given `name` string.
/// (see TFLite's schema.fbs).
/// The corresponding `buffer` information is populated in `ptr` & `bytes`.
/// The data from `ptr` is valid for the lifetime of the Interpreter.
TFL_CAPI_EXPORT
TfLiteStatus TfLiteOpaqueContextGetMetadata(TfLiteOpaqueContext* context,
const char* name, const char** ptr,
size_t* bytes);

/// Reports an error message formed by using the provided 'format' string in
/// combination with the data provided via the unnamed arguments following
/// the 'format' parameter ('...'). The intended usage and behavior is the same
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ limitations under the License.
#ifndef TENSORFLOW_LITE_CORE_C_C_API_TYPES_H_
#define TENSORFLOW_LITE_CORE_C_C_API_TYPES_H_

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

#include "tflite_types.h" // IWYU pragma: export

// clang-format off
// NOLINTBEGIN(whitespace/line_length)
/** \defgroup c_api_types lite/c/c_api_types.h
Expand All @@ -56,12 +56,12 @@ extern "C" {
#define TFL_CAPI_EXPORT
#elif defined(TFL_STATIC_LIBRARY_BUILD)
#define TFL_CAPI_EXPORT
#else // not definded TFL_STATIC_LIBRARY_BUILD
#else // not defined TFL_STATIC_LIBRARY_BUILD
#if defined(_WIN32)
#ifdef TFL_COMPILE_LIBRARY
#define TFL_CAPI_EXPORT __declspec(dllexport)
#else
#define TFL_CAPI_EXPORT __declspec(dllimport)
#define TFL_CAPI_EXPORT
#endif // TFL_COMPILE_LIBRARY
#else
#define TFL_CAPI_EXPORT __attribute__((visibility("default")))
Expand Down Expand Up @@ -110,41 +110,14 @@ typedef enum TfLiteStatus {
// TODO(b/250636993): Cancellation triggered by `SetCancellationFunction`
// should also return this status code.
kTfLiteCancelled = 8,
} TfLiteStatus;

/// Types supported by tensor
typedef enum {
kTfLiteNoType = 0,
kTfLiteFloat32 = 1,
kTfLiteInt32 = 2,
kTfLiteUInt8 = 3,
kTfLiteInt64 = 4,
kTfLiteString = 5,
kTfLiteBool = 6,
kTfLiteInt16 = 7,
kTfLiteComplex64 = 8,
kTfLiteInt8 = 9,
kTfLiteFloat16 = 10,
kTfLiteFloat64 = 11,
kTfLiteComplex128 = 12,
kTfLiteUInt64 = 13,
kTfLiteResource = 14,
kTfLiteVariant = 15,
kTfLiteUInt32 = 16,
kTfLiteUInt16 = 17,
kTfLiteInt4 = 18,
kTfLiteBFloat16 = 19,
} TfLiteType;

/// Legacy. Will be deprecated in favor of `TfLiteAffineQuantization`.
/// If per-layer quantization is specified this field will still be populated in
/// addition to `TfLiteAffineQuantization`.
/// Parameters for asymmetric quantization. Quantized values can be converted
/// back to float using: `real_value = scale * (quantized_value - zero_point)`
typedef struct TfLiteQuantizationParams {
float scale;
int32_t zero_point;
} TfLiteQuantizationParams;
// This status is returned by Prepare when the output shape cannot be
// determined but the size of the output tensor is known. For example, the
// output of reshape is always the same size as the input. This means that
// such ops may be
// done in place.
kTfLiteOutputShapeNotKnown = 9,
} TfLiteStatus;

// --------------------------------------------------------------------------
// Opaque types used by c_api.h, c_api_opaque.h and common.h.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ typedef enum TfLiteExternalContextType {
kTfLiteGemmLowpContext = 1, /// include gemm_support.h to use.
kTfLiteEdgeTpuContext = 2, /// Placeholder for Edge TPU support.
kTfLiteCpuBackendContext = 3, /// include cpu_backend_context.h to use.
kTfLiteMaxExternalContexts = 4
kTfLiteLiteRtBufferContext =
4, /// include external_litert_buffer_context.h to use.
kTfLiteMaxExternalContexts = 5
} TfLiteExternalContextType;

// Forward declare so dependent structs and methods can reference these types
Expand All @@ -100,7 +102,9 @@ typedef struct TfLiteExternalContext {
TfLiteStatus (*Refresh)(struct TfLiteContext* context);
} TfLiteExternalContext;

// LINT.IfChange(optional_tensor)
#define kTfLiteOptionalTensor (-1)
// LINT.ThenChange(//tensorflow/compiler/mlir/lite/flatbuffer_export.cc:optional_tensor)

/// Fixed size list of integers. Used for dimensions and inputs/outputs tensor
/// indices
Expand Down Expand Up @@ -281,6 +285,17 @@ void TfLiteFloatArrayFree(TfLiteFloatArray* a);
} \
} while (0)

// `std::unreachable` not available until CC23.
#ifdef __GNUC__ // GCC, Clang, ICC

#define TFL_UNREACHABLE() (__builtin_unreachable())

#elif defined(_MSC_VER) // MSVC

#define TFL_UNREACHABLE() (__assume(false))

#endif

/// Single-precision complex data type compatible with the C99 definition.
typedef struct TfLiteComplex64 {
float re, im; /// real and imaginary parts, respectively.
Expand All @@ -307,7 +322,7 @@ typedef struct TfLiteBFloat16 {
const char* TfLiteTypeGetName(TfLiteType type);

/// SupportedQuantizationTypes.
typedef enum TfLiteQuantizationType {
typedef enum TfLiteQuantizationType : int {
/// No quantization.
kTfLiteNoQuantization = 0,
/// Affine quantization (with support for per-channel quantization).
Expand Down Expand Up @@ -350,6 +365,7 @@ typedef union TfLitePtrUnion {
uint64_t* u64;
float* f;
TfLiteFloat16* f16;
TfLiteBFloat16* bf16;
double* f64;
char* raw;
const char* raw_const;
Expand Down Expand Up @@ -429,12 +445,6 @@ enum {
kTfLiteNullBufferHandle = -1,
};

/// Storage format of each dimension in a sparse tensor.
typedef enum TfLiteDimensionType {
kTfLiteDimDense = 0,
kTfLiteDimSparseCSR,
} TfLiteDimensionType;

/// Metadata to encode each dimension in a sparse tensor.
typedef struct TfLiteDimensionMetadata {
TfLiteDimensionType format;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,42 +44,6 @@ extern "C" {
/// \warning This is an experimental type and subject to change.
typedef struct TfLiteOperator TfLiteOperator;

/// Returns a new TfLiteOperator instance.
///
/// The returned TfLiteOperator instance represents a definition
/// of an operator with the identity (builtin_code/custom_name and
/// version) specified by the parameters, but with all callbacks initially
/// unset.
///
/// Evaluation of any operation using this operator will be done using
/// the "prepare" and "invoke" callbacks, which can be set using
/// `TfLiteOperatorSetPrepare` and
/// `TfLiteOperatorSetInvoke`, or for async execution
/// the "prepare", "eval", and "wait" callbacks of the `TfLiteAsyncKernel`,
/// which can be set using `TfLiteOperatorSetAsyncKernel`.
/// If the relevant callbacks are not set, then such evaluation will result
/// in an error status. So normally any use of this function should be followed
/// by appropriate calls to set those callbacks.
///
/// \note The caller retains ownership and should ensure that
/// the lifetime of the `TfLiteOperator` must be at least as long as
/// the lifetime of any `TfLiteInterpreter` or `tflite::Interpreter` that it is
/// used in.
///
/// \param builtin_code Enumeration code specifying which builtin operator this
/// defines, or `TfLiteBuiltinCustom` to define a custom op.
/// \param custom_name Name of the custom op, or `nullptr` for a builtin op.
/// If `custom_name` is non-null, then `builtin_code` should
/// be `TfLiteBuiltinCustom`.
/// \param version Version of the op. See
/// https://www.tensorflow.org/lite/guide/ops_version
///
/// \return \a newly created TfLiteOperator on success, \a nullptr on failure
///
/// Deprecated: Use `TfLiteOperatorCreateWithData`
TFL_CAPI_EXPORT extern TfLiteOperator* TfLiteOperatorCreate(
TfLiteBuiltinOperator builtin_code, const char* custom_name, int version);

/// Returns a new TfLiteOperator instance.
///
/// The returned TfLiteOperator instance represents a definition
Expand Down Expand Up @@ -113,12 +77,12 @@ TFL_CAPI_EXPORT extern TfLiteOperator* TfLiteOperatorCreate(
/// with functions such as `TfLiteOperatorSetXXXWithData`.
/// The user is expected to manage the memory pointed by
/// this field and the lifetime of that memory should extend
/// at least from the call to `TfLiteOperatorCreateWithData`
/// at least from the call to `TfLiteOperatorCreate`
/// to the invocation of the callback set with
/// `TfLiteOperatorSetFreeWithData`.
///
/// \return a newly created TfLiteOperator on success, or a nullptr on failure
TFL_CAPI_EXPORT extern TfLiteOperator* TfLiteOperatorCreateWithData(
TFL_CAPI_EXPORT extern TfLiteOperator* TfLiteOperatorCreate(
TfLiteBuiltinOperator builtin_code, const char* custom_name, int version,
void* user_data);

Expand Down Expand Up @@ -165,7 +129,7 @@ TFL_CAPI_EXPORT extern void TfLiteOperatorSetInit(
///
/// The callback is called to initialize the op from serialized data. The value
/// passed in the `user_data` parameter is the value that was passed to
/// `TfLiteOperatorCreateWithData`. Please refer `init` of `TfLiteRegistration`
/// `TfLiteOperatorCreate`. Please refer `init` of `TfLiteRegistration`
/// for the detail.
///
TFL_CAPI_EXPORT extern TfLiteStatus TfLiteOperatorSetInitWithData(
Expand All @@ -191,7 +155,7 @@ TFL_CAPI_EXPORT extern void TfLiteOperatorSetFree(
/// This callback is called to deallocate the data returned by the init
/// callback. The value passed in the `data` parameter is the value that was
/// returned by the `init` callback. The value passed in the `user_data`
/// parameter is the value that was passed to `TfLiteOperatorCreateWithData`.
/// parameter is the value that was passed to `TfLiteOperatorCreate`.
/// Please refer `free` of `TfLiteRegistration` for the detail.
///
TFL_CAPI_EXPORT extern TfLiteStatus TfLiteOperatorSetFreeWithData(
Expand All @@ -214,7 +178,7 @@ TFL_CAPI_EXPORT extern void TfLiteOperatorSetPrepare(
///
/// The callback is called when the inputs of operator have been resized. The
/// value passed in the `user_data` parameter is the value that was passed to
/// `TfLiteOperatorCreateWithData`. Please refer `prepare` of
/// `TfLiteOperatorCreate`. Please refer `prepare` of
/// `TfLiteRegistration` for the detail.
///
TFL_CAPI_EXPORT extern TfLiteStatus TfLiteOperatorSetPrepareWithData(
Expand Down
Loading