MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / prepare_input_sequence

Function prepare_input_sequence

demo/Tacotron2/inference.py:147–162  ·  view source on GitHub ↗
(texts, cpu_run=False)

Source from the content-addressed store, hash-verified

145
146
147def prepare_input_sequence(texts, cpu_run=False):
148
149 d = []
150 for i,text in enumerate(texts):
151 d.append(torch.IntTensor(
152 text_to_sequence(text, ['english_cleaners'])[:]))
153
154 text_padded, input_lengths = pad_sequences(d)
155 if not cpu_run:
156 text_padded = text_padded.cuda().long()
157 input_lengths = input_lengths.cuda().long()
158 else:
159 text_padded = text_padded.long()
160 input_lengths = input_lengths.long()
161
162 return text_padded, input_lengths
163
164
165class MeasureTime():

Callers 5

mainFunction · 0.90
mainFunction · 0.90
test_inferenceFunction · 0.90
mainFunction · 0.90
mainFunction · 0.85

Calls 3

text_to_sequenceFunction · 0.90
pad_sequencesFunction · 0.85
appendMethod · 0.45

Tested by 3

mainFunction · 0.72
test_inferenceFunction · 0.72
mainFunction · 0.72