首页 > 解决方案 > Tensorflow 1.2.1:AttributeError:模块'tensorflow'没有属性'random'

问题描述

我已经安装了 tensorflow 1.2.1 并且每当我尝试运行

c=tf.random.normal(shape=(3,4),dtype=tf.float32)

我得到错误 AttributeError: module 'tensorflow' has no attribute 'random'

标签: tensorflowpython-3.6

解决方案


采用

c = tf.random_normal(shape=(3,4),dtype=tf.float32))

在此处查看可用 API 的完整列表

看这里的用法


推荐阅读