- 博客(15)
- 收藏
- 关注
转载 Cython(二)
Cython的类型1 类型定义1.1 定义一个C变量:1.1.1 在Cython里定义一个C变量和C语言类似,不同的地方就是在声明的最前面要加上cdef,另外,末尾不用加分号”;“如:cdef int an[10]cdef int n = 123cdef int *pn = &nprintf(“%d \n”,pn[0])1.1.2 这里要注意的是,以Cython里不能用类似*ptr这样代码来对指针变
2016-09-28 16:49:56 439
转载 Cython(一)
1、 Ubuntu下安装apt-get install cython2 第一个例子:2.1 创建helloworld目录创建helloworld.pyx,内容如下:cdef extern from"stdio.h": extern int printf(const char *format, ...) def SayHello(): printf("hello,world\n")代
2016-09-28 16:44:22 650
原创 c++ randperm
void get_serial_random(int* serial_num,int num){ for(int i = 0; i < num; ++i){ serial_num[num] = num; } int j; int temp; for (int i = num; num > 1; --num){ j =
2016-09-24 13:26:24 1877
原创 caffe tensorflow 技术储备之protoc buffers
1、给经常使用的标签设置在1-15 As you can see, each field in the message definition has a unique numbered tag. These tags are used to identify your fields in the message binary format, and should not be changed o
2016-09-22 11:24:43 968
原创 tensorflow 技术储备之swig
简单的使用swigswig官网 安装swigsudo apt-get install swig首先我们写一个example.c 这里面就是我们要在python里面调用的c函数:#include <time.h>double My_variable = 3.0;int fact(int n){ if (n <= 1) return 1; else return n*fact(n-1);
2016-09-20 14:49:23 1528
原创 tensorflow(四)caffe-tensorflow学习记录
按照Lenet里面的例子进行模型和网络的转换:LeNet ExampleThanks to @Russell91 for this exampleThis example showns you how to finetune code from the Caffe MNIST tutorial using Tensorflow. First, you can convert a prototxt
2016-09-20 10:43:32 7207 2
原创 tensorflow(三) 模型保存
tensorflow最简单的保存与加载模型的方法是Saver对象(存放在tensorflow.train)。构造器给graph所有的变量,或者定义在列表中的变量,添加save和restore的操作,分别为保存和加载。变量保存在二进制的文件中,主要包含的是从变量名到tensor值的映射关系。保存变量 通过下面的一段代码穿件Saver对象来管理模型中的变量(默认情况下是所有的变量,也可以自行选择)。i
2016-09-19 20:44:07 13194
原创 tensorflow(二)学习记录
这个网络的结果是: input–>conv1–>relu–>maxpooling–>dropout–>conv2–>reul–>maxpooling –>dropout–>reshape–>innerproduct–>relu–>dropout–>innerproduct–>softmax_cross_entropy_with_logits pooling 和 convolution的strid
2016-09-19 11:18:28 2648
原创 tensorflow 基本概念
一、占位符 tf.placeholder(dtype, shape=None, name=None) 在使用 Session.run()之前,需要使用feed_dict对占位符进行操作。import tensorflow as tfimport numpy as npx = tf.placeholder(tf.float32, shape=(3,3))y = tf.matmul(x,x)
2016-09-18 21:46:17 1450
原创 python 简单socket编程
Servicefrom socket import *from time import ctimeHOST=''PORT=21567BUFSIZ=1024ADDR=(HOST, PORT)tcpSerSock = socket(AF_INET, SOCK_STREAM)tcpSerSock.bind(ADDR)tcpSerSock.listen(5)while True:
2016-09-18 15:49:34 469
原创 创建python的c扩展
为python创建扩展需要的3个步骤: 1、创建应用程序代码 2、利用模板包装源码 3、编译与测试 一、创建源码 递归求阶乘的函数fac()#include<stdio.h>int fac(int i){ if(i<2) return 1; else return i*fac(i-1);}二、用模板来包装的代码 分4个步骤 1、包含Python的头文件 2、为每个模板的每
2016-09-18 10:59:39 536
原创 cuda reduce学习
这个程序实现的是加法的并行运算:#include <stdio.h>#include <time.h>#include <stdlib.h>#include <cuda_runtime.h>__global__ void parallel_reduce_kernel(float* d_out, float* d_in){ int myID = threadIdx.x + blockI
2016-09-12 20:36:11 1275
原创 cuda 学习(三) Page-Locked Host Memory
一、cudaHostAlloc的使用#include <iostream>#include <numeric>#include <stdlib.h>__global__ void add1(float* input){ int idx = threadIdx.x; input[idx] += idx;}int main(void){ float* temp;
2016-09-08 20:14:17 1555
原创 caffe slice layer 学习
Slice layer 的作用是将bottom按照需要分解成多个tops。(与split layer的不一样在于spliit的作用是将bottom复制多份,输出到tops) 首先我们先看一下slice layer 在prototxt里面的书写layer { name: "slice" type: "Slice" bottom: "input" top: "output1" to
2016-09-05 14:26:17 19628 3
原创 caffe-yolo 训练
#include <algorithm>#include <cfloat>#include <vector>#include "thrust/device_vector.h"#include "caffe/layer.hpp"#include "caffe/layers/normalize_layer.hpp"#include "caffe/util/math_functions.hpp"n
2016-09-02 17:05:02 7894 29
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人