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

Function binaryMatrix

beginner_source/chatbot_tutorial.py:499–508  ·  view source on GitHub ↗
(l, value=PAD_token)

Source from the content-addressed store, hash-verified

497 return list(itertools.zip_longest(*l, fillvalue=fillvalue))
498
499def binaryMatrix(l, value=PAD_token):
500 m = []
501 for i, seq in enumerate(l):
502 m.append([])
503 for token in seq:
504 if token == PAD_token:
505 m[i].append(0)
506 else:
507 m[i].append(1)
508 return m
509
510# Returns padded input sequence tensor and lengths
511def inputVar(l, voc):

Callers 1

outputVarFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected