gpt4 book ai didi

tensorflow2.0 - 属性错误 : module 'tensorflow.compat.v2.tpu.experimental' has no attribute 'HardwareFeature'

转载 作者:行者123 更新时间:2023-12-05 05:38:13 25 4
gpt4 key购买 nike

运行下面的代码给出了错误 AttributeError: module 'tensorflow.compat.v2.tpu.experimental' has no attribute 'HardwareFeature'

import os
import pprint
import tempfile

from typing import Dict, Text

import numpy as np
import pandas as pd
import tensorflow as tf
import tensorflow_datasets as tfds

!pip install -q tensorflow-recommenders

import tensorflow_recommenders as tfrs

使用的 tensorflow 版本是 2.9.1,代码是从 Google Colab 运行的

最佳答案

试错后是否按如下所示更改了执行顺序并且这次工作正常没有错误

!pip install -q tensorflow-recommenders

import os
import pprint
import tempfile

from typing import Dict, Text

import numpy as np
import pandas as pd
import tensorflow as tf
import tensorflow_datasets as tfds

import tensorflow_recommenders as tfrs

关于tensorflow2.0 - 属性错误 : module 'tensorflow.compat.v2.tpu.experimental' has no attribute 'HardwareFeature' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72975176/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com