Skip to content

Instantly share code, notes, and snippets.

View Ryu1845's full-sized avatar
🎯
Focusing

Sofian Mejjoute Ryu1845

🎯
Focusing
View GitHub Profile
@Ryu1845
Ryu1845 / split.py
Last active March 18, 2023 19:45 — forked from ptrblck/numpy split vs PyTorch split
numpy split vs PyTorch split
import torch
import numpy as np
# numpy
a = np.random.rand(10, 20)
tmp0 = np.split(a, indices_or_sections=5, axis=0) # split into 5 sections
for t in tmp0:
print(t.shape)
# (2, 20)
# (2, 20)