在线精品99_中国九九盗摄偷拍偷看_91免费版在线观看_91.app_91高清视频在线_99热最新网站

ubuntu如何安装theano和keras

168次阅读
没有评论

共计 1623 个字符,预计需要花费 5 分钟才能阅读完成。

这篇文章主要介绍“ubuntu 如何安装 theano 和 keras”,在日常操作中,相信很多人在 ubuntu 如何安装 theano 和 keras 问题上存在疑惑,丸趣 TV 小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”ubuntu 如何安装 theano 和 keras”的疑惑有所帮助!接下来,请跟着丸趣 TV 小编一起来学习吧!

1,安装 pip

sudo apt-get install python3-setuptools
sudo easy_install3 pip

2,安装 g ++

 sudo apt-get install g++

采用上述命令安装 g ++,安装完成后可用 g ++ -version 查看是否安装完成。注意,如果没有安装 g ++,在 import theano 时会出现以下错误:

warning (theano.configdefaults): g++ not detected ! theano will be unable to execute optimized c-implementations (for both cpu and gpu) and will default to python implementations. performance will be severely degraded. to remove this warning, set theano flags cxx to an empty string.
搜了一下是因为 theano 采用 g ++ 编译的话速度比较快,在网上找到的大部分解决方案都是基于 anaconda 安装的,解决方法是:

conda install mingw libpython

3,安装 theano

sudo pip3 install theano

  该命令会自动下载 theano 所需要的依赖,包括 numpy,scipy 等等。

4,安装 keras

sudo pip3 install keras

  最后需要注意的是,keras 默认的 backend 是 tensorflow,我们需要的是 theano,所以需要修改下设置。(而且 tensorflow 用 pip3 安装,在 32 位系统上没有对应的版本!用源文件安装又很复杂)

vim ~/.keras/keras.json
 
  image_dim_ordering : tf ,
 
  epsilon :1e-07,
 
  floatx : float32 ,
 
  backend : theano 
}

 5,测试 theano

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(), ))

到此,关于“ubuntu 如何安装 theano 和 keras”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注丸趣 TV 网站,丸趣 TV 小编会继续努力为大家带来更多实用的文章!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-07-14发表,共计1623字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)
主站蜘蛛池模板: 伊人性伊人情综合网 | 成人黄色在线视频 | 欧美一区二区三区成人片在线 | 国产精品天天在线午夜更新 | 久伊人| 99精品国产丝袜在线拍国语 | 久久夜色撩人精品国产av | 图片区偷拍区小说区 | 欧洲精品一区二区三区 | 中文字幕视频在线免费观看 | 一区二区在线观看视频在线 | 国内精品视频九九九九 | 国产精品久久成人网站 | 国产av综合影院 | 少妇厨房愉情理伦bd在线观看 | 四虎永久免费观看 | 欧美啪啪| 99热久久久久久久免费观看 | 国产免费一级精品视频 | 国产欧美日韩综合一区二区三区 | 宅男宅女精品国产av天堂 | 日韩在线视频不卡 | 日韩欧美在 | 亚洲精品成a人在线观看 | 国产日韩欧美在线视频免费观看 | 久久久毛片 | 一进一出一爽又粗又大 | 精品乱码久久久久久中文字幕 | 欧美精品久久久久久久久大尺度 | 欧美视频亚洲 | 女人一级特纯黄大片色 | 国产精品久久久免费视频 | 欧美性猛交xxxx黑人 | 天堂а√在线中文在线 | 亚洲av无码一区二区三区不卡 | 加勒比色综合久久久久久久久 | 国内高清久久久久久 | 在线精品无码字幕无码av | 亚洲不卡中文字幕 | 成人精品| 久久亚洲精品ab无码播放 |