注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

阿弥陀佛

街树飘影未见尘 潭月潜水了无声 般若观照心空静...

 
 
 

日志

 
 
关于我

一直从事气象预报、服务建模实践应用。 注重气象物理场、实况场、地理信息、本体知识库、分布式气象内容管理系统建立。 对Barnes客观分析, 小波,计算神经网络、信任传播、贝叶斯推理、专家系统、网络本体语言有一定体会。 一直使用Java、Delphi、Prolog、SQL编程。

网易考拉推荐

Euclidean_1  

2017-11-19 17:40:58|  分类: BigDL |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
package layers.activation
import com.intel.analytics.bigdl.nn.Euclidean
import com.intel.analytics.bigdl.tensor.Tensor
import com.intel.analytics.bigdl.utils.RandomGenerator._
import scala.util.Random
object Euclidean_1 {
val seed = 100
RNG.setSeed(seed)
def main(args: Array[String]): Unit = {
val input = Tensor[Double](7).apply1(e => Random.nextDouble())
val gradOutput = Tensor[Double](7).apply1(e => Random.nextDouble())
val module = new Euclidean[Double](7, 7)
var output : Tensor[Double] = null
var gradInput : Tensor[Double] = null
var i = 0
while (i < 5) {
output = module.forward(input)
gradInput = module.backward(input, gradOutput)
i += 1
}
val weight = module.weight
val gradWeight = module.gradWeight

println("weight=",weight)
println("output=",output)
println("gradInput=",gradInput)
println("gradWeight=",gradWeight )
}
}
2017-11-19 17:39:29 INFO  ThreadPool$:79 - Set mkl threads to 1 on thread 1
(weight=,0.0328110495280422	0.12938150038090468	-0.16753699892414875	-0.06648667451105278	-0.05705933698450638	0.019943268720949925	0.260626260296	
-0.2656297711443584	-0.3743973486248839	-0.2595020285750249	-0.28606685636545415	-0.23700853185516163	0.12907417481978667	-0.21913795301357436	
0.2463215296379354	-0.03572527583829149	-0.2746240066635838	0.2798015319203162	0.056765225232381256	-0.32982613176751935	0.29581158966497234	
0.09397095544775647	-0.219822531351812	0.017649239224793944	-0.2378695076881216	0.047091553842933065	-0.2960392428765576	-0.3735670857412544	
-0.21188877682568558	-0.14557437393711176	0.3618055725137559	0.34030735156682734	0.23561031437348812	-0.2822228632843427	-0.2479892847457965	
-0.3182552559436925	0.2390434429517717	-0.14260362465555768	-0.17078419713430698	0.10007258456521423	-0.05162678364777995	0.15070118134344213	
0.33263127467622566	0.10731541037359565	0.24012035791249187	0.3175081333810438	-0.12388772231742984	-0.15203518168816843	-0.24536663433035297	
[com.intel.analytics.bigdl.tensor.DenseTensor of size 7x7])
(output=,1.55766109515878
1.7335394701264029
1.7175892943030098
1.6125552531298657
1.5319871905605635
1.9487639776046206
1.7905459248561753
[com.intel.analytics.bigdl.tensor.DenseTensor of size 7])
(gradInput=,1.0606711541926575
1.3595949408956003
1.1975348829278953
1.8568370247425459
0.7163602334067385
0.7814010679067318
0.7012759635826115
[com.intel.analytics.bigdl.tensor.DenseTensor of size 7])
(gradWeight=,-1.0312537129736312	-0.49327653016819495	-1.48414250780631	-0.7373953480621103	-0.9675692472062003	-0.1615502094495141	-0.42816821529732657	
-1.401531703028265	-0.9486971503160347	-1.4449840956352702	-0.8662432585409068	-1.0765688913682283	-0.09505206298291229	-0.9648975426063828	
-0.8597947266610273	-0.8316715782606444	-1.9645542147657449	-0.47679361349535443	-0.9879713100414744	-0.30547692891690076	-0.5614120424983305	
-1.5245207821883324	-1.258619071255582	-1.7422987897640942	-1.3097394918330454	-1.2944099518895555	-0.35088038207207267	-1.8037166547100463	
-1.2458515371385563	-0.654309983756075	-0.11690822352424801	-0.09305004024990213	-0.28954421643042705	-0.21171690557514267	-0.9704202603593409	
-1.3245659684514968	-0.1311866494372501	-1.016622563488613	-0.6207126279727028	-0.39868115660850123	-0.12197069462171617	-0.29326567895337885	
-0.2699282974921447	-0.4196895382151175	-0.4708026887458304	-0.18011238318851613	-0.9379982067120938	-0.18766291047796005	-1.040185793081395	
[com.intel.analytics.bigdl.tensor.DenseTensor of size 7x7])
  评论这张
 
阅读(6)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018