MCPcopy Create free account
hub / github.com/BindsNET/bindsnet / train

Method train

bindsnet/pipeline/dataloader_pipeline.py:48–70  ·  view source on GitHub ↗

Training loop that runs for the set number of epochs and creates a new ``DataLoader`` at each epoch.

(self)

Source from the content-addressed store, hash-verified

46 self.shuffle = kwargs.get("shuffle", True)
47
48 def train(self) -> None:
49 # language=rst
50 """
51 Training loop that runs for the set number of epochs and creates a new
52 ``DataLoader`` at each epoch.
53 """
54 for epoch in range(self.num_epochs):
55 train_dataloader = DataLoader(
56 self.train_ds,
57 batch_size=self.batch_size,
58 num_workers=self.num_workers,
59 pin_memory=self.pin_memory,
60 shuffle=self.shuffle,
61 )
62
63 for step, batch in enumerate(
64 tqdm(
65 train_dataloader,
66 desc="Epoch %d/%d" % (epoch + 1, self.num_epochs),
67 total=len(self.train_ds) // self.batch_size,
68 )
69 ):
70 self.step(batch)
71
72 def test(self) -> None:
73 raise NotImplementedError("You need to provide a test function.")

Callers

nothing calls this directly

Calls 2

DataLoaderClass · 0.90
stepMethod · 0.45

Tested by

no test coverage detected