- 博客(21)
- 资源 (1)
- 问答 (1)
- 收藏
- 关注
原创 Python C api
文档: https://docs.python.org/3.7/extending/extending.html - Python到C 可以使用 PyArg_Parse 或 PyArg_ParseTuple 或 PyArg_ParseTupleAndKeywordsPyArg_ParseTuple(args, ""); //无参数,调用 f()PyArg_ParseTuple(arg...
2018-08-27 19:14:54
821
转载 C拓展Python
转载: http://www.sudu.cn/info/html/edu/20070101/283296.html 使用C/C++扩展Python如果你会用C,实现Python嵌入模块很简单。利用扩展模块可做很多Python不方便做的事情,他们可以直接调用C库和系统调用。为了支持扩展,Python API定义了一系列函数、宏和变量,提供了对Python运行时系统的访问支持。Python的C...
2018-08-27 18:50:56
322
转载 numpy 关于 array index的描述
An instance of class ndarray consists of a contiguous one-dimensional segment of computer memory (owned by the array, or by some other object), combined with an indexing scheme that maps N integers in...
2018-08-06 18:11:49
1368
转载 高效的多维空间点索引算法 — Geohash 和 Google S2
http://www.cocoachina.com/cms/wap.php?action=article&id=20309
2018-08-05 15:43:23
1002
原创 C 函数指针与回调函数示例
回调函数回调函数就是一个通过函数指针调用的函数。如果你把函数的指针(地址)作为参数传递给另一个函数,当这个指针被用来调用其所指向的函数时,我们就说这是回调函数。回调函数不是由该函数的实现方直接调用,而是在特定的事件或条件发生时由另外的一方调用的,用于对该事件或条件进行响应。创建三个文件,main.c,vendor.c,vendor.hMain.c是用户开发的Vendor.c和ven...
2018-08-04 21:17:09
198
原创 C 关于宏的一些笔记
FILE, LINE, #lineC语言中的FILE用以指示本行语句所在源文件的文件名. C语言中的LINE用以指示本行语句在源文件中的位置信息: printf("%d\n",__LINE__); 通过语句#line来重新设定LINE的值: #line 200 //指定下一行的__LINE__为200VA_ARGS在C99中规定宏也可以像函数一样带可变的参数,如: #def...
2018-07-31 11:24:52
163
原创 Numpy与Pytorch 矩阵操作
Numpy随机矩阵: np.random.randn(d0, d1, d2, ...)Pytorch随机矩阵: torch.randn(d0, d1, d2, ...)添加维度: tensor.unsqueeze(0)压缩维度: tensor.squeeze(0)按维度拼接tensor: torch.cat(inputs, dim=0, ...)维度堆叠: torch...
2018-07-30 10:23:04
15285
原创 Pytorch mask-rcnn 实现细节
DataLoaderDataset不能满足需求需自定义继承torch.utils.data.Dataset时需要override __init__, __getitem__, __len__ ,否则DataLoader导入自定义Dataset时缺少上述函数会导致NotImplementedError错误...
2018-07-23 20:31:34
5427
原创 python 一些有用的功能函数(持续更新)
打印二进制def bin_encode(s): return ' '.join([bin(ord(c)).replace('0b', '').rjust(8, '0') for c in s])
2017-10-26 14:58:28
283
原创 设置matplotlib 横坐标为毫秒
设置坐标为毫秒# coding: UTF-8import datetimeimport matplotlib.datesimport matplotlib.pyplotticklist = list()def gen_tick_items(tline): global ticklist itemlist = tline.split('|') item = dict()
2017-10-24 16:40:26
2243
转载 Linux 查看g++ 默认include路径
使用命令:`g++ -print-prog-name=cc1plus` -v结果:忽略不存在的目录“/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include-fixed”忽略不存在的目录“/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../x86_64-redhat-linux/include”#include
2017-10-20 17:13:35
7799
原创 python 内嵌C函数
安装python-devel.x86_64 # yum install python-devel.x86_64 测试用c程序 #include "/usr/include/python2.7/Python.h"int add(int a, int b){ return a + b;}PyObject* wrap_add(PyObject* self, PyObject* args
2017-09-22 14:24:36
1192
原创 MongoDB 安全控制角色说明
官方文档地址 MongoDB內建角色官方文档说明 注意点 本文基于MongoDB 3.4版本写这篇文档的目的 这篇文章仅合适像自己一样的MongoDB新手,自己在查阅此部分资料时发现网上大部分资料要不是版本过时要不就是有错误,因此决定查阅翻译官方文档部分内容,尽量保证内容正确性。 MongoDB 数据库內建角色的具体介绍及允许的操作详见官方文档 此处仅依据官
2017-09-02 14:54:17
347
原创 Centos 7 matplotlib 远程绘图
安装在Centos上安装xterm,xauth,xorg-x11-apps:#yum install xterm#yum install xauth#yum install xorg-x11-apps修改/etc/ssh/sshd_config 重启sshd.service 重启一个ssh连接 检测是否$DISPLAY变量设置成功 在wondows平台安装xming,默认xming运
2017-09-01 17:26:11
815
原创 pytorch tutorials运行
Error1 from PyQt5 import QtCore, QtGui, QtWidgets ImportError: libGL.so.1: cannot open shared object file: No such file or directory sovle: 安装: yum install mesa-libGL-develError2: in _create_qA
2017-08-30 02:09:04
669
MongoDB 权限 角色 详细说明
2017-08-24
opencv imshow()崩溃 急求救
2016-02-03
TA创建的收藏夹 TA关注的收藏夹
TA关注的人