Skip to content
This repository was archived by the owner on Jul 7, 2023. It is now read-only.
This repository was archived by the owner on Jul 7, 2023. It is now read-only.

module 'tensorflow' has no attribute 'to_float' #1736

@shuiruge

Description

@shuiruge

Description

TensorFlow 2.0 has no attribute to_float.

Environment information

OS: Windows 10 Home Edition

$ pip freeze | grep tensor
mesh-tensorflow==0.1.4
tensor2tensor==1.14.1
tensorboard==2.0.1
tensorflow==2.0.0
tensorflow-datasets==1.3.0
tensorflow-estimator==2.0.1
tensorflow-gan==2.0.0
tensorflow-hub==0.7.0
tensorflow-metadata==0.15.0
tensorflow-probability==0.7.0

$ python -V
Python 3.7.5

For bugs: reproduction and error logs

# Steps to reproduce:
$ conda create -n test python=3.7
$ conda activate test
$ pip install tensor2tensor[tensorflow]
$ python -c "from tensor2tensor.models.transformer import Transformer"

# Error logs:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\me\Anaconda3\envs\nlp\lib\site-packages\tensor2tensor\models\__init__.py", line 25, in <module>
    from tensor2tensor.layers import modalities  # pylint: disable=g-import-not-at-top
  File "C:\Users\me\Anaconda3\envs\nlp\lib\site-packages\tensor2tensor\layers\modalities.py", line 28, in <module>
    from tensor2tensor.layers import common_attention
  File "C:\Users\me\Anaconda3\envs\nlp\lib\site-packages\tensor2tensor\layers\common_attention.py", line 954, in <module>
    def attention_bias_to_padding(attention_bias, cast_fn=tf.to_float):
AttributeError: module 'tensorflow' has no attribute 'to_float'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions