Skip to content

Instantly share code, notes, and snippets.

View YaxuanDai's full-sized avatar

Yaxuan Dai YaxuanDai

View GitHub Profile
@YaxuanDai
YaxuanDai / findlib.sh
Created July 3, 2019 12:24
Keep calm and find some *.h in a large project.
#!/bin/bash
# Bash script for finding library file that contains a function or a class.
# Usage: findlib <library folder> <function/class name>
libs="$(ls $1/*.so)"
for lib in $libs; do
list="$(nm -D $lib)"
if [ "${list/$2}" != "$list" ]; then
echo $lib $2
@YaxuanDai
YaxuanDai / pytorch_utils.py
Created July 9, 2018 01:54
pytorch model profiler.
import torch
from torch.autograd import Variable
import torch.nn as nn
from graphviz import Digraph
class CNN(nn.Module):
def __init__(self):
super(CNN, self).__init__()