MCPcopy Create free account
hub / github.com/pytorch/executorch / encode

Method encode

exir/tests/transformer.py:97–108  ·  view source on GitHub ↗
(self, src_tokens)

Source from the content-addressed store, hash-verified

95 ]
96
97 def encode(self, src_tokens):
98 # embed = self.token_embed_table(src_tokens) * self.embed_scale # fail in runtime because of lacking broadcasting
99 embed = self.token_embed_table(src_tokens)
100 # TODO: add the support for positional embedding
101
102 # BxTxC -> TxBxC
103 x = embed.transpose(0, 1)
104
105 for layer in self.encoder_layers:
106 x = layer(x)
107
108 return x
109
110 def get_random_inputs(self, method):
111 if method == "encode":

Callers 15

patch_alignmentFunction · 0.45
__init__Method · 0.45
_reduce_fake_tensorFunction · 0.45
serializeFunction · 0.45
serializeFunction · 0.45
saveFunction · 0.45
_hash_schemaFunction · 0.45
preprocessMethod · 0.45
run_inferenceFunction · 0.45

Calls

no outgoing calls

Tested by 5

__init__Method · 0.36
execute_layer_testMethod · 0.36
export_model_to_metalFunction · 0.36
_run_et_aotiFunction · 0.36