将tensorflow与elu

尝试使用tensorflow库时出现属性错误输出

TF版本:

Name: tensorflow
Version: 2.0.0
Summary: TensorFlow is an open source machine learning framework for everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: packages@tensorflow.org
License: Apache 2.0
Location: c:\users\vinhalivinhali\appdata\local\programs\python\python35\lib\site-packages
Requires: tensorboard,wrapt,keras-preprocessing,protobuf,wheel,numpy,gast,tensorflow-estimator,termcolor,google-pasta,grpcio,absl-py,keras-applications,astor,opt-einsum,six
Required-by:

Python版本

Python 3.5.0

进口

import tensorflow as tf # for Deep Learning
import pandas as pd # for data manipulation
import numpy as np # for matrix manipulation
from matplotlib import pyplot as plt # for graphics

脚本

X0 = X[:,:] # get the data in the first time period
Ht = tf.elu(tf.matmul(X0,Wx_h) + b) # uses X0 to initiate the hidden state
y = [] # list to be populated with outputs every time period

输出

Traceback (most recent call last):
  File "rnrs.py",line 40,in <module>
    Ht = tf.elu(tf.matmul(X0,Wx_h) + b) # uses X0 to initiate the hidden state
AttributeError: module 'tensorflow' has no attribute 'elu'
a1234567891989719 回答:将tensorflow与elu

elu函数位于tf.nn模块中,请参见documentation

本文链接:https://www.f2er.com/3165233.html

大家都在问