SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2207.01696 · ECCV · 2022

TM2T: Stochastic and Tokenized Modeling for the Reciprocal Generation of 3D Human Motions and Texts

Sen Wang, Chuan Guo, Li Cheng, Xinxin Zuo

arXiv · PDF · Open in the Atlas

Code that ran

5 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 1 failure of our instrument; 2 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2207.01696.json · badge: /api/ran/2207.01696.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
EricGuo5513/TM2T marked official in Papers with Code
Papers with Code archive
4 ran · 2 no recorded run
copy not recorded community
not in the paper's declared repositories
1 ran · 0 no recorded run
FunctionStatusWhere it lives
AttLayer Ran
ran on a synthesized input · constructed an object; no result was computed
EricGuo5513/TM2T/networks/modules.py
code served (permissive licence) · get_code("303be4aaa51b4ff2")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, AttLayer: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import numpy as np

torch.manual_seed(0)

# Define the AttLayer class and init_weight function
def init_weight(m):
    if isinstance(m, nn.Conv1d) or isinstance(m, nn.Linear) or isinstance(m, nn.ConvTranspose1d):
        nn.init.xavier_normal_(m.weight)
        if m.bias is not None:
            nn.init.constant_(m.bias, 0)

class AttLayer(nn.Module):

    def __init__(self, query_dim, key_dim, value_dim):
        super(AttLayer, self).__init__()
        self.W_q = nn.Linear(query_dim, value_dim)
        self.W_k = nn.Linear(key_dim, value_dim, bias=False)
        self.W_v = nn.Linear(key_dim, value_dim)
        self.softmax = nn.Softmax(dim=1)
        self.dim = value_dim
        self.W_q.apply(init_weight)
        self.W_k.apply(init_weight)
        self.W_v.apply(init_weight)

    def forward(self, query, key_mat):
        """
        query (batch, query_dim)
        key (batch, seq_len, key_dim)
        """
        query_vec = self.W_q(query).unsqueeze(-1)
        val_set = self.W_v(key_mat)
        key_set = self.W_k(key_mat)
        weights = torch.matmul(key_set, query_vec) / np.sqrt(self.dim)
        co_weights = self.softmax(weights)
        values = val_set * co_weights
        pred = values.sum(dim=1)
        return (pred, co_weights)

# Create arguments for AttLayer.__init__
query_dim = 4
key_dim = 3
value_dim = 5

ARGS = {
    'query_dim': query_dim,
    'key_dim': key_dim,
    'value_dim': value_dim
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type AttLayer — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a AttLayer output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
MotionEarlyAttDecoder Ran
ran on a synthesized input · constructed an object; no result was computed
EricGuo5513/TM2T/networks/modules.py
code served (permissive licence) · get_code("bc63067f9f9cb05f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, MotionEarlyAttDecoder: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import numpy as np

torch.manual_seed(0)

def init_weight(m):
    if isinstance(m, nn.Conv1d) or isinstance(m, nn.Linear) or isinstance(m, nn.ConvTranspose1d):
        nn.init.xavier_normal_(m.weight)
        if m.bias is not None:
            nn.init.constant_(m.bias, 0)

class AttLayer(nn.Module):

    def __init__(self, query_dim, key_dim, value_dim):
        super(AttLayer, self).__init__()
        self.W_q = nn.Linear(query_dim, value_dim)
        self.W_k = nn.Linear(key_dim, value_dim, bias=False)
        self.W_v = nn.Linear(key_dim, value_dim)
        self.softmax = nn.Softmax(dim=1)
        self.dim = value_dim
        self.W_q.apply(init_weight)
        self.W_k.apply(init_weight)
        self.W_v.apply(init_weight)

    def forward(self, query, key_mat):
        """
        query (batch, query_dim)
        key (batch, seq_len, key_dim)
        """
        query_vec = self.W_q(query).unsqueeze(-1)
        val_set = self.W_v(key_mat)
        key_set = self.W_k(key_mat)
        weights = torch.matmul(key_set, query_vec) / np.sqrt(self.dim)
        co_weights = self.softmax(weights)
        values = val_set * co_weights
        pred = values.sum(dim=1)
        return (pred, co_weights)

class MotionEarlyAttDecoder(nn.Module):

    def __init__(self, n_mot_vocab, init_hidden_size, hidden_size, n_layers, device):
        super(MotionEarlyAttDecoder, self).__init__()
        self.device = device
        self.input_emb = nn.Embedding(n_mot_vocab, hidden_size)
        self.n_layers = n_layers
        self.z2init = nn.Linear(init_hidden_size, hidden_size * n_layers)
        self.gru = nn.ModuleList([nn.GRUCell(hidden_size, hidden_size) for i in range(self.n_layers)])
        self.att_layer = AttLayer(hidden_size, init_hidden_size, hidden_size)
        self.att_linear = nn.Sequential(nn.Linear(hidden_size * 2, hidden_size), nn.LayerNorm(hidden_size), nn.LeakyReLU(0.2, inplace=True))
        self.trg_word_prj = nn.Linear(hidden_size, n_mot_vocab, bias=False)
        self.input_emb.apply(init_weight)
        self.z2init.apply(init_weight)
        self.att_layer.apply(init_weight)
        self.att_linear.apply(init_weight)
        self.hidden_size = hidden_size
        self.trg_word_prj.weight = self.input_emb.weight

    def get_init_hidden(self, latent):
        hidden = self.z2init(latent)
        hidden = torch.split(hidden, self.hidden_size, dim=-1)
        return list(hidden)

    def forward(self, src_output, inputs, hidden):
        h_in = self.input_emb(inputs)
        att_vec, _ = self.att_layer(hidden[-1], src_output)
        h_in = self.att_linear(torch.cat([att_vec, h_in], dim=-1))
        for i in range(self.n_layers):
            hidden[i] = self.gru[i](h_in, hidden[i])
            h_in = hidden[i]
        pred_probs = self.trg_word_prj(h_in)
        return (pred_probs, hidden)

n_mot_vocab = 10
init_hidden_size = 5
hidden_size = 4
n_layers = 2
device = 'cpu'

model = MotionEarlyAttDecoder(n_mot_vocab, init_hidden_size, hidden_size, n_layers, device)

batch_size = 2
seq_len = 3

src_output = torch.randn(batch_size, seq_len, init_hidden_size)
inputs = torch.randint(0, n_mot_vocab, (batch_size,))
latent = torch.randn(batch_size, init_hidden_size)
hidden = model.get_init_hidden(latent)

ARGS = {
    'n_mot_vocab': n_mot_vocab,
    'init_hidden_size': init_hidden_size,
    'hidden_size': hidden_size,
    'n_layers': n_layers,
    'device': device,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MotionEarlyAttDecoder — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MotionEarlyAttDecoder output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
MotionLateAttDecoder Ran
ran on a synthesized input · constructed an object; no result was computed
EricGuo5513/TM2T/networks/modules.py
code served (permissive licence) · get_code("a7469c6b1b58f36a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, MotionLateAttDecoder: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import numpy as np

torch.manual_seed(0)

class AttLayer(nn.Module):
    def __init__(self, query_dim, key_dim, value_dim):
        super(AttLayer, self).__init__()
        self.W_q = nn.Linear(query_dim, value_dim)
        self.W_k = nn.Linear(key_dim, value_dim, bias=False)
        self.W_v = nn.Linear(key_dim, value_dim)
        self.softmax = nn.Softmax(dim=1)
        self.dim = value_dim
        self.W_q.apply(init_weight)
        self.W_k.apply(init_weight)
        self.W_v.apply(init_weight)

    def forward(self, query, key_mat):
        query_vec = self.W_q(query).unsqueeze(-1)
        val_set = self.W_v(key_mat)
        key_set = self.W_k(key_mat)
        weights = torch.matmul(key_set, query_vec) / np.sqrt(self.dim)
        co_weights = self.softmax(weights)
        values = val_set * co_weights
        pred = values.sum(dim=1)
        return (pred, co_weights)

def init_weight(m):
    if isinstance(m, nn.Conv1d) or isinstance(m, nn.Linear) or isinstance(m, nn.ConvTranspose1d):
        nn.init.xavier_normal_(m.weight)
        if m.bias is not None:
            nn.init.constant_(m.bias, 0)

class MotionLateAttDecoder(nn.Module):
    def __init__(self, n_mot_vocab, init_hidden_size, hidden_size, n_layers, device):
        super(MotionLateAttDecoder, self).__init__()
        self.device = device
        self.input_emb = nn.Embedding(n_mot_vocab, hidden_size)
        self.n_layers = n_layers
        self.z2init = nn.Linear(init_hidden_size, hidden_size * n_layers)
        self.gru = nn.ModuleList([nn.GRUCell(hidden_size, hidden_size) for i in range(self.n_layers)])
        self.att_layer = AttLayer(hidden_size, init_hidden_size, hidden_size)
        self.att_linear = nn.Sequential(nn.Linear(hidden_size * 2, hidden_size), nn.LayerNorm(hidden_size), nn.LeakyReLU(0.2, inplace=True), nn.Linear(hidden_size, hidden_size))
        self.trg_word_prj = nn.Linear(hidden_size, n_mot_vocab, bias=False)
        self.input_emb.apply(init_weight)
        self.z2init.apply(init_weight)
        self.att_layer.apply(init_weight)
        self.att_linear.apply(init_weight)
        self.hidden_size = hidden_size
        self.trg_word_prj.weight = self.input_emb.weight

    def get_init_hidden(self, latent):
        hidden = self.z2init(latent)
        hidden = torch.split(hidden, self.hidden_size, dim=-1)
        return list(hidden)

    def forward(self, src_output, inputs, hidden):
        h_in = self.input_emb(inputs)
        for i in range(self.n_layers):
            hidden[i] = self.gru[i](h_in, hidden[i])
            h_in = hidden[i]
        att_vec, _ = self.att_layer(h_in, src_output)
        pred_probs = self.trg_word_prj(self.att_linear(torch.cat([att_vec, h_in], dim=-1)))
        return (pred_probs, hidden)

n_mot_vocab = 10
init_hidden_size = 5
hidden_size = 4
n_layers = 2
device = 'cpu'

decoder = MotionLateAttDecoder(
    n_mot_vocab=n_mot_vocab,
    init_hidden_size=init_hidden_size,
    hidden_size=hidden_size,
    n_layers=n_layers,
    device=device
)

batch_size = 2
seq_len = 3

src_output = torch.randn(batch_size, seq_len, init_hidden_size)
inputs = torch.randint(0, n_mot_vocab, (batch_size,))

latent = torch.randn(batch_size, init_hidden_size)
hidden = decoder.get_init_hidden(latent)

ARGS = {
    'n_mot_vocab': n_mot_vocab,
    'init_hidden_size': init_hidden_size,
    'hidden_size': hidden_size,
    'n_layers': n_layers,
    'device': device,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MotionLateAttDecoder — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MotionLateAttDecoder output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
TextEncoderBiGRU Ran
ran on a synthesized input
EricGuo5513/TM2T/networks/modules.py
code served (permissive licence) · get_code("b1963408ae788eed")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence

def init_weight(m):
    if isinstance(m, nn.Conv1d) or isinstance(m, nn.Linear) or isinstance(m, nn.ConvTranspose1d):
        nn.init.xavier_normal_(m.weight)
        if m.bias is not None:
            nn.init.constant_(m.bias, 0)

class TextEncoderBiGRU(nn.Module):

    def __init__(self, input_size, hidden_size, device):
        super(TextEncoderBiGRU, self).__init__()
        self.device = device
        self.input_emb = nn.Linear(input_size, hidden_size)
        self.gru = nn.GRU(hidden_size, hidden_size, batch_first=True, bidirectional=True)
        self.input_emb.apply(init_weight)
        self.hidden_size = hidden_size
        self.hidden = nn.Parameter(torch.randn((2, 1, self.hidden_size), requires_grad=True))

    def forward(self, inputs, m_lens):
        num_samples = inputs.shape[0]
        input_embs = self.input_emb(inputs)
        hidden = self.hidden.repeat(1, num_samples, 1)
        cap_lens = m_lens.data.tolist()
        emb = pack_padded_sequence(input_embs, cap_lens, batch_first=True)
        gru_seq, gru_last = self.gru(emb, hidden)
        gru_last = torch.cat([gru_last[0], gru_last[1]], dim=-1)
        gru_seq = pad_packed_sequence(gru_seq, batch_first=True)[0]
        forward_seq = gru_seq[..., :self.hidden_size]
        backward_seq = gru_seq[..., self.hidden_size:].clone()
        for i, length in enumerate(m_lens):
            backward_seq[i:i + 1, :length] = torch.flip(backward_seq[i:i + 1, :length].clone(), dims=[1])
        gru_seq = torch.cat([forward_seq, backward_seq], dim=-1)
        return (gru_seq, gru_last)


INIT_ARGS = {
    'input_size': 4,
    'hidden_size': 8,
    'device': 'cpu'
}

ARGS = {
    'inputs': torch.randn(2, 5, 4),
    'm_lens': torch.tensor([5, 3])
}

model = TextEncoderBiGRU(**INIT_ARGS)
output = model(**ARGS)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
top_k_logits Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from airi-institute/rate
pointer only · get_code("0f0021cdea13e4da")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

Seq2SeqText2MotModel Not yet run
unverified (harvested, no recorded run)
EricGuo5513/TM2T/networks/modules.py
code served (permissive licence) · get_code("f7bb2a229205b3ff")
How it ran

no invocation recorded.

init_weight Not yet run
unverified (harvested, no recorded run)
EricGuo5513/TM2T/networks/modules.py
code served (permissive licence) · get_code("6bf2e0fd4ffbf8ff")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 6 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
top_k_logits
brick of this paper's assembly: helper
16 other papers
5 dated earlier, 11 later
2104.07652 (2021-04)
Geometry-Free View Synthesis: Transformers and no 3D Priors
2106.02039 (2021-06)
Offline Reinforcement Learning as One Big Sequence Modeling Problem
2106.14131 (2021-06)
SymbolicGPT: A Generative Transformer Model for Symbolic Regression
and 13 more not named here

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Inspired by the strong ties between vision and language, the two intimate human sensing and communication modalities, our paper aims to explore the generation of 3D human full-body motions from texts, as well as its reciprocal task, shorthanded for text2motion and motion2text, respectively. To tackle the existing challenges, especially to enable the generation of multiple distinct motions from the same text, and to avoid the undesirable production of trivial motionless pose sequences, we propose the use of motion token, a discrete and compact motion representation. This provides one level playing ground when considering both motions and text signals, as the motion and text tokens, respectively. Moreover, our motion2text module is integrated into the inverse alignment process of our text2motion training pipeline, where a significant deviation of synthesized text from the input text would be penalized by a large training loss; empirically this is shown to effectively improve performance. Finally, the mappings in-between the two modalities of motions and texts are facilitated by adapting the neural model for machine translation (NMT) to our context. This autoregressive modeling of the distribution over discrete motion tokens further enables non-deterministic production of pose sequences, of variable lengths, from an input text. Our approach is flexible, could be used for both text2motion and motion2text tasks. Empirical evaluations on two benchmark datasets demonstrate the superior performance of our approach on both tasks over a variety of state-of-the-art methods. Project

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2207.01696")
get_code_for_paper("2207.01696")
have("2207.01696")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2207.01696.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2207.01696.svg)](https://syntology.ai/paper/2207.01696)

Connect an agent — have() is free.