Skip to content

Instantly share code, notes, and snippets.

@jerry73204
jerry73204 / PKGBUILD
Created July 23, 2019 18:42
patched PKGBUILD python-pytorch
# By defauly the PKGBUILD produces combinations of python-pytorch{,-opt}{,-cuda}
# Comment out some sections yourself to choose your build.
# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>
# Contributor: Stephen Zhang <zsrkmyn at gmail dot com>
pkgbase="python-pytorch"
pkgname=(# "python-pytorch" "python-pytorch-opt" "python-pytorch-cuda"
"python-pytorch-opt-cuda")
_pkgname="pytorch"
@jerry73204
jerry73204 / fix-opt-memory.patch
Created July 23, 2019 18:45
The patch to fix pytorch-1.1 memory leak
diff --git a/torch/csrc/api/src/optim/adagrad.cpp b/torch/csrc/api/src/optim/adagrad.cpp
index 96b9af2bcd..e5da19b8d3 100644
--- a/torch/csrc/api/src/optim/adagrad.cpp
+++ b/torch/csrc/api/src/optim/adagrad.cpp
@@ -24,6 +24,7 @@ void Adagrad::step() {
}
if (options.weight_decay_ > 0) {
+ NoGradGuard guard;
p.grad() = p.grad() + options.weight_decay_ * p;
@jerry73204
jerry73204 / actix-kafka-example.rs
Created July 27, 2019 11:55
rdkafka integration with actix example
use actix::prelude::*;
use failure::Fallible;
use rdkafka::{
consumer::stream_consumer::StreamConsumer,
message::OwnedMessage,
Message,
};
pub struct MsgConsumer {
consumer: &'static StreamConsumer,
@jerry73204
jerry73204 / typed-arithmetic-infer-demo.rs
Created September 18, 2019 06:36
demo for tch-rs #112
use std::{
marker::PhantomData,
ops::{Add, Shl},
};
use typenum::{consts::*, Double, Sum, Unsigned};
pub struct Tensor<Size>
where
Size: Unsigned,
{
@jerry73204
jerry73204 / rust_trait_recursion_test.rs
Created September 30, 2019 10:27
Rusts trait recursion test: trait recursion vs functor trait recursion
use std::marker::PhantomData;
/* Counter def, used to distinguish termination and non-termination step */
/// counter trait
pub trait Counter {}
/// End of counter
pub struct Current;
use typenum::{Bit, Integer, NInt, NonZero, PInt, UInt, UTerm, Unsigned, Z0};
pub trait ToUnsigned<Output> {
fn to_unsigned() -> Output;
}
pub trait ToSigned<Output> {
fn to_signed() -> Output;
}
@jerry73204
jerry73204 / rabbit@b77781af981404f5edf109710db50d7e8631ea6a.log
Created November 24, 2019 06:22
rabbitmq log for `queue 'detectron_detector' in vhost '/' process is stopped by supervisor`
2019-11-24 03:44:20.534 [info] <0.651.5> accepting AMQP connection <0.651.5> (127.0.0.1:49752 -> 127.0.0.1:5672)
2019-11-24 03:44:20.534 [info] <0.654.5> accepting AMQP connection <0.654.5> (127.0.0.1:49754 -> 127.0.0.1:5672)
2019-11-24 03:44:20.535 [info] <0.657.5> accepting AMQP connection <0.657.5> (127.0.0.1:49756 -> 127.0.0.1:5672)
2019-11-24 03:44:20.579 [info] <0.654.5> connection <0.654.5> (127.0.0.1:49754 -> 127.0.0.1:5672): user 'guest' authenticated and granted access to vhost '/'
2019-11-24 03:44:20.579 [info] <0.651.5> connection <0.651.5> (127.0.0.1:49752 -> 127.0.0.1:5672): user 'guest' authenticated and granted access to vhost '/'
2019-11-24 03:44:20.579 [info] <0.657.5> connection <0.657.5> (127.0.0.1:49756 -> 127.0.0.1:5672): user 'guest' authenticated and granted access to vhost '/'
2019-11-24 03:44:22.134 [info] <0.687.5> accepting AMQP connection <0.687.5> (127.0.0.1:49760 -> 127.0.0.1:5672)
2019-11-24 03:44:22.136 [info] <0.687.5> connection <0.687.5> (127.0.0.1:49760 -> 127.0.0.1:5672):
cc -Wl,--as-needed -Wl,-z,noexecstack -m64 -L /home/aeon/.rustup/toolchains/nightly-2019-12-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib /mnt/ssd1/aeon/repos/wayside-portal/web/target/release/deps/wayside_web-9502d6d2c490caab.wayside_web.9eajdlu3-cgu.0.rcgu.o /mnt/ssd1/aeon/repos/wayside-portal/web/target/release/deps/wayside_web-9502d6d2c490caab.wayside_web.9eajdlu3-cgu.1.rcgu.o /mnt/ssd1/aeon/repos/wayside-portal/web/target/release/deps/wayside_web-9502d6d2c490caab.wayside_web.9eajdlu3-cgu.10.rcgu.o /mnt/ssd1/aeon/repos/wayside-portal/web/target/release/deps/wayside_web-9502d6d2c490caab.wayside_web.9eajdlu3-cgu.11.rcgu.o /mnt/ssd1/aeon/repos/wayside-portal/web/target/release/deps/wayside_web-9502d6d2c490caab.wayside_web.9eajdlu3-cgu.12.rcgu.o /mnt/ssd1/aeon/repos/wayside-portal/web/target/release/deps/wayside_web-9502d6d2c490caab.wayside_web.9eajdlu3-cgu.13.rcgu.o /mnt/ssd1/aeon/repos/wayside-portal/web/target/release/deps/wayside_web-9502d6d2c490caab.wayside_web.9eajdlu3-cgu.14.rcgu
GNU ld (GNU Binutils for Ubuntu) 2.30
Supported emulations:
elf_x86_64
elf32_x86_64
elf_i386
elf_iamcu
i386linux
elf_l1om
elf_k1om
i386pep
# Package Information for pkg-config
prefix=/opt/opencv4.2.0
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir_old=${prefix}/include/opencv4/opencv
includedir_new=${prefix}/include/opencv4
Name: OpenCV
Description: Open Source Computer Vision Library