Skip to content

"DeprecationWarning: The binary mode of fromstring is deprecated" warning appears in some cases #17020

@reedwm

Description

@reedwm

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 16.04
  • TensorFlow installed from (source or binary): Binary, tf-nightly
  • TensorFlow version (use command below): 1.7.0.dev20180214, git version b2a0f1c
  • Python version: 2.7.12
  • Bazel version (if compiling from source): N/A
  • GCC/Compiler version (if compiling from source): N/A
  • CUDA/cuDNN version: N/A
  • GPU model and memory: N/A
  • Exact command to reproduce:
import tensorflow as tf
from tensorflow.contrib.image.ops import gen_distort_image_ops
from tensorflow.python.framework import tensor_util
tensor_util.constant_value(tf.convert_to_tensor([1., 1.]))

Describe the problem

When I run the program above, I get the warning

/home/reedwm/venvs/tfnightlycpu/local/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py:560: DeprecationWarning: The binary mode of fromstring is deprecated, as it behaves surprisingly on unicode inputs. Use frombuffer instead
  return np.fromstring(tensor.tensor_content, dtype=dtype).reshape(shape)

This may not seem so bad, but when running tf_cnn_benchmarks, I get hundreds of such warnings.

What's very strange is that if I comment the line from tensorflow.contrib.image.ops import gen_distort_image_ops, I don't get the warning.

This is the same issue as tensorpack/tensorpack#641. @yaroslavvb, did you file a TensorFlow bug for this? If so, this can be marked as a duplicate.

Not really sure who to triage this to. /CC @mrry, can you address this or retriage?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions