Skip to content

Instantly share code, notes, and snippets.

View chn-lee-yumi's full-sized avatar

YumiLee chn-lee-yumi

View GitHub Profile
@chn-lee-yumi
chn-lee-yumi / torch_dtype_check.py
Created April 29, 2025 07:10
Torch dtype Check
import importlib
import torch
def test_supported_dtypes(device):
dtypes = [
torch.bool,
torch.uint8,
torch.int8,
@chn-lee-yumi
chn-lee-yumi / torch_performance_test.py
Last active May 27, 2025 04:15
Torch Performance Test
import importlib
import time
import torch
def benchmark_dtype(dtype, device, size, repeat):
try:
# 创建两个张量
a = torch.randn((size, size), dtype=dtype, device=device)
@chn-lee-yumi
chn-lee-yumi / nprocnetdev.go
Created September 1, 2021 03:57
nprocnetdev.go: print /proc/net/dev via netlink socket
package main
// go version of https://gist.github.com/javiermon/43a0b9e1c07abd4b13df
import (
"log"
"github.com/jsimonetti/rtnetlink"
"fmt"
)