MCPcopy Index your code
hub / github.com/pytorch/tutorials / outputVar

Function outputVar

beginner_source/chatbot_tutorial.py:519–526  ·  view source on GitHub ↗
(l, voc)

Source from the content-addressed store, hash-verified

517
518# Returns padded target sequence tensor, padding mask, and max target length
519def outputVar(l, voc):
520 indexes_batch = [indexesFromSentence(voc, sentence) for sentence in l]
521 max_target_len = max([len(indexes) for indexes in indexes_batch])
522 padList = zeroPadding(indexes_batch)
523 mask = binaryMatrix(padList)
524 mask = torch.BoolTensor(mask)
525 padVar = torch.LongTensor(padList)
526 return padVar, mask, max_target_len
527
528# Returns all items for a given batch of pairs
529def batch2TrainData(voc, pair_batch):

Callers 1

batch2TrainDataFunction · 0.85

Calls 3

zeroPaddingFunction · 0.85
binaryMatrixFunction · 0.85
indexesFromSentenceFunction · 0.70

Tested by

no test coverage detected