![]() X_col = tf.feature_column.numeric_column(key='x', )Įs = tf.estimator.LinearRegressor(feature_columns=)Īnother question is if it is possible to use this functionality to provide data for feature columns which are tf.feature_column.crossed_column? The overall goal is to use om_generator functionality in batch training where data is loaded on chunks from a database in cases when data does not fit in memory. Iterator = dataset.make_one_shot_iterator()įeatures_tensors, labels = iterator.get_next() Here is the code: SIZE = 10ĭataset = tf._generator(generator=_generator, The idea is just to yield two numpy arrays with SIZE = 10 and run linear regression with them. I tried several combinations including not specifying it but still receive some errors due to shape mismatch of the tensors. I can not understand how to set output_shapes argument. > 67 pywrap_tensorflow.TFE_ExecutorWaitForAllPendingNodes(self._handle)įile "/usr/local/lib/python3.6/dist-packages/keras_preprocessing/image/utils.Trying to build simple model just to figure out how to deal with tf._generator. usr/local/lib/python3.6/dist-packages/tensorflow_core/python/eager/executor.py in wait(self)Ħ6 """Waits for ops dispatched in this executor to finish.""" > 99 (type, value, traceback)ġ01 # Suppress StopIteration *unless* it's the same exception that > 665 return om_compatible_tensor_list(self._element_spec, ret)Ħ67 in _exit_(self, type, value, traceback) usr/local/lib/python3.6/dist-packages/tensorflow_core/python/data/ops/iterator_ops.py in next(self)Ħ72 """Returns a nested structure of `Tensor`s containing the next element."""Ħ63 return self._element_spec._from_compatible_tensor_list(ret) # pylint: disable=protected-access usr/local/lib/python3.6/dist-packages/tensorflow_core/python/data/ops/iterator_ops.py in _next_(self)Ħ29 def _next_(self): # For Python 3 compatibility TypeError: endswith first arg must be bytes or a tuple of bytes, not str ![]() Iterator = iter(self._generator(*self._args.pop(iterator_id)))įile "/usr/local/lib/python3.6/dist-packages/keras_preprocessing/image/image_data_generator.py", line 540, in flow_from_directoryįile "/usr/local/lib/python3.6/dist-packages/keras_preprocessing/image/directory_iterator.py", line 126, in _init_įile "/usr/lib/python3.6/multiprocessing/pool.py", line 644, in getįile "/usr/lib/python3.6/multiprocessing/pool.py", line 119, in workerįile "/usr/local/lib/python3.6/dist-packages/keras_preprocessing/image/utils.py", line 216, in _list_valid_filenames_in_directoryįile "/usr/local/lib/python3.6/dist-packages/keras_preprocessing/image/utils.py", line 172, in _iter_valid_files Values = next(generator_state.get_iterator(iterator_id))įile "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 675, in get_iterator usr/local/lib/python3.6/dist-packages/six.py in raise_from(value, from_value)įile "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 673, in get_iteratorĭuring handling of the above exception, another exception occurred:įile "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/script_ops.py", line 236, in _call_įile "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 789, in generator_py_func > 6606 six.raise_from(core._status_to_exception(e.code, message), None) usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py in raise_from_not_ok_status(e, name) > 2479 _ops.raise_from_not_ok_status(e, name)Ģ480 # Add nodes to the TensorFlow graph. usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/gen_dataset_ops.py in iterator_get_next_sync(iterator, output_types, output_shapes, name)Ģ478 except _core._NotOkStatusException as e: > 659 output_shapes=self._flat_output_shapes) usr/local/lib/python3.6/dist-packages/tensorflow_core/python/data/ops/iterator_ops.py in _next_internal(self)Ħ58 output_types=self._flat_output_types, usr/local/lib/python3.6/dist-packages/tensorflow_core/python/eager/context.py in execution_mode(mode) InvalidArgumentError Traceback (most recent call last) Img_gen.flow_from_directory, args=, # this failed. Gen = img_gen.flow_from_directory(flowers_root_path) InvalidArgumentError: TypeError: endswith first arg must be bytes or a tuple of bytes, not strĬode snippet: import tensorflow as tf # version 2.1.0įlowers_root_path = tf._file(origin=DATA_URL, fname='flower_photos', untar=True) The dataset failed in any attempt to iterate through it. flow_from_directory, wrapping it with tf._generator(.). This is the case of using Keras ImageDataGenerator with.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |