Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in generator while training #42

Open
mayank1101 opened this issue Jan 9, 2021 · 0 comments
Open

Error in generator while training #42

mayank1101 opened this issue Jan 9, 2021 · 0 comments

Comments

@mayank1101
Copy link


ValueError Traceback (most recent call last)
in
7 image_batch_hr = x_train_hr[rand_nums]
8 image_batch_lr = x_train_lr[rand_nums]
----> 9 generated_images_sr = generator.predict(image_batch_lr)
10
11 real_data_Y = np.ones(batch_size) - np.random.random_sample(batch_size)*0.2

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py in _method_wrapper(self, *args, **kwargs)
128 raise ValueError('{} is not supported in multi-worker mode.'.format(
129 method.name))
--> 130 return method(self, *args, **kwargs)
131
132 return tf_decorator.make_decorator(

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py in predict(self, x, batch_size, verbose, steps, callbacks, max_queue_size, workers, use_multiprocessing)
1577 use_multiprocessing=use_multiprocessing,
1578 model=self,
-> 1579 steps_per_execution=self._steps_per_execution)
1580
1581 # Container that configures and calls tf.keras.Callbacks.

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/data_adapter.py in init(self, x, y, sample_weight, batch_size, steps_per_epoch, initial_epoch, epochs, shuffle, class_weight, max_queue_size, workers, use_multiprocessing, model, steps_per_execution)
1115 use_multiprocessing=use_multiprocessing,
1116 distribution_strategy=ds_context.get_strategy(),
-> 1117 model=model)
1118
1119 strategy = ds_context.get_strategy()

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/data_adapter.py in init(self, x, y, sample_weights, sample_weight_modes, batch_size, epochs, steps, shuffle, **kwargs)
263 **kwargs):
264 super(TensorLikeDataAdapter, self).init(x, y, **kwargs)
--> 265 x, y, sample_weights = _process_tensorlike((x, y, sample_weights))
266 sample_weight_modes = broadcast_sample_weight_modes(
267 sample_weights, sample_weight_modes)

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/data_adapter.py in _process_tensorlike(inputs)
1019 return x
1020
-> 1021 inputs = nest.map_structure(_convert_numpy_and_scipy, inputs)
1022 return nest.list_to_tuple(inputs)
1023

/opt/conda/lib/python3.7/site-packages/tensorflow/python/util/nest.py in map_structure(func, *structure, **kwargs)
633
634 return pack_sequence_as(
--> 635 structure[0], [func(*x) for x in entries],
636 expand_composites=expand_composites)
637

/opt/conda/lib/python3.7/site-packages/tensorflow/python/util/nest.py in (.0)
633
634 return pack_sequence_as(
--> 635 structure[0], [func(*x) for x in entries],
636 expand_composites=expand_composites)
637

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/data_adapter.py in _convert_numpy_and_scipy(x)
1014 if issubclass(x.dtype.type, np.floating):
1015 dtype = backend.floatx()
-> 1016 return ops.convert_to_tensor(x, dtype=dtype)
1017 elif scipy_sparse and scipy_sparse.issparse(x):
1018 return _scipy_sparse_to_sparse_tensor(x)

/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/ops.py in convert_to_tensor(value, dtype, name, as_ref, preferred_dtype, dtype_hint, ctx, accepted_result_types)
1497
1498 if ret is None:
-> 1499 ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
1500
1501 if ret is NotImplemented:

/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/tensor_conversion_registry.py in _default_conversion_function(failed resolving arguments)
50 def _default_conversion_function(value, dtype, name, as_ref):
51 del as_ref # Unused.
---> 52 return constant_op.constant(value, dtype, name=name)
53
54

/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py in constant(value, dtype, shape, name)
262 """
263 return _constant_impl(value, dtype, shape, name, verify_shape=False,
--> 264 allow_broadcast=True)
265
266

/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py in _constant_impl(value, dtype, shape, name, verify_shape, allow_broadcast)
273 with trace.Trace("tf.constant"):
274 return _constant_eager_impl(ctx, value, dtype, shape, verify_shape)
--> 275 return _constant_eager_impl(ctx, value, dtype, shape, verify_shape)
276
277 g = ops.get_default_graph()

/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py in _constant_eager_impl(ctx, value, dtype, shape, verify_shape)
298 def _constant_eager_impl(ctx, value, dtype, shape, verify_shape):
299 """Implementation of eager constant."""
--> 300 t = convert_to_eager_tensor(value, ctx, dtype)
301 if shape is None:
302 return t

/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py in convert_to_eager_tensor(value, ctx, dtype)
96 dtype = dtypes.as_dtype(dtype).as_datatype_enum
97 ctx.ensure_initialized()
---> 98 return ops.EagerTensor(value, ctx.device_name, dtype)
99
100

ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type numpy.ndarray).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant