tflite_native 0.3.0

  • Readme
  • Changelog
  • Installing
  • 43

Build Status

A Dart interface to TensorFlow Lite (tflite) through Dart's foreign function interface (FFI). This library wraps the experimental tflite C API.

This package supports desktop use cases (Linux, OSX, Windows, etc) and Flutter developers should consider flutter_tflite. For example, this package locates a tflite dynamic library through Isolate.resolvePackageUri which doesn't translate perfectly in the Flutter context (see https://github.com/flutter/flutter/issues/14815).

0.3.0 #

  • Update to new tflite C API

0.2.3 #

  • Specify >=2.5.0 in pubspec.yaml

0.2.2 #

  • Use Pointer.asExternalTypedData for reading output tensor

0.2.1 #

0.2.0 #

  • Load shared object as sibling when running from snapshot

0.1.0 #

  • Apply fixes from dartfmt
  • Update package description

0.0.3 #

  • Bundle binaries for 64-bit linux, mac, and windows systems
  • Bindings for 24 / 29 functions exposed by libtensorflow_c.so

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  tflite_native: ^0.3.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:tflite_native/tflite.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
58
Health:
Code health derived from static analysis. [more]
1
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
43
Learn more about scoring.

We analyzed this package on Nov 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.12.21

Platforms

Detected platforms:

Low code quality prevents platform classification.

Health issues and suggestions

Fix lib/src/tensor.dart. (-89.99 points)

Analysis of lib/src/tensor.dart failed with 8 errors, including:

line 39 col 14: The method 'asExternalTypedData' isn't defined for the class 'Pointer'.

line 49 col 58: The method 'store' isn't defined for the class 'Pointer'.

line 55 col 32: The class 'Pointer' doesn't have a constructor named 'allocate'.

line 56 col 57: The method 'store' isn't defined for the class 'Pointer'.

line 59 col 9: The method 'free' isn't defined for the class 'Pointer'.

Fix lib/src/bindings/utf8.dart. (-76.27 points)

Analysis of lib/src/bindings/utf8.dart failed with 5 errors:

line 9 col 20: The type 'Struct' is declared with 0 type parameters, but 1 type arguments were given.

line 15 col 31: The class 'Pointer' doesn't have a constructor named 'allocate'.

line 19 col 48: The method 'load' isn't defined for the class 'Pointer'.

line 20 col 33: The method 'load' isn't defined for the class 'Pointer'.

line 29 col 41: The method 'load' isn't defined for the class 'Pointer'.

Fix lib/src/bindings/types.dart. (-68.36 points)

Analysis of lib/src/bindings/types.dart failed with 4 errors:

line 8 col 33: The type 'Struct' is declared with 0 type parameters, but 1 type arguments were given.

line 11 col 40: The type 'Struct' is declared with 0 type parameters, but 1 type arguments were given.

line 14 col 27: The type 'Struct' is declared with 0 type parameters, but 1 type arguments were given.

line 17 col 28: The type 'Struct' is declared with 0 type parameters, but 1 type arguments were given.

Fix additional 6 files with analysis or formatting issues. (-25 points)

Additional issues in the following files:

  • lib/src/model.dart (1 error)
  • lib/src/bindings/interpreter.dart (Run dartfmt to format lib/src/bindings/interpreter.dart.)
  • lib/src/bindings/interpreter_options.dart (Run dartfmt to format lib/src/bindings/interpreter_options.dart.)
  • lib/src/bindings/model.dart (Run dartfmt to format lib/src/bindings/model.dart.)
  • lib/src/bindings/tensor.dart (Run dartfmt to format lib/src/bindings/tensor.dart.)
  • lib/src/interpreter.dart (Run dartfmt to format lib/src/interpreter.dart.)

Maintenance issues and suggestions

Fix platform conflicts. (-20 points)

Low code quality prevents platform classification.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and tflite_native.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.5.0 <3.0.0
path ^1.6.2 1.6.4
quiver ^2.0.3 2.1.2+1
Transitive dependencies
matcher 0.12.6
meta 1.1.8
stack_trace 1.9.3
Dev dependencies
test ^1.6.4