【问题标题】:trying to run styleGAN in jyputer notebook, it says "tensorflow' has no attribute 'Dimension"试图在 jupyter notebook 中运行 styleGAN,它说“tensorflow”没有属性“Dimension”
【发布时间】:2021-08-24 10:51:33
【问题描述】:

enter image description here!python encode_images.py --optimizer=lbfgs --face_mask=True --iterations=6 --use_lpips_loss=0 --use_discriminator_loss=0 --output_video=True aligned_images/ generated_images/latent_representations/

print("\n************ 潜在代码优化完成!***************")

2021-08-24 13:33:11.033451: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] 成功打开动态库cudart64_101.dll

Traceback(最近一次调用最后一次): 文件“encode_images.py”,第 12 行,在 将 dnnlib.tflib 导入为 tflib 文件“C:\Users\bkvij\Office Rapid Innovation\StyleGAN Face Morphing - Arxiv Insights\stylegan-encoder\dnnlib\tflib_init_.py”,第 8 行,

从 .导入自动摘要 文件“C:\Users\bkvij\Office Rapid Innovation\StyleGAN Face Morphing - Arxiv Insights\stylegan-encoder\dnnlib\tflib\autosummary.py”,第 31 行,

从 .导入 tfutil 文件“C:\Users\bkvij\Office Rapid Innovation\StyleGAN Face Morphing - Arxiv Insights\stylegan-encoder\dnnlib\tflib\tfutil.py”,第 34 行,

def shape_to_list(shape: Iterable[tf.Dimension]) -> List[Union[int, None]]: AttributeError: 模块 'tensorflow' 没有属性 'Dimension'

【问题讨论】:

  • 你用的是什么版本的tensorflow?

标签: stylegan


【解决方案1】:

这是因为 tf.Dimension 已被弃用。

转到stylegan/dnnlib/tflib/tfutil.py并将第34行中的tf.Dimension更改为tf.compat.v1.Dimension

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-08-30
    • 1970-01-01
    • 1970-01-01
    • 2017-11-05
    • 2018-02-21
    • 2018-05-12
    • 2021-12-30
    • 2017-12-03
    相关资源
    最近更新 更多