Open shuiruge opened 4 years ago
I am new to tensorflow and just wanted to get started with some of the models. I also ran into this issue with the 'Quickstart' problem in the tensor2tensor documentation. Briefly switching back to tensorflow 1.15 has allowed me to get around this error for now so i can at least get to grips with the core functionality - keen to find a solution to allow tf2.0 if anyone has any ideas
You need to change tf.to_float call to tf.cast(..., dtype=tf.float32)
I tried the above solution: I get the following error
ValueError Traceback (most recent call last)
9 frames
/usr/local/lib/python3.7/dist-packages/tensor2tensor/problems.py in
/usr/local/lib/python3.7/dist-packages/tensor2tensor/data_generators/all_problems.py in import_modules(modules) 138 for module in modules: 139 try: --> 140 importlib.import_module(module) 141 except ImportError as error: 142 errors.append((module, error))
/usr/lib/python3.7/importlib/init.py in import_module(name, package) 125 break 126 level += 1 --> 127 return _bootstrap._gcd_import(name[level:], package, level) 128 129
/usr/local/lib/python3.7/dist-packages/tensor2tensor/data_generators/algorithmic.py in
/usr/local/lib/python3.7/dist-packages/tensor2tensor/data_generators/problem.py in
/usr/local/lib/python3.7/dist-packages/tensor2tensor/utils/metrics.py in
/usr/local/lib/python3.7/dist-packages/tensor2tensor/layers/modalities.py in
/usr/local/lib/python3.7/dist-packages/tensor2tensor/layers/common_attention.py in
/usr/local/lib/python3.7/dist-packages/tensorflow/python/util/traceback_utils.py in error_handler(*args, **kwargs) 151 except Exception as e: 152 filtered_tb = _process_traceback_frames(e.traceback) --> 153 raise e.with_traceback(filtered_tb) from None 154 finally: 155 del filtered_tb
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/constant_op.py in convert_to_eager_tensor(value, ctx, dtype) 100 dtype = dtypes.as_dtype(dtype).as_datatype_enum 101 ctx.ensure_initialized() --> 102 return ops.EagerTensor(value, ctx.device_name, dtype) 103 104
ValueError: Attempt to convert a value (Ellipsis) with an unsupported type (<class 'ellipsis'>) to a Tensor.
Description
TensorFlow 2.0 has no attribute
to_float
.Environment information
For bugs: reproduction and error logs