我试图运行一些代码来创建LSTM模型,但出现错误:
AttributeError: module 'tensorflow' has no attribute 'get_default_graph'
我的代码如下:
from keras.models import Sequential
model = Sequential()
model.add(Dense(32, input_dim=784))
model.add(Activation('relu'))
model.add(LSTM(17))
model.add(Dense(1, activation='sigmoid'))
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
Run Code Online (Sandbox Code Playgroud)
我发现其他人也有类似的问题,他们更新了tensorflow并成功了。但是我的是最新的,但仍然无法正常工作。我是新来的使用keras和机器学习的人,因此如果这很愚蠢,我深表歉意!
我知道BigInteger有一个构造函数,你可以通过传递新BigInteger的最大bitLength和一个随机参数来生成随机BigInteger:
BigInteger(int numBits, Random rnd)
Run Code Online (Sandbox Code Playgroud)
如何生成随机BitInteger,其中numBits的类型为BitInteger而不是int?注意:我不想这样做myBitInteger.intValue().