- 博客(7)
- 资源 (1)
- 收藏
- 关注
原创 线程同步——两个线程轮流执行python实现
import threadingimport timelockA=threading.Lock()lockB=threading.Lock()def printA(n): if n<0: return lockA.acquire() print("+++") lockB.release() time.sleep(0.1) printA(n-1)def...
2018-03-31 22:34:08 3099
原创 后缀自动机SAM笔记和模板
以下是模板:#include<stdio.h>#include<string.h>//后缀自动机Suffix Automaton/* 注意: (1)CHARSZ是字符个数 idx()可以对字符进行编码。默认只接受小写字母 (2)调用SAM::buildSAM即可建树 (3)调用SAM::clearSAM清空内存。*/#define CHARSZ ...
2018-03-26 16:06:13 440
原创 [python]线性回归实现linear regression
#线性回归,梯度下降法#by cjf@xmu#参数n个点,返回线性方程参数a,b,y=ax+bimport mathdef linear(points): a=10.0 b=1.0 learning_rate=1e-2 #loss=1/(2n)*sigmal(sqr(a*xi+b-yi)) #求loss对a,b的偏导,梯度下降法 while True: ...
2018-03-13 16:15:09 499
原创 [Tensorflow] 网络局部restore 以及 网络局部训练
网络架构如下:参数为a1,a2,b1,b2,网络输出:y=a1*a2*x+b1+b2目标函数:y=x一、网络局部参数restore应用场景:网络架构修改,但是部分参数需要重新利用;设置方法:将var_list参数传给tf.train.Saver即可只save/restore var_list里的参数如何使用:(1)保存save:a1,a2,b1,b2分别为10,20,30,40import ten...
2018-03-11 21:41:53 1844
原创 [神经网络] 关于学习率太大导致无法收敛的问题
import tensorflow as tfimport random#训练函数y=2x-1,a/b分别要训练为2,-1x=tf.placeholder(tf.float32,[1])a=tf.Variable(tf.constant([1],dtype=tf.float32)) #b=tf.Variable(tf.constant([1],dtype=tf.float32))y=...
2018-03-11 21:11:26 18802 1
原创 [深度学习] ResNet实现细节
import tensorflow as tf"""(1)构造函数__init__参数 input_sz: 输入层placeholder的4-D shape,如mnist是[None,28,28,1] (2)train函数:训练一步 batch_input: 输入的batch batch_output: label learning_rate:学习率 返回:正...
2018-03-04 20:17:39 762
原创 [深度学习] 权值初始化 xavier和he_normal
一、概述与应用(1)论文 xavier论文:《Understanding the difficulty of training deep feedforward neural networks》 he_normal论文:《Delving Deep into Rectifiers:Surpassing Human-Level Performance on ImageNet Classif...
2018-03-04 14:06:41 24023 3
noip2010试题
2011-01-23
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人