>>> import numpy # OK!
>>> import scipy # OK!
>>> import theano # warning
WARNING (theano.tensor.blas): Failed to import scipy.linalg.blas, and Theano
flag blas.ldflags is empty. Falling back on slower implementations for
dot(matrix, vector), dot(vector, matrix) and dot(vector, vector) (DLL load
failed: Belirtilen modül bulunamad?.)
>>>
Run Code Online (Sandbox Code Playgroud)
导入theano时,python会发出此警告.我按照这个链接设置了theano.http://deeplearning.net/software/theano/install_windows.html
Numpy和Scipy进口都可以.但是我坚持使用BLAS.
我从github克隆到我的电脑OpenBLAS.我如何将blas添加到环境变量("path")?
如果我使用python 3.5运行以下代码
import numpy as np
import time
import theano
A = np.random.rand(1000,10000).astype(theano.config.floatX)
B = np.random.rand(10000,1000).astype(theano.config.floatX)
np_start = time.time()
AB = A.dot(B)
np_end = time.time()
X,Y = theano.tensor.matrices('XY')
mf = theano.function([X,Y],X.dot(Y))
t_start = time.time()
tAB = mf(A,B)
t_end = time.time()
print ("NP time: %f[s], theano time: %f[s] **(times should be close when run
on CPU!)**" %(np_end-np_start, t_end-t_start))
print ("Result difference: %f" % (np.abs(AB-tAB).max(), ))
Run Code Online (Sandbox Code Playgroud)
我得到了输出
NP time: 0.161123[s], theano time: 0.167119[s] (times should be close when
run on CPU!)
Result …Run Code Online (Sandbox Code Playgroud) 我想将一个新的布尔字段添加到包含其他字段信息的集合中。
我的样本数据是;
{
"_id" : ObjectId("50abae61edecb53c740022eb"),
"pull_request" : {
"diff_url" : null,
"patch_url" : null,
"html_url" : null
}
}
{
"_id" : ObjectId("50abae61edecb53c740022ec"),
"pull_request" : {
"diff_url" : "https://github.com/joyent/http-parser/pull/106.diff",
"patch_url" : "https://github.com/joyent/http-parser/pull/106.patch",
"html_url" : "https://github.com/joyent/http-parser/pull/106"
},
}
Run Code Online (Sandbox Code Playgroud)
新字段是“hasPullRequest”;如果 pull_request 字段为空,则 hasPullRequest:false; 否则 hasPullRequest:true。我的意思是下面的;
{
"_id" : ObjectId("50abae61edecb53c740022eb"),
"pull_request" : {
"diff_url" : null,
"patch_url" : null,
"html_url" : null
},
"hasPullRequest" : false
}
{
"_id" : ObjectId("50abae61edecb53c740022ec"),
"pull_request" : {
"diff_url" : "https://github.com/joyent/http-parser/pull/106.diff",
"patch_url" : "https://github.com/joyent/http-parser/pull/106.patch",
"html_url" : …Run Code Online (Sandbox Code Playgroud)