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

Method prepare_input

caffe2/python/rnn_cell.py:213–224  ·  view source on GitHub ↗

If some operations in _apply method depend only on the input, not on recurrent states, they could be computed in advance. model: ModelHelper object new operators would be added to input_blob: either the whole input sequence with shape (sequence_length, batc

(self, model, input_blob)

Source from the content-addressed store, hash-verified

211 raise NotImplementedError('Abstract method')
212
213 def prepare_input(self, model, input_blob):
214 '''
215 If some operations in _apply method depend only on the input,
216 not on recurrent states, they could be computed in advance.
217
218 model: ModelHelper object new operators would be added to
219
220 input_blob: either the whole input sequence with shape
221 (sequence_length, batch_size, input_dim) or a single input with shape
222 (1, batch_size, input_dim).
223 '''
224 return input_blob
225
226 def get_output_state_index(self):
227 '''

Callers 6

apply_over_sequenceMethod · 0.95
applyMethod · 0.95
prepare_inputMethod · 0.45
_applyMethod · 0.45
prepare_inputMethod · 0.45
apply_over_sequenceMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected