-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C API] Continue implementation #409
Conversation
Codecov Report
@@ Coverage Diff @@
## master #409 +/- ##
==========================================
+ Coverage 89.55% 89.86% +0.31%
==========================================
Files 87 87
Lines 5024 5080 +56
==========================================
+ Hits 4499 4565 +66
+ Misses 525 515 -10
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall!
source/neuropod/bindings/c/c_api.h
Outdated
@@ -29,19 +29,44 @@ extern "C" { | |||
|
|||
typedef struct NP_Neuropod NP_Neuropod; | |||
|
|||
// Load a model given a path | |||
// Load a model given a path. | |||
// status is set if user provided a valid pointer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it's a good idea for status to be optional here (and in the other methods). Doing so might make this interface somewhat error prone.
It's obviously easier to pass in nullptr
than to use and check am NP_Status
, but I think we should force usage.
When I was working with the TF C API, it was somewhat inconvenient to have to deal with statuses everywhere, but it forced me to do error checking and I think that led to more robust user code (and a better debugging experience).
Any thoughts @selitvin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought abut some extra efficiency for Infer. "error handler" instead of status may be more efficient (it would never call it on success), but let's make it required for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more thing :)
Let's make sure we test with a C compiler. |
This is a very good point. Tensorflow also uses C11 to implement smoke test for its C API. Just published update for PR, see test_c_api.c. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Two minor comments and we should be good to go :)
Continue with basic implementation of a C API for Neuropod. Issue uber#407 Added a test that loads a model and fails, runs inference successfully and fails, and verifies the name and platform.
66a1aad
to
5fdc025
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Summary:
Continue with basic implementation of a C API for Neuropod. Issue #407
Test Plan:
Added a test that loads a model and fails, runs inference successfully and fails, and verifies the name and platform.