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

tensorflow: fix python3 ctypes.c_char_p problem #12

Merged
merged 2 commits into from
Jun 28, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions byteps/tensorflow/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ def _push_pull(tensor, scope='', name=None):
"""
if name is None and not _executing_eagerly():
name = 'BytePSPushPull_%s' % _normalize_name(tensor.name)
TF_LIB_CTYPES.byteps_tensorflow_declare_tensor(ctypes.c_char_p(scope+name))
full_name = scope + name
full_name = full_name.encode("ascii")
TF_LIB_CTYPES.byteps_tensorflow_declare_tensor(ctypes.c_char_p(full_name))
return C_LIB.byteps_push_pull(tensor, name=name)


Expand Down Expand Up @@ -108,7 +110,7 @@ def broadcast(tensor, root_rank, name=None, is_variable=True):
# Broadcast is implemented as push + pull after zero-ing non-root tensors
if name is None and not _executing_eagerly():
name = 'BytePSBroadcast_%s' % _normalize_name(tensor.name)
TF_LIB_CTYPES.byteps_tensorflow_declare_tensor(ctypes.c_char_p(name))
TF_LIB_CTYPES.byteps_tensorflow_declare_tensor(ctypes.c_char_p(name.encode("ascii")))
if is_variable and (root_rank != rank()):
return C_LIB.byteps_push_pull(tensor.assign(tf.zeros_like(tensor)), name=name)
else:
Expand Down