chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:39:55 +08:00
commit 7ee4420c10
87 changed files with 15222 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
# coding:utf-8
from .main import *
+25
View File
@@ -0,0 +1,25 @@
# coding:utf-8
import numpy as np
def one_hot(y):
n_values = np.max(y) + 1
return np.eye(n_values)[y]
def batch_iterator(X, batch_size=64):
"""Splits X into equal sized chunks."""
n_samples = X.shape[0]
n_batches = n_samples // batch_size
batch_end = 0
for b in range(n_batches):
batch_begin = b * batch_size
batch_end = batch_begin + batch_size
X_batch = X[batch_begin:batch_end]
yield X_batch
if n_batches * batch_size < n_samples:
yield X[batch_end:]