MCPcopy Create free account
hub / github.com/pytorch/pytorch / generate_batch

Function generate_batch

scripts/release_notes/classifier.py:254–263  ·  view source on GitHub ↗
(batch)

Source from the content-addressed store, hash-verified

252
253
254def generate_batch(batch):
255 title, files, author, category = zip(*batch)
256 title = list(title)
257 files = list(files)
258 author = list(author)
259 category = list(category)
260 targets = torch.tensor([common.categories.index(cat) for cat in category]).to(
261 device
262 )
263 return CommitClassifierInputs(title, files, author), targets
264
265
266def train_step(batch, model, optimizer, loss):

Callers 1

trainFunction · 0.85

Calls 5

listFunction · 0.85
toMethod · 0.45
tensorMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…