Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

remove the use of waitFor #42

Open
devoncarew opened this issue Nov 21, 2019 · 6 comments
Open

remove the use of waitFor #42

devoncarew opened this issue Nov 21, 2019 · 6 comments

Comments

@devoncarew
Copy link
Contributor

We should look into removing the use of dart:cli's waitFor() method.

@truongsinh
Copy link
Contributor

truongsinh commented Nov 22, 2019

Any proposed way how should we do it? I think we either need to find a way to synchronously resolve pakage uri (as seen in https://github.com/dart-lang/tflite_native/blob/master/lib/src/bindings/dlib.dart#L50 ) , or turn every API of this package into async

@devoncarew
Copy link
Contributor Author

I would keep all the API sync, except for a new init method. Users of the API would then need to call init(), await the response, and then use the resulting api object as normal.

This would likely change the API structure a bit. Instead of everything being a top level method, clients would instead invoke method on something like an MLBindings object. At a very rough sketch, something like this:

Future<MLBindings> init() {
   ...
}

class MLBindings {
  final DynamicLibrary _dynamicLibrary;
  
  MLBindings._(this._dynamicLibrary);

  String get version {
    Pointer<Utf8> Function() TfLiteVersion = _dynamicLibrary
        .lookup<NativeFunction<_TfLiteVersion_native_t>>('TfLiteVersion')
        .asFunction();
    return Utf8.fromUtf8(TfLiteVersion());
  }
}

That's a fairly darty version of the API. There are likely some refactorings that would mean a lot fewer changes to the current API - the API would be closer to the existing native tensorflow lite API, but be less idiomatic dart.

@devoncarew
Copy link
Contributor Author

cc @bwilkerson @lambdabaa

@truongsinh
Copy link
Contributor

Is there any progress on the proposal for this one?

@truongsinh
Copy link
Contributor

cc @devoncarew @bwilkerson @lambdabaa

@truongsinh
Copy link
Contributor

truongsinh commented Mar 17, 2020

ping @devoncarew @bwilkerson @lambdabaa @mit-mit @eseidelGoogle

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants