上一页 1 2 3 4 5 6 7 8 9 10 ··· 19 下一页

2019年7月9日

ARTS-S c++调用pytorch接口

摘要: 想跑通第1个参考资料上讲的例子,一定要注意gcc和gperftools的版本.因为LibTorch用了c++17的over aligned新特性. centos默认的gcc是4.8.5不支持这个新特性,直接用会一直报Attempt to free invalid pointer 0xxxxxx Ab 阅读全文

posted @ 2019-07-09 23:08 荷楠仁 阅读(451) 评论(0) 推荐(0)

2019年7月8日

ARTS-S pytorch中Conv2d函数padding和stride含义

摘要: padding是输入数据最边缘补0的个数,默认是0,即不补0. stride是进行一次卷积后,特征图滑动几格,默认是1,即滑动一格. 阅读全文

posted @ 2019-07-08 21:51 荷楠仁 阅读(2926) 评论(0) 推荐(0)

2019年7月7日

ARTS-S 获取子线程返回值注意事项

摘要: 最后打印的fp的值和第一个线程中初始化的不一样。第一个线程中结构体是个局部变量,函数返回,内存被回收。所以在主线程中就不能访问fp的值。如果想在主线程中获取子线程的值,就要用malloc初始化。 阅读全文

posted @ 2019-07-07 22:11 荷楠仁 阅读(179) 评论(0) 推荐(0)

2019年7月6日

ARTS-S C语言主线程获取子线程返回值

摘要: 可用于主线程等子线程完成. 阅读全文

posted @ 2019-07-06 21:42 荷楠仁 阅读(727) 评论(0) 推荐(0)

2019年7月4日

ARTS-S C语言多线程传参数

摘要: ``` include include include include void thread_func(void arg){ int a = (int )arg; printf("tid=%lu,a=%d\n", pthread_self(), a); return ((void )0); } i 阅读全文

posted @ 2019-07-04 15:12 荷楠仁 阅读(239) 评论(0) 推荐(0)

2019年7月3日

ARTS-S golang panic返回默认值

摘要: ``` package main import "fmt" func fn_test_panic() (a int) { a = 2 panic("This is panic") return a } func fn1() (a int) { a = 3 defer func(){ if p := recover(); p != nil { fmt.Println("re... 阅读全文

posted @ 2019-07-03 10:53 荷楠仁 阅读(262) 评论(0) 推荐(0)

2019年6月28日

ARTS-S shell脚本实现循环

摘要: ``` !/bin/bash i=0 while [ "$i" != "100" ] && [ "$RESP" != "200" ] do i=$(($i+1)) echo $i RESP= done 虽然很简单,大家不要笑.稍微加一点修改就能实现服务可用时再跑单元测试. 阅读全文

posted @ 2019-06-28 21:55 荷楠仁 阅读(162) 评论(0) 推荐(0)

2019年6月14日

ARTS-S pytorch中backward函数的gradient参数作用

摘要: 导数偏导数的数学定义 参考资料1和2中对导数偏导数的定义都非常明确.导数和偏导数都是函数对自变量而言.从数学定义上讲,求导或者求偏导只有函数对自变量,其余任何情况都是错的.但是很多机器学习的资料和开源库都涉及到标量对向量求导.比如下面这个pytorch的例子. import torch x = to 阅读全文

posted @ 2019-06-14 14:38 荷楠仁 阅读(6256) 评论(5) 推荐(12)

2019年6月6日

ARTS-S python抽象方法抽象类

摘要: ``` # coding: utf-8 from abc import ABC, abstractmethod class AbstractClassExample(ABC): def __init__(self, value): self.value = value super().__init__() @abstractmethod ... 阅读全文

posted @ 2019-06-06 16:42 荷楠仁 阅读(121) 评论(0) 推荐(0)

2019年5月31日

ARTS-S cmake,googletest使用

摘要: 编译gtest 下载指定tag的源代码 编译 正常情况在当前目录下能生成libgtest.a 测试是否成功 如果看到测试结果所是OK,说明是成功的. 复制libgtest.a到/usr/local/lib 放到这个目录里gcc和cmake能默认找到 安装cmake 参考官方文档. 测试工程 要注意的 阅读全文

posted @ 2019-05-31 16:15 荷楠仁 阅读(295) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 9 10 ··· 19 下一页

导航