MCPcopy Create free account
hub / github.com/DingLei14/WiCoNet / seprate_batch

Function seprate_batch

utils/utils.py:66–77  ·  view source on GitHub ↗

Yields lists by batch

(dataset, batch_size)

Source from the content-addressed store, hash-verified

64 yield b
65
66def seprate_batch(dataset, batch_size):
67 """Yields lists by batch"""
68 num_batch = len(dataset)//batch_size+1
69 batch_len = batch_size
70 # print (len(data))
71 # print (num_batch)
72 batches = []
73 for i in range(num_batch):
74 batches.append([dataset[j] for j in range(batch_len)])
75 # print('current data index: %d' %(i*batch_size+batch_len))
76 if (i+2==num_batch): batch_len = len(dataset)-(num_batch-1)*batch_size
77 return(batches)
78
79def split_train_val(dataset, val_percent=0.05):
80 dataset = list(dataset)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected