Adds the TFLite version string to the ObjC library.
PiperOrigin-RevId: 248632089
This commit is contained in:
parent
fb20a668e8
commit
3df6d99f3f
@ -12,7 +12,19 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "TFLInterpreter.h"
|
#import "TFLInterpreter.h"
|
||||||
#import "TFLInterpreterOptions.h"
|
#import "TFLInterpreterOptions.h"
|
||||||
#import "TFLQuantizationParameters.h"
|
#import "TFLQuantizationParameters.h"
|
||||||
#import "TFLTensor.h"
|
#import "TFLTensor.h"
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A string describing the semantic versioning information for the TensorFlow Lite runtime. Is an
|
||||||
|
* empty string if the version could not be determined.
|
||||||
|
*/
|
||||||
|
FOUNDATION_EXPORT NSString *const TFLVersion;
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
|
@ -24,6 +24,9 @@
|
|||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
FOUNDATION_EXPORT NSString *const TFLVersion =
|
||||||
|
TFL_Version() == NULL ? @"" : [NSString stringWithUTF8String:TFL_Version()];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error reporter for TFLInterpreter.
|
* Error reporter for TFLInterpreter.
|
||||||
*
|
*
|
||||||
|
@ -12,16 +12,18 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#import "tensorflow/lite/experimental/objc/apis/TFLInterpreter.h"
|
#import "tensorflow/lite/experimental/objc/apis/TFLTensorFlowLite.h"
|
||||||
|
|
||||||
#import <XCTest/XCTest.h>
|
#import <XCTest/XCTest.h>
|
||||||
|
|
||||||
#import "tensorflow/lite/experimental/objc/apis/TFLInterpreterOptions.h"
|
|
||||||
#import "tensorflow/lite/experimental/objc/apis/TFLQuantizationParameters.h"
|
|
||||||
#import "tensorflow/lite/experimental/objc/apis/TFLTensor.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Regular expression for TensorFlow Lite runtime version string, e.g. "1.14.0", "0.1.2-alpha.1",
|
||||||
|
* "0.3.4-beta2", "1.14.0-rc.3".
|
||||||
|
*/
|
||||||
|
static NSString *const kTFLVersionRegex = @"^\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.-]+)?$";
|
||||||
|
|
||||||
/** Float model resource name. */
|
/** Float model resource name. */
|
||||||
static NSString *const kAddFloatModelResourceName = @"add";
|
static NSString *const kAddFloatModelResourceName = @"add";
|
||||||
|
|
||||||
@ -91,6 +93,11 @@ static const float kTestAccuracy = 1E-5F;
|
|||||||
|
|
||||||
#pragma mark - Tests
|
#pragma mark - Tests
|
||||||
|
|
||||||
|
- (void)testTFLVersion {
|
||||||
|
NSRange range = [TFLVersion rangeOfString:kTFLVersionRegex options:NSRegularExpressionSearch];
|
||||||
|
XCTAssertNotEqual(range.location, NSNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
- (void)testSuccessfulFullRunAddFloatModel {
|
- (void)testSuccessfulFullRunAddFloatModel {
|
||||||
// Shape for both input and output tensor.
|
// Shape for both input and output tensor.
|
||||||
NSMutableArray *shape = [NSMutableArray arrayWithCapacity:kAddModelTensorRank];
|
NSMutableArray *shape = [NSMutableArray arrayWithCapacity:kAddModelTensorRank];
|
||||||
|
Loading…
Reference in New Issue
Block a user