《TensorFlow技术解析与实战》第18章 TensorFlowOnSpark

在第14章我们讲了TensorFlow的分布式运行,在第17章又介绍了使用Kubernetes集群对TensorFlow节点进行调度、监控和失败重启等功能。我们知道,Hadoop生态的大数据系统一般可以分为Yarn、HDFS和MapReduce计算框架,TensorFlow本身的分布式就相当于MapReduce计算框架部分,而Kubernetes就相当于Yarn调度系统。本章要讲的TensorFlowOnSpark是利用远程直接内存访问(Remote Direct Memory Access,RDMA)解决了存储功能和调度,实现了深度学习和大数据的融合。

TensorFlowOnSpark(TFoS)是雅虎推出的开源项目[1],支持使用Apache Spark集群进行分布式TensorFlow训练和预测。其实,TensorFlow的程序并不能直接作为Spark的程序运行,TensorFlowOnSpark提供了一个程序来进行桥接,本质上是每个Spark Executor启动一个对应的TensorFlow进程,然后通过远程进程通信(RPC)进行交互。

要把一个训练程序改到使用Spark的集群上运行,在运用TensorFlowOnSpark后,就只需要改非常少量的代码(官方认为不到10行)。TensorFlowOnSpark通过下面的步骤来管理Spark集群。

(1)预留:为在Executor上执行的每个

tensorflow on spark安装的部分资源包 tensorflowonspark的资源包,主要是保证那些依赖关系的正确,这个官方的很坑,这是我自己收集的 立即下载

相关推荐

SpringDoc 基本使用指南

SpringDoc 凭借零配置启动注解简洁和深度兼容 Spring 生态的优势,已成为 Spring Boot API 文档的首选工具。自动化- 减少手动维护文档的成本;标准化- 严格遵循 OpenAPI 3 规范;可扩展- 分组、安全控制灵活适配复杂项目。访问即可查看交互式文档(默认路径)

墨鸦的博客 1万+

双向全桥隔离DC-DC变换器(DAB)的调制优化与挑战解析

本文深入解析了双向全桥隔离DC-DC变换器(DAB)的核心调制技术及其面临的挑战。文章从基础的相移调制(SPS)入手,逐步探讨了扩展相移(EPS)、双重相移(DPS)等进阶策略,并重点分析了电流优化与零电压开通(ZVS)等硬核优化技巧。针对DAB在实际应用中存在的建模困难、多模块并联及数字实现等挑战,提供了实用的应对策略与设计思路,旨在帮助工程师在性能、复杂度与成本之间找到最佳平衡。

weixin_29271053的博客 580

【经验分享】使用Keil5烧录代码遇到的问题及解决方法

本文介绍了在使用Keil5烧录代码过程中可能遇到的常见问题,主要为编译错误和下载失败,并提供了解决方案和注意事项。通过本文中提供的具体解决方案和注意事项,希望能够帮助读者更加顺利地进行Keil5烧录代码操作,提高开发效率和成果实现。

qq_63195670的博客 1万+

Qt 5.12.8在Linux下编译qtvirtualkeyboard模块,我踩过的那些坑(附完整解决方案)

本文详细介绍了在Linux系统下为Qt 5.12.8单独编译qtvirtualkeyboard模块的完整解决方案。通过分析模块缺失原因、提供精准的编译步骤和常见问题处理,帮助开发者高效解决虚拟键盘模块缺失问题,避免重新编译整个Qt源码的繁琐过程。

weixin_29248611的博客 469

TIA博途中如何访问不同IP网段的PLC以及不同IP网段的PLC如何通信?

TIA博途中如何访问不同IP网段的PLC以及不同IP网段的PLC如何通信? 处于不同IP网段的以太网设备需要通信时,需要有路由设备连接2个不同IP网段的网络。 如下图所示,网络A的地址为192.168.0.0,网络B的地址为192.168.1.0;2个网络处于不同的网段之中,此时,则需要路由设备来实现2者之间的通信。 网络A中的设备若要和网络B中的设备通信,则需要将自己的网关地址设置为:192.168.0.1;同理,网络B中的设备若要和网络A中的设备通信,则需要将自己的网关地址设置为:192.168.1

Robot_PLC_HMI_Automation 8170

R语言生存分析之竞争风险模型

R语言生存分析之竞争风险模型 竞争风险模型(Competing Risk Model)是一种处理多种潜在结局生存数据的分析方法,早在1999年Fine和Gray就提出了部分分布的半参数比例风险模型,通常使用的终点指标是累积发生率函数(cumulative incidence function,CIF)。 研究中结局事件可能有多个,某些结局将阻止感兴趣事件的出现或影响其发生的概率,各结局事件形成“竞争”关系,互为竞争风险事件。 竞争风险模型( Competing Risk Model ) : 指

data+scenario+science+insight 5251

YOLOv11 模型改进全流程:从代码修改到性能跃升,让你打造专属检测利器

无论是科研中需要发表创新点满满的论文,还是企业里要解决特定场景的检测难题,这套方法都能让你在YOLOv11的基础上打造出“量身定制”的检测模型。别再让通用模型的“平庸性能”限制你的项目上限——现在就动手修改代码,让你的YOLOv11模型在精度、速度或小样本适应能力上实现跨越式提升,用技术突破证明你的AI研发实力!本文将带你从代码层面入手,完成从骨干网络到损失函数的全维度改进,真正掌握让YOLOv11“为你所用”的技术实力。该改进对小样本类别(如数据集中仅占5%的“稀有缺陷”)的识别精度提升显著。

m0_71589036的博客 406

把事务数据变成可分析数据:用 ABAP CDS 构建 Cube View 与 Query View,并拆解 OData 取数的底层路径

ABAP CDS分析建模:Cube与Query视图的实践解析 本文探讨了ABAP CDS分析建模中Cube View与Query View的核心区别与应用场景: 架构定位 Cube View作为分析型数据源,定义维度和度量的基础语义 Query View作为消费投影,控制查询可见字段和聚合逻辑 关键实现 通过@Analytics.dataCategory: #CUBE声明分析数据源 使用@DefaultAggregation确保指标口径一致性 @Analytics.query: true启用分析引擎特性 运

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 154

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

上一篇: 《TensorFlow技术解析与实战》第19章 TensorFlow移动端应用
下一篇: 《TensorFlow技术解析与实战》第17章 TensorFlow和Kubernetes结合
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

人民邮电出版社有限公司

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值