-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Improved documentation and tests about input and output functions #17
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
Conversation
README.rst
Outdated
@@ -1377,7 +1377,7 @@ An example of ``output_fn`` for the accept type "application/python-pickle" can | |||
|
|||
import numpy as np | |||
|
|||
def output_fn(data, accepts): | |||
def output_fn(prediction_result, accepts): | |||
"""An output_fn that dumps a pickled numpy as response""" | |||
if request_content_type == "application/python-pickle": | |||
return np.dumps(data) |
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.
should data
be changed to prediction_result
here?
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 did that for consistency, look at the code block below here
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 meant for line 1383 - sorry for the confusion
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.
ok
README.rst
Outdated
@@ -1377,7 +1377,7 @@ An example of ``output_fn`` for the accept type "application/python-pickle" can | |||
|
|||
import numpy as np | |||
|
|||
def output_fn(data, accepts): | |||
def output_fn(prediction_result, accepts): | |||
"""An output_fn that dumps a pickled numpy as response""" |
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.
change 'numpy' to 'object' for consistency with the above change?
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.
sure
README.rst
Outdated
@@ -1386,6 +1386,9 @@ An example of ``output_fn`` for the accept type "application/python-pickle" can | |||
# if the content type is not supported. | |||
pass | |||
|
|||
A example with the ``input_fn`` and ``output_fn`` above can be find in |
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.
two small changes:
- remove 'the'
- s/find in/found
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.
ok
|
||
|
||
def input_fn(mode, batch_size, data_dir): | ||
def _input_fn(mode, batch_size): |
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 think it'd be better if this method's name were a little more distinct from input_fn
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.
good point.
|
||
def input_fn(serialized_data, content_type): | ||
data = pickle.loads(serialized_data) | ||
return data |
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.
you could make this a one-line method: return pickle.loads(serialized_data)
tests/integ/test_tf_cifar.py
Outdated
@@ -19,12 +22,34 @@ | |||
from tests.integ import DATA_DIR, REGION | |||
from tests.integ.timeout import timeout_and_delete_endpoint, timeout | |||
|
|||
PICKLE_CONTENT_TYPE = "application/python-pickle" |
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.
use single quotes instead of double quotes for consistency with the rest of the SDK
also, don't forget imperative mood with the overall commit message :) |
Add LDA Topic Modeling directory and example notebook Merging in preparation for our meeting tomorrow.
No description provided.