我刚刚使用Windows 64位和Python 2.7安装了keras 1.1.2。
代码
import java.io.*;
import java.net.*;
import java.util.*;
public class ChatHandler extends Thread{
Socket s;
BufferedReader br;
PrintWriter pw;
String temp;
ArrayList <ChatHandler>handlers;
public ChatHandler(Socket s, ArrayList <ChatHandler>handlers){
this.s = s;
this.handlers = handlers;
}
public void run(){
try{
handlers.add(this);
br = new BufferedReader(new InputStreamReader(s.getInputStream()));
pw = new PrintWriter(s.getOutputStream(), true);
temp = "";
while((temp = br.readLine()) != null){
for (ChatHandler ch : handlers){
ch.pw.println(temp);
}
System.out.println(temp);
}
}catch(IOException ioe){
System.out.println(ioe.getMessage());
}finally{
handlers.remove(this);
}
}
}
返回以下错误:
model = Sequential()
model.add(Dense(25, input_dim=50, init='uniform', activation='relu'))
代码
Traceback (most recent call last):
File "C:\Loopy\lib\site-packages\IPython\core\interactiveshell.py", line 2827, in run_code
exec code_obj in self.user_global_ns, self.user_ns
File "<ipython-input-3-850dd91f408b>", line 30, in <module>
model.add(Dense(25, input_dim=50, init='uniform', activation='relu'))
TypeError: __init__() got multiple values for keyword argument 'input_dim'
返回:
model.add(Dense(15, init='uniform', activation='relu'))
答案 0 :(得分:1)
尝试使用以下命令将keras升级到最新的1.1.2:
pip install keras --upgrade
对于特定用户:pip install --user keras --upgrade
答案 1 :(得分:0)
您是否尝试过单独添加图层?输入,然后是密集,然后是初始化,然后是激活。
除此之外,请尝试使用kernel_initializer='random_uniform'
而不是init='uniform'
。