如何在 tensorflow 2.5 中运行 tensorflow 分析

时间:2021-07-31 20:23:19

标签: tensorflow tensorboard

我在 Big Sur 11.5 上使用 Anaconda 运行 python 3.85

% conda list tensor
# packages in environment at /Users/davidlaxer/anaconda3/envs/ai:
#
# Name                    Version                   Build  Channel
tensor2tensor             1.15.7                   pypi_0    pypi
tensorboard               2.5.0                    pypi_0    pypi
tensorboard-data-server   0.6.1                    pypi_0    pypi
tensorboard-plugin-profile 2.4.0                    pypi_0    pypi
tensorboard-plugin-wit    1.8.0                    pypi_0    pypi
tensorflow                2.5.0                    pypi_0    pypi
tensorflow-datasets       4.3.0                    pypi_0    pypi
tensorflow-estimator      2.5.0                    pypi_0    pypi
tensorflow-hub            0.12.0                   pypi_0    pypi
tensorflow-metadata       1.0.0                    pypi_0    pypi
tensorflow-probability    0.13.0rc0                pypi_0    pypi
tensorflow-text           2.5.0                    pypi_0    pypi

这是测试代码:

import tensorflow as tf
import numpy as np
from utils import *
from VDSH import *

tf.compat.v1.enable_v2_behavior()
from tensorflow.python.framework.ops import disable_eager_execution
disable_eager_execution()

#gpu_devices = tf.config.experimental.list_physical_devices('GPU')
#tf.config.experimental.set_memory_growth(gpu_devices[0], True)
options = tf.profiler.experimental.ProfilerOptions(host_tracer_level = 3,
                                                   python_tracer_level = 1,
                                                   device_tracer_level = 1)
tf.profiler.experimental.start('~/logdir', options=options)
...
tf.profiler.experimental.stop()

错误信息如下:

AttributeError: module 'tensorflow.compat.v1.profiler' 没有属性 'experimental'

0 个答案:

没有答案