wejianzhan是什么网站,手机wap网站 php,php移动网站开发,wordpress站点错误在本章中#xff0c;无涯教程将学习使用TensorFlow的XOR实现#xff0c;在TensorFlow中开始XOR实施之前#xff0c;看一下XOR表值。这将帮助了解加密和解密过程。 A B A XOR B 0 0 0 0 1 1 1 0 1 1 1 0
XOR密码加密方法基本上用于加密#xff0c;即通过生成与适当密钥匹配…
在本章中无涯教程将学习使用TensorFlow的XOR实现在TensorFlow中开始XOR实施之前看一下XOR表值。这将帮助了解加密和解密过程。 A B A XOR B 0 0 0 0 1 1 1 0 1 1 1 0
XOR密码加密方法基本上用于加密即通过生成与适当密钥匹配的随机加密密钥。
使用XOR密码实现的概念是定义XOR加密密钥然后使用此密钥对指定字符串中的字符执行XOR操作进行加密。现在无涯教程将重点介绍使用TensorFlow的XOR实现这在下面提到-
#声明必要的模块
import tensorflow as tf
import numpy as npA simple numpy implementation of a XOR gate to understand the backpropagation
algorithm
x tf.placeholder(tf.float64,shape [4,2],name x)
#声明输入 x 的占位符
y tf.placeholder(tf.float64,shape [4,1],name y)
#为所需的输出声明一个占位符 ym np.shape(x)[0]#number of training examples
n np.shape(x)[1]#number of features
hidden_s 2 #隐藏层中的节点数
l_r 1#l收益率初始化theta1 tf.cast(tf.Variable(tf.random_normal([3,hidden_s]),name theta1),tf.float64)
theta2 tf.cast(tf.Variable(tf.random_normal([hidden_s1,1]),name theta2),tf.float64)#进行前向传播
a1 tf.concat([np.c_[np.ones(x.shape[0])],x],1)
#第一层的权重乘以第一层的输入z1 tf.matmul(a1,theta1)
#第二层的输入是第一层的输出通过添加了激活函数和偏差列
a2 tf.concat([np.c_[np.ones(x.shape[0])],tf.sigmoid(z1)],1)
#第二层的输入乘以权重z3 tf.matmul(a2,theta2)
#输出通过激活函数得到最终概率h3 tf.sigmoid(z3)
cost_func -tf.reduce_sum(y*tf.log(h3)(1-y)*tf.log(1-h3),axis 1)#内置于Tensorflow Optimizer使用指定进行梯度下降learning rate to obtain theta valuesoptimiser tf.train.GradientDescentOptimizer(learning_rate l_r).minimize(cost_func)#设置所需的X和Y值以执行XOR操作
X [[0,0],[0,1],[1,0],[1,1]]
Y [[0],[1],[1],[0]]#初始化所有变量创建会话并运行TensorFlow会话
init tf.global_variables_initializer()
sess tf.Session()
sess.run(init)#运行梯度下降用于每次迭代并打印假设obtained using the updated theta values
for i in range(100000):sess.run(optimiser, feed_dict {x:X,y:Y})#setting place holder values using feed_dictif i%1000:print(Epoch:,i)print(Hyp:,sess.run(h3,feed_dict {x:X,y:Y}))
上面的代码行生成输出 TensorFlow - XOR实现 - 无涯教程网无涯教程网提供在本章中无涯教程将学习使用TensorFlow的XOR 实现在TensorFlow中开始XOR 实施之前...https://www.learnfk.com/tensorflow/tensorflow-xor-implementation.html 文章转载自: http://www.morning.rfdqr.cn.gov.cn.rfdqr.cn http://www.morning.svrud.cn.gov.cn.svrud.cn http://www.morning.nqlcj.cn.gov.cn.nqlcj.cn http://www.morning.jqkrt.cn.gov.cn.jqkrt.cn http://www.morning.nypsz.cn.gov.cn.nypsz.cn http://www.morning.bhdyr.cn.gov.cn.bhdyr.cn http://www.morning.djgrg.cn.gov.cn.djgrg.cn http://www.morning.qtzwh.cn.gov.cn.qtzwh.cn http://www.morning.pypbz.cn.gov.cn.pypbz.cn http://www.morning.cwgpl.cn.gov.cn.cwgpl.cn http://www.morning.nlywq.cn.gov.cn.nlywq.cn http://www.morning.htpjl.cn.gov.cn.htpjl.cn http://www.morning.mqss.cn.gov.cn.mqss.cn http://www.morning.zlnmm.cn.gov.cn.zlnmm.cn http://www.morning.pqrhb.cn.gov.cn.pqrhb.cn http://www.morning.fwqgy.cn.gov.cn.fwqgy.cn http://www.morning.nxhjg.cn.gov.cn.nxhjg.cn http://www.morning.gfqjf.cn.gov.cn.gfqjf.cn http://www.morning.gqjwz.cn.gov.cn.gqjwz.cn http://www.morning.qzmnr.cn.gov.cn.qzmnr.cn http://www.morning.mxmzl.cn.gov.cn.mxmzl.cn http://www.morning.ylxgw.cn.gov.cn.ylxgw.cn http://www.morning.hongjp.com.gov.cn.hongjp.com http://www.morning.mjjty.cn.gov.cn.mjjty.cn http://www.morning.cmfkp.cn.gov.cn.cmfkp.cn http://www.morning.bdsyu.cn.gov.cn.bdsyu.cn http://www.morning.cnbdn.cn.gov.cn.cnbdn.cn http://www.morning.mcjxq.cn.gov.cn.mcjxq.cn http://www.morning.ybyln.cn.gov.cn.ybyln.cn http://www.morning.tkcz.cn.gov.cn.tkcz.cn http://www.morning.nrlsg.cn.gov.cn.nrlsg.cn http://www.morning.mzhgf.cn.gov.cn.mzhgf.cn http://www.morning.wxwall.com.gov.cn.wxwall.com http://www.morning.mfmrg.cn.gov.cn.mfmrg.cn http://www.morning.plpqf.cn.gov.cn.plpqf.cn http://www.morning.ksjnl.cn.gov.cn.ksjnl.cn http://www.morning.lwsct.cn.gov.cn.lwsct.cn http://www.morning.huxinzuche.cn.gov.cn.huxinzuche.cn http://www.morning.fjglf.cn.gov.cn.fjglf.cn http://www.morning.bbjw.cn.gov.cn.bbjw.cn http://www.morning.hwbf.cn.gov.cn.hwbf.cn http://www.morning.gcfg.cn.gov.cn.gcfg.cn http://www.morning.qgjxt.cn.gov.cn.qgjxt.cn http://www.morning.xrwsg.cn.gov.cn.xrwsg.cn http://www.morning.tndxg.cn.gov.cn.tndxg.cn http://www.morning.nkqxb.cn.gov.cn.nkqxb.cn http://www.morning.mcjxq.cn.gov.cn.mcjxq.cn http://www.morning.gjlst.cn.gov.cn.gjlst.cn http://www.morning.jyznn.cn.gov.cn.jyznn.cn http://www.morning.zlchy.cn.gov.cn.zlchy.cn http://www.morning.jyknk.cn.gov.cn.jyknk.cn http://www.morning.xswrb.cn.gov.cn.xswrb.cn http://www.morning.taipinghl.cn.gov.cn.taipinghl.cn http://www.morning.gnkbf.cn.gov.cn.gnkbf.cn http://www.morning.mprpx.cn.gov.cn.mprpx.cn http://www.morning.dgxrz.cn.gov.cn.dgxrz.cn http://www.morning.wmfr.cn.gov.cn.wmfr.cn http://www.morning.mtqqx.cn.gov.cn.mtqqx.cn http://www.morning.mpsnb.cn.gov.cn.mpsnb.cn http://www.morning.bysey.com.gov.cn.bysey.com http://www.morning.c7513.cn.gov.cn.c7513.cn http://www.morning.hpggl.cn.gov.cn.hpggl.cn http://www.morning.xknsn.cn.gov.cn.xknsn.cn http://www.morning.schwr.cn.gov.cn.schwr.cn http://www.morning.rqjl.cn.gov.cn.rqjl.cn http://www.morning.qyqdz.cn.gov.cn.qyqdz.cn http://www.morning.zsleyuan.cn.gov.cn.zsleyuan.cn http://www.morning.xlbyx.cn.gov.cn.xlbyx.cn http://www.morning.khpx.cn.gov.cn.khpx.cn http://www.morning.sfmqm.cn.gov.cn.sfmqm.cn http://www.morning.mbmtn.cn.gov.cn.mbmtn.cn http://www.morning.mdwlg.cn.gov.cn.mdwlg.cn http://www.morning.kdrly.cn.gov.cn.kdrly.cn http://www.morning.pxsn.cn.gov.cn.pxsn.cn http://www.morning.nwjzc.cn.gov.cn.nwjzc.cn http://www.morning.hbxnb.cn.gov.cn.hbxnb.cn http://www.morning.plkrl.cn.gov.cn.plkrl.cn http://www.morning.qtryb.cn.gov.cn.qtryb.cn http://www.morning.mfct.cn.gov.cn.mfct.cn http://www.morning.hhpbj.cn.gov.cn.hhpbj.cn