Lack of tensorflow cifar10

I downloaded the CIFAR10 code from the link in the tutorial here , and I'm trying to run the tutorial. I run it with the command

python cifar10_train.py

It starts fine and loads the data file as expected. When it tries to open the input file, it fails with the following trace:

Traceback (most recent call last):
  File "cifar10_train.py", line 120, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 43, in run
    sys.exit(main(sys.argv[:1] + flags_passthrough))
  File "cifar10_train.py", line 116, in main
    train()
  File "cifar10_train.py", line 63, in train
    images, labels = cifar10.distorted_inputs()
  File "/notebooks/Python Scripts/tensorflowModels/tutorials/image/cifar10/cifar10.py", line 157, in distorted_inputs
    batch_size=FLAGS.batch_size)
  File "/notebooks/Python Scripts/tensorflowModels/tutorials/image/cifar10/cifar10_input.py", line 161, in distorted_inputs
    read_input = read_cifar10(filename_queue)
  File "/notebooks/Python Scripts/tensorflowModels/tutorials/image/cifar10/cifar10_input.py", line 87, in read_cifar10
    tf.strided_slice(record_bytes, [0], [label_bytes]), tf.int32)
TypeError: strided_slice() takes at least 4 arguments (3 given)

Of course, when I examine the code, there is a call in cifar10_input.py for strided_slice () with only three arguments:

tf.strided_slice(record_bytes, [0], [label_bytes])

While the tensorflow documentation does indicate that there must be at least 4 arguments.

What is going wrong? I downloaded the last tensorflow (0.12) and I am running the main branch of cifar code.

+4
source share
1 answer

github , , , :

cifar10_input.py

-  result.label = tf.cast(tf.strided_slice(record_bytes, [0], [label_bytes]), tf.int32)
+  result.label = tf.cast(tf.slice(record_bytes, [0], [label_bytes]), tf.int32)



-  depth_major = tf.reshape( tf.strided_slice(record_bytes, [label_bytes], [label_bytes + image_bytes]),      [result.depth, result.height, result.width])
+  depth_major = tf.reshape(tf.slice(record_bytes, [label_bytes], [image_bytes]), [result.depth, result.height, result.width])

cifar10_input.py cifar10.py "" , , , , api (, ). :

-  tf.contrib.deprecated.image_summary('images', images)
+  tf.summary.image('images', images)

 - tf.contrib.deprecated.histogram_summary(tensor_name + '/activations', x)
 - tf.contrib.deprecated.scalar_summary(tensor_name + '/sparsity',
 + tf.summary.histogram(tensor_name + '/activations', x)
 + tf.summary.scalar(tensor_name + '/sparsity',

, . , , , , .

-, .

+2

Source: https://habr.com/ru/post/1665110/


All Articles