Tersorflow Depth Learning Introductory--CIFAR-10 Training Example Error and solution _ machine learning

Source: Internet
Author: User

Tersorflow CIFAR-10 Training Example Error and its solution


1. Attributeerror: ' Module ' object has Noattribute ' Random_crop '

Solution:

Replace the distorted_image= tf.image.random_crop (reshaped_image, [height, width]) with the following:

Distorted_image = Tf.random_crop (Reshaped_image,[height, width,3])

2. Attributeerror: ' has ', ' summarywriter '

Solution:

Tf.train.SummaryWriter replaced by: Tf.summary.FileWriter

3. Attributeerror: ' has ', ' summaries '

Solution:

Tf.merge_all_summaries () Read: Summary_op =tf.summaries.merge_all ()


4. Attributeerror: ' Module ' object hasno attribute ' Histogram_summary '

Tf.histogram_summary (Var.op.name,var) read: Tf.summaries.histogram ()


5. Attributeerror: ' Module ' object hasno attribute ' Scalar_summary '

Tf.scalar_summary (l.op.name+ ' (raw) ', L)

Solution:

Tf.scalar_summary (' images ', images) instead: tf.summary.scalar (' images ', images)

Tf.image_summary (' images ', images) instead: tf.summary.image (' images ', images)

6. Valueerror:only call ' softmax_cross_entropy_with_logits ' withnamed arguments (labels= ..., logits= ...)

Solution:

Cifar10.loss (labels, logits) replaced by: Cifar10.loss (Logits=logits,labels=labels)

Cross_entropy= Tf.nn.softmax_cross_entropy_with_logits (
Logits, dense_labels,name= ' cross_entropy_per_example ')

To

Cross_entropy = Tf.nn.softmax_cross_entropy_with_logits (
Logits=logits, labels=dense_labels,name= ' cross_entropy_per_example ')

7. Typeerror:using a ' tf. Tensor ' as a Python ' bool ' isnot allowed. Use ' if ' isn't ' None: ' instead of ' if T: ' to test if a tensor isdefined, and use TensorFlow ops such as Tf.cond to Execut e subgraphsconditioned on the value of a tensor.

Solution:

If grad: Change to If grad not None:

8. Valueerror:shapes (2, 128, 1) and () are incompatible

Solution:

concated = Tf.concat (1, [Indices, Sparse_labels]) instead:

concated= Tf.concat ([Indices, Sparse_labels], 1)

9. Error:

File "/home/lily/work/tensorflow/cirfar-10/tensorflow.cifar10-master/cifar10_input.py", line and in Read_cifar10

Result.key, Value =reader.read (filename_queue)

File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/io_ops.py", line 326, in read

Queue_ref = Queue.queue_ref

Attributeerror: ' str ' object Hasno attribute ' Queue_ref '


Solution:

Because the path of the training sample needs to be modified, the Data_dir assigned to the cifar10_input.py is the folder where the local data resides

Other renaming of the TensorFlow API can be referenced

Http://www.codesec.net/view/504579.html


Continuous update ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.