SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2205.01972 · NeurIPS · 2022

Sequencer: Deep LSTM for Image Classification

Yuki Tatsunami, Masato Taki

arXiv · PDF · Open in the Atlas

Code that ran

4 of 9 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 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; 0 failures of our instrument; 5 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/2205.01972.json · badge: /api/ran/2205.01972.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
okojoalg/sequencer canonical (classifier label)
classifier basis: classifier_2025
4 ran · 5 no recorded run
FunctionStatusWhere it lives
Downsample2D Ran
ran on a synthesized input
okojoalg/sequencer/models/two_dim_sequencer.py
code served (permissive licence) · get_code("71520c22fcd16235")
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 Tensor, ndim 4, dtype family float, shape (2, 4, 4, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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
from torch import nn

class Downsample2D(nn.Module):

    def __init__(self, input_dim, output_dim, patch_size):
        super().__init__()
        self.down = nn.Conv2d(input_dim, output_dim, kernel_size=patch_size, stride=patch_size)

    def forward(self, x):
        x = x.permute(0, 3, 1, 2)
        x = self.down(x)
        x = x.permute(0, 2, 3, 1)
        return x


INIT_ARGS = {
    'input_dim': 3,
    'output_dim': 4,
    'patch_size': 2,
}

ARGS = {
    'x': torch.randn(2, 8, 8, 3),
}

if __name__ == '__main__':
    model = Downsample2D(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Input shape: {ARGS['x'].shape}")
    print(f"Output shape: {output.shape}")
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 Tensor, ndim 4, dtype family float, shape (2, 4, 4, 4) — shape (2, 4, 4, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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)
PatchEmbed Ran
ran on a synthesized input
okojoalg/sequencer/models/two_dim_sequencer.py
code served (permissive licence) · get_code("d21dc0c3ff2326b2")
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 Tensor, ndim 3, dtype family float, shape (2, 16, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 timm.models.layers import PatchEmbed as TimmPatchEmbed

class PatchEmbed(TimmPatchEmbed):
    def forward(self, x):
        x = self.proj(x)
        if self.flatten:
            x = x.flatten(2).transpose(1, 2)
        else:
            x = x.permute(0, 2, 3, 1)
        x = self.norm(x)
        return x

INIT_ARGS = {
    'img_size': 8,
    'patch_size': 2,
    'in_chans': 3,
    'embed_dim': 4,
    'norm_layer': nn.LayerNorm,
}

ARGS = {
    'x': torch.randn(2, 3, 8, 8),
}

if __name__ == '__main__':
    model = PatchEmbed(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output: {output}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 16, 4) — shape (2, 16, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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)
RNN2DBase Ran
ran on a synthesized input
okojoalg/sequencer/models/two_dim_sequencer.py
code served (permissive licence) · get_code("b68d5c2770b76e3e")
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 Tensor, ndim 4, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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
from torch import nn
from typing import Tuple

class RNNIdentity(nn.Module):

    def __init__(self, *args, **kwargs):
        super(RNNIdentity, self).__init__()

    def forward(self, x):
        return (x, None)

class RNN2DBase(nn.Module):

    def __init__(self, input_size: int, hidden_size: int, num_layers: int=1, bias: bool=True, bidirectional: bool=True, union='cat', with_fc=True):
        super().__init__()
        self.input_size = input_size
        self.hidden_size = hidden_size
        self.output_size = 2 * hidden_size if bidirectional else hidden_size
        self.union = union
        self.with_vertical = True
        self.with_horizontal = True
        self.with_fc = with_fc
        if with_fc:
            if union == 'cat':
                self.fc = nn.Linear(2 * self.output_size, input_size)
            elif union == 'add':
                self.fc = nn.Linear(self.output_size, input_size)
            elif union == 'vertical':
                self.fc = nn.Linear(self.output_size, input_size)
                self.with_horizontal = False
            elif union == 'horizontal':
                self.fc = nn.Linear(self.output_size, input_size)
                self.with_vertical = False
            else:
                raise ValueError('Unrecognized union: ' + union)
        elif union == 'cat':
            pass
            if 2 * self.output_size != input_size:
                raise ValueError(f'The output channel {2 * self.output_size} is different from the input channel {input_size}.')
        elif union == 'add':
            pass
            if self.output_size != input_size:
                raise ValueError(f'The output channel {self.output_size} is different from the input channel {input_size}.')
        elif union == 'vertical':
            if self.output_size != input_size:
                raise ValueError(f'The output channel {self.output_size} is different from the input channel {input_size}.')
            self.with_horizontal = False
        elif union == 'horizontal':
            if self.output_size != input_size:
                raise ValueError(f'The output channel {self.output_size} is different from the input channel {input_size}.')
            self.with_vertical = False
        else:
            raise ValueError('Unrecognized union: ' + union)
        self.rnn_v = RNNIdentity()
        self.rnn_h = RNNIdentity()

    def forward(self, x):
        B, H, W, C = x.shape
        if self.with_vertical:
            v = x.permute(0, 2, 1, 3)
            v = v.reshape(-1, H, C)
            v, _ = self.rnn_v(v)
            v = v.reshape(B, W, H, -1)
            v = v.permute(0, 2, 1, 3)
        if self.with_horizontal:
            h = x.reshape(-1, W, C)
            h, _ = self.rnn_h(h)
            h = h.reshape(B, H, W, -1)
        if self.with_vertical and self.with_horizontal:
            if self.union == 'cat':
                x = torch.cat([v, h], dim=-1)
            else:
                x = v + h
        elif self.with_vertical:
            x = v
        elif self.with_horizontal:
            x = h
        if self.with_fc:
            x = self.fc(x)
        return x


INIT_ARGS = {
    'input_size': 8,
    'hidden_size': 4,
    'num_layers': 1,
    'bias': True,
    'bidirectional': True,
    'union': 'cat',
    'with_fc': True
}

ARGS = {
    'x': torch.randn(2, 3, 4, 8)
}

if __name__ == '__main__':
    model = RNN2DBase(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: (2, 3, 4, 8)")
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 Tensor, ndim 4, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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)
RNNIdentity Ran
ran on a synthesized input
okojoalg/sequencer/models/two_dim_sequencer.py
code served (permissive licence) · get_code("cee0eb3911fd1719")
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
from torch import nn, Tensor
from typing import Tuple

class RNNIdentity(nn.Module):

    def __init__(self, *args, **kwargs):
        super(RNNIdentity, self).__init__()

    def forward(self, x: Tensor) -> Tuple[Tensor, None]:
        return (x, None)


INIT_ARGS = {}

ARGS = {
    'x': torch.randn(2, 4, 3)
}

if __name__ == '__main__':
    model = RNNIdentity(**INIT_ARGS)
    output, hidden = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Hidden state: {hidden}")
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)
LSTM2D Not yet run
unverified (harvested, no recorded run)
okojoalg/sequencer/models/two_dim_sequencer.py
code served (permissive licence) · get_code("e5ad67deb204c7fb")
How it ran

no invocation recorded.

Sequencer2D Not yet run
unverified (harvested, no recorded run)
okojoalg/sequencer/models/two_dim_sequencer.py
code served (permissive licence) · get_code("07c6c53559ef34c9")
How it ran

no invocation recorded.

Sequencer2DBlock Not yet run
unverified (harvested, no recorded run)
okojoalg/sequencer/models/two_dim_sequencer.py
code served (permissive licence) · get_code("21b70a992bd5f441")
How it ran

no invocation recorded.

_init_weights Not yet run
unverified (harvested, no recorded run)
okojoalg/sequencer/models/two_dim_sequencer.py
code served (permissive licence) · get_code("58c0c12066377b33")
How it ran

no invocation recorded.

get_stage Not yet run
unverified (harvested, no recorded run)
okojoalg/sequencer/models/two_dim_sequencer.py
code served (permissive licence) · get_code("caa022d5744fcda0")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 9 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.

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

In recent computer vision research, the advent of the Vision Transformer (ViT) has rapidly revolutionized various architectural design efforts: ViT achieved stateof-the-art image classification performance using self-attention found in natural language processing, and MLP-Mixer achieved competitive performance using simple multi-layer perceptrons. In contrast, several studies have also suggested that carefully redesigned convolutional neural networks (CNNs) can achieve advanced performance comparable to ViT without resorting to these new ideas. Against this background, there is growing interest in what inductive bias is suitable for computer vision. Here we propose Sequencer, a novel and competitive architecture alternative to ViT that provides a new perspective on these issues. Unlike ViTs, Sequencer models long-range dependencies using LSTMs rather than self-attention layers. We also propose a two-dimensional version of Sequencer module, where an LSTM is decomposed into vertical and horizontal LSTMs to enhance performance. Despite its simplicity, several experiments demonstrate that Sequencer performs impressively well: Sequencer2D-L, with 54M parameters, realizes 84.6% top-1 accuracy on only ImageNet-1K. Not only that, we show that it has good transferability and the robust resolution adaptability on double resolution-band. Our source code is available at https://github.com/okojoalg/sequencer.

For agents

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

get_harvested_code_for_paper("2205.01972")
get_code_for_paper("2205.01972")
have("2205.01972")

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

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

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

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

Connect an agent — have() is free.