Skip to content
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

error with NN part #3

Open
un-lock-me opened this issue Apr 27, 2017 · 1 comment
Open

error with NN part #3

un-lock-me opened this issue Apr 27, 2017 · 1 comment

Comments

@un-lock-me
Copy link

hey omid,
why when I am running your simple NN code it raises error:
return bytes_or_text.decode(encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 85: invalid start byte

It has problem with last part I mean optimization,
persian girl

@LISHITING
Copy link

Actually, it is the problem with version of python. When you use python 3.x you should make some change.
I just change all the w and r into wb and rb in tf.gfile.Open and tf.gfile.FastGFile and it works.
complete code looks like:

from tensorflow.python.tools import optimize_for_inference_lib

input_graph_def = tf.GraphDef()
with tf.gfile.Open(output_frozen_graph_name, "rb") as f:
    data = f.read()
    input_graph_def.ParseFromString(data)

output_graph_def = optimize_for_inference_lib.optimize_for_inference(
        input_graph_def,
        ["I"], # an array of the input node(s)
        ["O"], # an array of output nodes
        tf.float32.as_datatype_enum)

# Save the optimized graph

f = tf.gfile.FastGFile(output_optimized_graph_name, "wb")
f.write(output_graph_def.SerializeToString())

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

No branches or pull requests

2 participants