Skip to content

Instantly share code, notes, and snippets.

Avatar
🌴
On vacation

RoachZhao roachsinai

🌴
On vacation
  • Shanghai
View GitHub Profile
View conv.cc
#include <assert.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <windows.h> // 各种位图数据结构
class Converter
{
public:
Converter() : pixels_(NULL), width_(0), height_(0) {}
@roachsinai
roachsinai / install-shadowsocks-ubuntu.sh
Last active Dec 10, 2020 — forked from tuxlinuxien/install-shadowsocks-ubuntu.sh
Shadowsocks installer for ubuntu 16.04
View install-shadowsocks-ubuntu.sh
#!/bin/sh
cd $HOME;
echo "Running apt-get update ..."
sudo apt-get update > /dev/null
echo "Install installing dependencies ..."
sudo apt-get install -y --no-install-recommends vim git gettext build-essential autoconf libtool libpcre3-dev asciidoc xmlto libev-dev libc-ares-dev automake libmbedtls-dev libsodium-dev > /dev/null
if [ -d "shadowsocks-libev" ]; then
echo -n;
@roachsinai
roachsinai / n.sh
Created Jul 15, 2020 — forked from dagelf/n.sh
Netspeed 2 - gets Linux network interface throughput speed from /proc/net/dev; busybox bash/awk/sed compatible, good for embedded OpenWRT or UBNT / Ubiquiti, etc routers
View n.sh
#!/bin/sh
# Copy the contents of this file to the clipboard, then get a terminal open on your device and enter:
# $ cat > n.sh
# [Ctrl+V] or Right Click, Paste. Then [Ctrl+D].
# chmod +x n.sh
# To run: ./n.sh eth0
SLP=1 # display / sleep interval
DEVICE=$1
IS_GOOD=0
for GOOD_DEVICE in `grep \: /proc/net/dev | awk -F: '{print $1}'`; do
@roachsinai
roachsinai / django-launch.json
Last active Apr 22, 2020 — forked from slaveofcode/django-launch.json
Sample Django Configuration launch.json VSCode (Visual Studio Code)
View django-launch.json
{
"version": "0.2.0",
"configurations": [
{
"label": "Django",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"pythonPath": "${workspaceRoot}/venv/bin/python3.4",
"program": "${workspaceRoot}/manage.py",
View CornerNet.prototxt
name: "cornernet"
input: "blob1"
input_dim: 1
input_dim: 3
input_dim: 511
input_dim: 511
layer {
name: "conv1"
type: "Convolution"
bottom: "blob1"
View yolov2.prototxt
name: "YOLONET"
layer {
name: "data"
type: "Input"
top: "data"
input_param { shape: { dim: 1 dim: 3 dim: 416 dim: 416 } }
}
layer {
name: "conv1"
type: "Convolution"
View ssd.prototxt
name: "VGG_coco_SSD_300x300_train"
layer {
name: "data"
type: "AnnotatedData"
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {
View internals2.md

WORK IN PROGRESS

PyTorch Internals Part II - The Build System

In the first post I explained how we generate a torch.Tensor object that you can use in your Python interpreter. Next, I will explore the build system for PyTorch. The PyTorch codebase has a variety of components:

  • The core Torch libraries: TH, THC, THNN, THCUNN
  • Vendor libraries: CuDNN, NCCL
  • Python Extension libraries
  • Additional third-party libraries: NumPy, MKL, LAPACK
View internals.md

A Tour of PyTorch Internals (Part I)

The fundamental unit in PyTorch is the Tensor. This post will serve as an overview for how we implement Tensors in PyTorch, such that the user can interact with it from the Python shell. In particular, we want to answer four main questions:

  1. How does PyTorch extend the Python interpreter to define a Tensor type that can be manipulated from Python code?
  2. How does PyTorch wrap the C libraries that actually define the Tensor's properties and methods?
  3. How does PyTorch cwrap work to generate code for Tensor methods?
  4. How does PyTorch's build system take all of these components to compile and generate a workable application?

Extending the Python Interpreter

PyTorch defines a new package torch. In this post we will consider the ._C module. This module is known as an "extension module" - a Python module written in C. Such modules allow us to define new built-in object types (e.g. the Tensor) and to call C/C++ functions.

@roachsinai
roachsinai / 1. setup nginx.txt
Created Nov 24, 2019 — forked from panchicore/1. setup nginx.txt
Use NGINX as webserver to deploy apps with python
View 1. setup nginx.txt
# install NGINX requirements
sudo apt-get install libpcre3-dev build-essential libssl-dev
# install NGINX
cd
mkdir src
cd src
wget http://nginx.org/download/nginx-1.4.5.tar.gz
tar xvf nginx-1.4.5.tar.gz
cd nginx-1.4.5