chore: import upstream snapshot with attribution
cffconvert / validate (push) Has been skipped
License Check / license-check (push) Failing after 2s

This commit is contained in:
wehub-resource-sync
2026-07-13 12:14:16 +08:00
commit 8a852e4b4e
36502 changed files with 9277225 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
load("//tensorflow/lite:special_rules.bzl", "tflite_portable_test_suite")
load("//tensorflow/lite/core/shims:cc_library_with_tflite.bzl", "cc_library_with_tflite_with_c_headers_test")
package(
# copybara:uncomment default_applicable_licenses = ["//tensorflow:LICENSE"],
licenses = ["notice"],
)
#------------------------------------------------------------------------------
# Utilities for use in JNI Bindings (e.g. Java API and Java Tasks library).
cc_library_with_tflite_with_c_headers_test(
name = "jni_utils",
srcs = ["jni_utils.cc"],
hdrs = ["jni_utils.h"],
visibility = ["//visibility:public"],
deps = [
"//tensorflow/lite/java/jni",
],
)
tflite_portable_test_suite()
+20
View File
@@ -0,0 +1,20 @@
/* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/c/jni/jni_utils.h"
bool TfLiteCheckInitializedOrThrow(JNIEnv* env) {
// No additional initialization is required.
return true;
}
+39
View File
@@ -0,0 +1,39 @@
/* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_JNI_JNI_UTILS_H_
#define TENSORFLOW_LITE_JNI_JNI_UTILS_H_
#include <jni.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
/// Checks whether the TFLite API has been initialized, throwing a Java exception
/// otherwise.
///
/// @param env The JNIEnv for the current thread (which has to be attached to the
/// JVM).
/// @return Whether or not the TFLite API has been initialized. If this method
/// returns false, no other JNI method should be called until the pending
/// exception has been handled (typically by returning to Java).
bool TfLiteCheckInitializedOrThrow(JNIEnv* env);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // TENSORFLOW_LITE_JNI_JNI_UTILS_H_