Error tf.app.run ()

I have this line of code in my main.py:

if __name__ == "__main__": tf.app.run() 

But this throws an exception:

 ValueError: Iteration of zero-sized operands is not enabled 

Why is this?

This is all the code:

 import tensorflow as tf import config import os from urllib.request import urlretrieve from zipfile import ZipFile from dataset.dataset import Dataset from network.eval import Learning FLAGS = tf.app.flags.FLAGS data_dir = config.data_dir tmp_zip_adr = config.tmp_zip_adr dataset_urls = config.dataset_urls def download_dataset_if_needed(): def download_and_unzip(zipurls): for url in zipurls: print("Downloading {}".format(url)) fpath, _ = urlretrieve(url, tmp_zip_adr) zf = ZipFile(fpath) zf.extractall(data_dir) zf.close() os.remove(fpath) print("Dataset downloaded into 'dataset/data' folder") if not os.path.exists(data_dir) or FLAGS.download: os.makedirs(data_dir) print("Downloading dataset") download_and_unzip(dataset_urls) def main(argv=None): download_dataset_if_needed() if FLAGS.update or not os.path.exists(data_dir + 'segmented_set1'): print("Starting processing binary dataset") Dataset().create_dataset(data_dir + "segmented_set?/*.avi") Learning() if __name__ == '__main__': tf.app.run() 

And this is the whole mistake:

 Traceback (most recent call last): File "C:\Users\asus\Desktop\cnn-rnn-master\cnn-rnn-master\main.py", line 41, in <module> tf.app.run() File "C:\Users\asus\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "C:\Users\asus\Desktop\cnn-rnn-master\cnn-rnn-master\main.py", line 37, in main Learning() File "C:\Users\asus\Desktop\cnn-rnn-master\cnn-rnn-master\network\eval.py", line 12, in __init__ self.train_reader = Reader.Reader("dataset/data/segmented_set1/*.tfr") File "C:\Users\asus\Desktop\cnn-rnn-master\cnn-rnn-master\dataset\Reader.py", line 13, in __init__ self.init_dataset() File "C:\Users\asus\Desktop\cnn-rnn-master\cnn-rnn-master\dataset\Reader.py", line 53, in init_dataset self.iterator = np.nditer(self.files) ValueError: Iteration of zero-sized operands is not enabled 

I went through tf.app.run () on a line using the code found at https://github.com/tensorflow/tensorflow/blob/9dc6c17797c065796603d9259b2aa57b3c07ff71/tensorflow/python/platform/app.py#L22 , and that line in run(main=None, argv=None)

 _sys.exit(main(_sys.argv[:1] + flags_passthrough)) 

gives an error message

 Traceback (most recent call last): File "<pyshell#48>", line 1, in <module> _sys.exit(main(_sys.argv[:1] + flags_passthrough)) TypeError: 'NoneType' object is not callable 
0
python exception error-handling tensorflow
Jun 27 '17 at 6:12
source share

No one has answered this question yet.

See similar questions:

114
How does tf.app.run () work?

or similar:

1190
Work with the error "java.lang.OutOfMemoryError: PermGen space"
four
Tensorflow Attempted to use uninitialized value AUC / AUC / auc / false_positives
3
ValueError: list argument 'values' in 'ConcatV2' Op with a length of 0 shorter than the minimum length of 2
2
Basel bin / tensorflow_serving / example / inception_client
2
[Tensorflow] [Object Detection] ValueError when trying to train with --num_clones = 2
one
Error detecting object in tensor stream 1.0, Python3.5, Anaconda and WIndows10
one
UnicodeEncodeError: Ascii codec cannot encode u2581 at position 0: serial number not in range (128)
one
Tensorflow - import error in CIFAR tutorial
one
ValueError: cannot convert an array of size 0 to form (1,256,256,6)
0
tensorflow.python.framework.errors_impl.NotFoundError: data / kitti_label_map.pbtxt; No such file or directory



All Articles