TypeError: Input 'filename' of 'ReadFile' Op has type float32 that does not match expected type of string.
shbnm21 opened this issue · 2 comments
Traceback (most recent call last):
File "train.py", line 94, in
val_data = data.Celeba('./dataset/data', atts, img_size, n_sample, part='val', shuffle=False, sess=sess, crop=not use_cropped_img)
File "/content/gdrive/My Drive/Colab Notebooks/AttGAN-Tensorflow/data.py", line 220, in init
repeat=repeat)
File "/content/gdrive/My Drive/Colab Notebooks/AttGAN-Tensorflow/data.py", line 65, in disk_image_batch_dataset
map_func_, num_threads, shuffle, buffer_size, repeat)
File "/content/gdrive/My Drive/Colab Notebooks/AttGAN-Tensorflow/data.py", line 19, in batch_dataset
dataset = dataset.map(map_func, num_parallel_calls=num_threads)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/data/ops/dataset_ops.py", line 1776, in map
self, map_func, num_parallel_calls, preserve_cardinality=False))
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/data/ops/dataset_ops.py", line 3228, in init
use_legacy_function=use_legacy_function)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/data/ops/dataset_ops.py", line 2555, in init
self._function = wrapper_fn._get_concrete_function_internal()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/function.py", line 1355, in _get_concrete_function_internal
*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/function.py", line 1349, in _get_concrete_function_internal_garbage_collected
graph_function, _, _ = self._maybe_define_function(args, kwargs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/function.py", line 1652, in _maybe_define_function
graph_function = self._create_graph_function(args, kwargs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/function.py", line 1545, in _create_graph_function
capture_by_value=self._capture_by_value),
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/func_graph.py", line 715, in func_graph_from_py_func
func_outputs = python_func(*func_args, **func_kwargs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/data/ops/dataset_ops.py", line 2549, in wrapper_fn
ret = _wrapper_helper(*args)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/data/ops/dataset_ops.py", line 2489, in wrapper_helper
ret = func(*nested_args)
File "/content/gdrive/My Drive/Colab Notebooks/AttGAN-Tensorflow/data.py", line 58, in map_func
return map_func(*parse_func(*args))
File "/content/gdrive/My Drive/Colab Notebooks/AttGAN-Tensorflow/data.py", line 52, in parse_func
img = tf.io.read_file(path)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/gen_io_ops.py", line 626, in read_file
"ReadFile", filename=filename, name=name)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/op_def_library.py", line 550, in _apply_op_helper
(prefix, dtypes.as_dtype(input_arg.type).name))
TypeError: Input 'filename' of 'ReadFile' Op has type float32 that does not match expected type of string.
tr_data = data.Celeba('./data', atts, img_size, batch_size, part='train', sess=sess, crop=not use_cropped_img)
val_data = data.Celeba('./data', atts, img_size, n_sample, part='val', shuffle=False, sess=sess, crop=not use_cropped_img)
Initially I used same path as used in code then also i am getting typeError
so I put data folder in dataset folder and it is in the same folder,where all the python scripts are saved.
'/content/gdrive/My Drive/Colab Notebooks/AttGAN-Tensorflow/data' like this
so I changed it to
'/content/gdrive/My Drive/Colab Notebooks/AttGAN-Tensorflow/dataset/data'
I resolved that error