Skip to content

Commit 5e2e8c8

Browse files
committed
"output" change to "get_output"
the current keras version do not support attribute "output" , it should be changed to "get_output"
1 parent 7d68d09 commit 5e2e8c8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

DeepLearning Tutorials/dive_into_keras/cnn-svm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def rf(traindata,trainlabel,testdata,testlabel):
4444
accuracy = len([1 for i in range(num) if testlabel[i]==pred_testlabel[i]])/float(num)
4545
print(" Origin_model Accuracy:",accuracy)
4646
#define theano funtion to get output of FC layer
47-
get_feature = theano.function([origin_model.layers[0].input],origin_model.layers[11].output(train=False),allow_input_downcast=False)
47+
get_feature = theano.function([origin_model.layers[0].input],origin_model.layers[11].get_output(train=False),allow_input_downcast=False)
4848
feature = get_feature(data)
4949
#train svm using FC-layer feature
5050
svc(feature[0:30000],label[0:30000],feature[30000:],label[30000:])

DeepLearning Tutorials/dive_into_keras/get_feature_map.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
model = cPickle.load(open("model.pkl","rb"))
1717

1818
#define theano funtion to get output of FC layer
19-
get_feature = theano.function([model.layers[0].input],model.layers[11].output(train=False),allow_input_downcast=False)
19+
get_feature = theano.function([model.layers[0].input],model.layers[11].get_output(train=False),allow_input_downcast=False)
2020

2121
#define theano funtion to get output of first Conv layer
22-
get_featuremap = theano.function([model.layers[0].input],model.layers[2].output(train=False),allow_input_downcast=False)
22+
get_featuremap = theano.function([model.layers[0].input],model.layers[2].get_output(train=False),allow_input_downcast=False)
2323

2424

2525
data, label = load_data()

0 commit comments

Comments
 (0)