MCPcopy
hub / github.com/OpenMotionLab/MotionGPT / encode

Method encode

mGPT/archs/mgpt_vq.py:89–104  ·  view source on GitHub ↗
(
        self,
        features: Tensor,
    )

Source from the content-addressed store, hash-verified

87 return x_out, loss, perplexity
88
89 def encode(
90 self,
91 features: Tensor,
92 ) -> Union[Tensor, Distribution]:
93
94 N, T, _ = features.shape
95 x_in = self.preprocess(features)
96 x_encoder = self.encoder(x_in)
97 x_encoder = self.postprocess(x_encoder)
98 x_encoder = x_encoder.contiguous().view(-1,
99 x_encoder.shape[-1]) # (NT, C)
100 code_idx = self.quantizer.quantize(x_encoder)
101 code_idx = code_idx.view(N, -1)
102
103 # latent, dist
104 return code_idx, None
105
106 def decode(self, z: Tensor):
107

Callers 6

load_motionFunction · 0.80
load_example_inputFunction · 0.80
val_m2t_forwardMethod · 0.80
val_m2m_forwardMethod · 0.80
val_vae_forwardMethod · 0.80
mainFunction · 0.80

Calls 3

preprocessMethod · 0.95
postprocessMethod · 0.95
quantizeMethod · 0.45

Tested by

no test coverage detected