Skip to content

Instantly share code, notes, and snippets.

View raven38's full-sized avatar

raven raven38

View GitHub Profile
fruits = ['apple', 'banana', 'grape']
for fruit in fruits:
print(fruit)
from chainer import cuda
from chainer import function
from chainer.utils import type_check
import numpy as np
import cupy as cp
def _kern():
return cuda.elementwise(
'T cond, T x, T slope', 'T y',
@raven38
raven38 / noglobal.py
Created December 6, 2020 08:23 — forked from yoshipon/noglobal.py
Useful Noglobal in Python
# License:
# I hereby state this snippet is below "threshold of originality" where applicable (public domain).
#
# Otherwise, since initially posted on Stackoverflow, use as:
# CC-BY-SA 3.0 skyking, Glenn Maynard, Axel Huebl
# http://stackoverflow.com/a/31047259/2719194
# http://stackoverflow.com/a/4858123/2719194
import builtins
import types
@raven38
raven38 / Brewfile
Last active May 30, 2022 15:45
Brewfile
tap "golangci/tap"
tap "gromgit/fuse"
tap "grpc/grpc"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/core"
tap "kyoshidajp/ghkw"
tap "px4/px4"
brew "a2ps"
brew "arp-scan"
import torch
import torch.optim as optim
import numpy as np
import cv2 # Ground truth生成や比較でのRodrigues変換に一部使用
from scipy.spatial.transform import Rotation as R_scipy # Ground truthの回転生成用
# PyTorchによるRodriguesの公式(回転ベクトルから回転行列へ)
def rodrigues_pytorch(rvecs_batch):
"""
Rodriguesの公式を用いて、回転ベクトルのバッチを回転行列のバッチに変換します。