Pages

Transformer Lab

99

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

import math

import random

class CustomDataLoader:

def __init__(self, rows, batch_size, shuffle=True):

self.rows = rows

self.batch_size = batch_size

self.shuffle = shuffle

def __len__(self):

"""

Returns the number of batches.

"""

pass

def __iter__(self):

"""

Returns an iterator over paired source and target batches.

"""

pass

Case 1

Case 2

Case 3

rows =

batch_size =

shuffle =

true

false