SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2203.09388 · CVPR · 2022

A Text Attention Network for Spatial Deformation Robust Scene Text Image Super-resolution

Lei Zhang, Jianqi Ma, Zhetong Liang

arXiv · PDF · Open in the Atlas

Code that ran

18 of 25 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (4 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 14 have no contract verdict; 4 failures of our instrument; 7 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/2203.09388.json · badge: /api/ran/2203.09388.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
mjq11302010044/TATT community
Papers with Code archive
14 ran · 5 no recorded run
zhaominyiz/c3-stisr community
Papers with Code archive
4 ran · 2 no recorded run
FunctionStatusWhere it lives
ConvEncoder Ran
ran on a synthesized input
mjq11302010044/TATT/model/transformerSR.py
code served (permissive licence) · get_code("72bca38f7becc86d")
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 list. 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

class ResidualBlock(nn.Module):

    def __init__(self, channels, res_channel, downsample=False):
        super(ResidualBlock, self).__init__()
        self.downsample = downsample
        if downsample:
            self.down_conv = nn.Conv2d(channels, res_channel, kernel_size=3, padding=1, stride=2)
        self.conv1 = nn.Conv2d(res_channel, res_channel, kernel_size=3, padding=1, stride=1)
        self.bn1 = nn.BatchNorm2d(res_channel)
        self.prelu = nn.PReLU()
        self.conv2 = nn.Conv2d(res_channel, res_channel, kernel_size=3, padding=1)
        self.bn2 = nn.BatchNorm2d(res_channel)

    def forward(self, x):
        if self.downsample:
            x = self.down_conv(x)
        residual = self.conv1(x)
        residual = self.bn1(residual)
        residual = self.prelu(residual)
        residual = self.conv2(residual)
        residual = self.bn2(residual)
        return x + residual

class ConvEncoder(nn.Module):

    def __init__(self, in_channel=4, out_channel=64):
        super(ConvEncoder, self).__init__()
        self.start_conv = nn.Conv2d(in_channel, 64, kernel_size=9, padding=4)
        self.relu = nn.PReLU()
        self.block1 = ResidualBlock(64, 64, downsample=False)
        self.block2 = ResidualBlock(64, out_channel, downsample=False)

    def forward(self, x):
        x = self.start_conv(x)
        x = self.relu(x)
        x1 = self.block1(x)
        x2 = self.block2(x1)
        return [x1, x2]

INIT_ARGS = {
    'in_channel': 4,
    'out_channel': 64
}

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

if __name__ == '__main__':
    model = ConvEncoder(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output type: {type(output)}")
    print(f"Output length: {len(output)}")
    print(f"Output[0] shape: {output[0].shape}")
    print(f"Output[1] shape: {output[1].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 list — a list 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)
GruBlock Ran
ran on a synthesized input · constructed an object; no result was computed
zhaominyiz/c3-stisr/model/c3.py
code served (permissive licence) · get_code("debb069fbbbe79b8")
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, GruBlock: 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

torch.manual_seed(0)

# GruBlock.__init__ takes in_channels and out_channels
# in_channels: int - number of input channels
# out_channels: int - number of output channels (must be even due to assert)

# GruBlock.forward expects:
# x: tensor of shape (batch, in_channels, height, width)
# The forward pass:
# 1. Applies Conv2d(in_channels, out_channels, kernel_size=1)
# 2. Permutes to (batch, height, width, out_channels)
# 3. Reshapes to (batch*height, width, out_channels)
# 4. Passes through GRU with input_size=out_channels, hidden_size=out_channels//2, bidirectional=True
# 5. Reshapes and permutes back

ARGS = {
    'in_channels': 3,
    'out_channels': 4,  # Must be even for the assert and bidirectional GRU
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type GruBlock — 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 GruBlock 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
PositionalEncoding Ran
ran on a synthesized input
mjq11302010044/TATT/model/transformerSR.py
code served (permissive licence) · get_code("b174887b7f685284")
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, 3, 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
import math
from torch.autograd import Variable

class PositionalEncoding(nn.Module):
    """Implement the PE function."""

    def __init__(self, d_model, dropout, max_len=5000):
        super(PositionalEncoding, self).__init__()
        self.dropout = nn.Dropout(p=dropout)
        pe = torch.zeros(max_len, d_model)
        position = torch.arange(0, max_len).unsqueeze(1).float()
        div_term = torch.exp(torch.arange(0, d_model, 2).float() * -(math.log(10000.0) / d_model))
        pe[:, 0::2] = torch.sin(position * div_term)
        pe[:, 1::2] = torch.cos(position * div_term)
        pe = pe.unsqueeze(0)
        self.register_buffer('pe', pe)

    def forward(self, x):
        x = x + Variable(self.pe[:, :x.size(1)], requires_grad=False).to(x.device)
        return self.dropout(x)


INIT_ARGS = {
    'd_model': 4,
    'dropout': 0.1,
    'max_len': 5000
}

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

if __name__ == '__main__':
    model = PositionalEncoding(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Input shape: {ARGS['x'].shape}")
    print(f"Output shape: {output.shape}")
    print(f"Output:\n{output}")
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 3, dtype family float, shape (2, 3, 4) — shape (2, 3, 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)
RecurrentResidualBlockTL Ran
ran on a synthesized input · constructed an object; no result was computed
zhaominyiz/c3-stisr/model/c3.py
code served (permissive licence) · get_code("12b4f9480b2c839e")
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, RecurrentResidualBlockTL: 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

torch.manual_seed(0)

# Build the arguments for RecurrentResidualBlockTL forward pass
# The forward method takes x (image tensor) and text_emb (text embedding tensor)

# Parameters for RecurrentResidualBlockTL.__init__:
# - channels: int (number of channels in the feature maps)
# - text_channels: int (number of channels in the text embedding)

channels = 8
text_channels = 4

# Create the model instance
model = nn.Module()

# We need to pass x and text_emb to forward()
# x should be: (batch, channels, height, width)
# text_emb should be: (batch, text_channels, height, width) based on cat operation

batch_size = 2
height = 3
width = 5

x = torch.randn(batch_size, channels, height, width)
text_emb = torch.randn(batch_size, text_channels, height, width)

ARGS = {
    'channels': channels,
    'text_channels': text_channels,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type RecurrentResidualBlockTL — 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 RecurrentResidualBlockTL 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
SRResConvDecoder Ran
ran on a synthesized input
mjq11302010044/TATT/model/transformerSR.py
code served (permissive licence) · get_code("35a157f73c775df0")
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, 3, 16, 20) 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
import torch.nn.functional as F

class UpsampleBLock(nn.Module):

    def __init__(self, in_channels, up_scale):
        super(UpsampleBLock, self).__init__()
        self.conv = nn.Conv2d(in_channels, in_channels * up_scale ** 2, kernel_size=3, padding=1)
        self.pixel_shuffle = nn.PixelShuffle(up_scale)
        self.prelu = nn.PReLU()

    def forward(self, x):
        x = self.conv(x)
        x = self.pixel_shuffle(x)
        x = self.prelu(x)
        return x

class SRResConvDecoder(nn.Module):

    def __init__(self, in_channel=64, out_channel=4, upsample_block_num=1):
        super(SRResConvDecoder, self).__init__()
        block8 = [UpsampleBLock(in_channel, 2) for _ in range(upsample_block_num)]
        block8.append(nn.Conv2d(in_channel, out_channel, kernel_size=9, padding=4))
        self.block8 = nn.Sequential(*block8)

    def forward(self, x):
        x = self.block8(x)
        return F.tanh(x)


INIT_ARGS = {
    'in_channel': 8,
    'out_channel': 3,
    'upsample_block_num': 2
}

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

if __name__ == '__main__':
    model = SRResConvDecoder(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output dtype: {output.dtype}")
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, 3, 16, 20) — shape (2, 3, 16, 20) 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)
TPSSpatialTransformer Ran
ran on a synthesized input
mjq11302010044/TATT/model/transformerSR.py
code served (permissive licence) · get_code("ad607f18cb194718")
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 numpy as np

# INIT_ARGS for TPSSpatialTransformer.__init__
INIT_ARGS = {
    'output_image_size': (32, 48),  # (height, width) - distinct dimensions
    'num_control_points': 20,  # must be even for the implementation
    'margins': (0.05, 0.05)  # (margin_x, margin_y)
}

# ARGS for TPSSpatialTransformer.forward
# Create a batch of input images and source control points
batch_size = 2
channels = 3
height, width = 32, 48  # Should match output_image_size for simplicity, but can differ
num_control_points = 20

# Input tensor: (batch_size, channels, height, width)
input_tensor = torch.randn(batch_size, channels, height, width)

# Source control points: (batch_size, num_control_points, 2)
# These should be in normalized [0, 1] coordinates
source_control_points = torch.rand(batch_size, num_control_points, 2)

ARGS = {
    'input': input_tensor,
    'source_control_points': source_control_points
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, 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)
TransformerDecoder Ran
ran on a synthesized input
mjq11302010044/TATT/model/transformerSR.py
code served (permissive licence) · get_code("709bb74fd9d3756c")
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
import math
import copy
from typing import Optional

def _get_clones(module, N):
    return nn.ModuleList([copy.deepcopy(module) for i in range(N)])

class TransformerDecoderLayer(nn.Module):
    def __init__(self, d_model, nhead, dim_feedforward=2048, dropout=0.1):
        super().__init__()
        self.self_attn = nn.MultiheadAttention(d_model, nhead, dropout=dropout, batch_first=True)
        self.multihead_attn = nn.MultiheadAttention(d_model, nhead, dropout=dropout, batch_first=True)
        self.linear1 = nn.Linear(d_model, dim_feedforward)
        self.dropout = nn.Dropout(dropout)
        self.linear2 = nn.Linear(dim_feedforward, d_model)
        self.norm1 = nn.LayerNorm(d_model)
        self.norm2 = nn.LayerNorm(d_model)
        self.norm3 = nn.LayerNorm(d_model)
        self.dropout1 = nn.Dropout(dropout)
        self.dropout2 = nn.Dropout(dropout)
        self.dropout3 = nn.Dropout(dropout)

    def forward(self, tgt, memory, tgt_mask=None, memory_mask=None, tgt_key_padding_mask=None, memory_key_padding_mask=None, pos=None, query_pos=None):
        tgt2, _ = self.self_attn(tgt, tgt, tgt, attn_mask=tgt_mask, key_padding_mask=tgt_key_padding_mask)
        tgt = tgt + self.dropout1(tgt2)
        tgt = self.norm1(tgt)
        
        tgt2, attn_weights = self.multihead_attn(tgt, memory, memory, attn_mask=memory_mask, key_padding_mask=memory_key_padding_mask)
        tgt = tgt + self.dropout2(tgt2)
        tgt = self.norm2(tgt)
        
        tgt2 = self.linear2(self.dropout(torch.relu(self.linear1(tgt))))
        tgt = tgt + self.dropout3(tgt2)
        tgt = self.norm3(tgt)
        
        return tgt, attn_weights

class TransformerDecoder(nn.Module):

    def __init__(self, decoder_layer, num_layers, norm=None, return_intermediate=False):
        super().__init__()
        self.layers = _get_clones(decoder_layer, num_layers)
        self.num_layers = num_layers
        self.norm = norm
        self.return_intermediate = return_intermediate

    def forward(self, tgt, memory, tgt_mask: Optional[torch.Tensor]=None, memory_mask: Optional[torch.Tensor]=None, tgt_key_padding_mask: Optional[torch.Tensor]=None, memory_key_padding_mask: Optional[torch.Tensor]=None, pos: Optional[torch.Tensor]=None, query_pos: Optional[torch.Tensor]=None, text_prior: Optional[torch.Tensor]=None):
        output = tgt
        intermediate = []
        attn_weights = None
        for layer in self.layers:
            output, attn_weights = layer(output, memory, tgt_mask=tgt_mask, memory_mask=memory_mask, tgt_key_padding_mask=tgt_key_padding_mask, memory_key_padding_mask=memory_key_padding_mask, pos=pos, query_pos=query_pos)
            if self.return_intermediate:
                intermediate.append(self.norm(output))
        if self.norm is not None:
            output = self.norm(output)
            if self.return_intermediate:
                intermediate.pop()
                intermediate.append(output)
        if self.return_intermediate:
            return (torch.stack(intermediate), attn_weights)
        return (output, attn_weights)

d_model = 4
nhead = 2
num_layers = 2
batch_size = 2
tgt_seq_len = 3
memory_seq_len = 5

decoder_layer = TransformerDecoderLayer(d_model=d_model, nhead=nhead, dim_feedforward=8, dropout=0.1)
norm = nn.LayerNorm(d_model)

INIT_ARGS = {
    'decoder_layer': decoder_layer,
    'num_layers': num_layers,
    'norm': norm,
    'return_intermediate': False
}

ARGS = {
    'tgt': torch.randn(batch_size, tgt_seq_len, d_model),
    'memory': torch.randn(batch_size, memory_seq_len, d_model),
    'tgt_mask': None,
    'memory_mask': None,
    'tgt_key_padding_mask': None,
    'memory_key_padding_mask': None,
    'pos': None,
    'query_pos': None,
    'text_prior': None
}
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)
TransformerDecoderLayer Ran
ran on a synthesized input
mjq11302010044/TATT/model/transformerSR.py
code served (permissive licence) · get_code("fc38364146e4b3a4")
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
import torch.nn.functional as F
from typing import Optional
from torch import Tensor

def _get_activation_fn(activation):
    """Return an activation function given a string"""
    if activation == 'relu':
        return F.relu
    if activation == 'gelu':
        return F.gelu
    if activation == 'glu':
        return F.glu
    raise RuntimeError(f'activation should be relu/gelu, not {activation}.')

class TransformerDecoderLayer(nn.Module):

    def __init__(self, d_model, nhead, dim_feedforward=2048, dropout=0.1, activation='relu', normalize_before=False):
        super().__init__()
        self.self_attn = nn.MultiheadAttention(d_model, nhead, dropout=dropout)
        self.multihead_attn = nn.MultiheadAttention(d_model, nhead, dropout=dropout)
        self.linear1 = nn.Linear(d_model, dim_feedforward)
        self.dropout = nn.Dropout(dropout)
        self.linear2 = nn.Linear(dim_feedforward, d_model)
        self.norm1 = nn.LayerNorm(d_model)
        self.norm2 = nn.LayerNorm(d_model)
        self.norm3 = nn.LayerNorm(d_model)
        self.dropout1 = nn.Dropout(dropout)
        self.dropout2 = nn.Dropout(dropout)
        self.dropout3 = nn.Dropout(dropout)
        self.activation = _get_activation_fn(activation)
        self.normalize_before = normalize_before

    def with_pos_embed(self, tensor, pos: Optional[Tensor]):
        return tensor if pos is None else tensor + pos

    def forward_post(self, tgt, memory, tgt_mask: Optional[Tensor]=None, memory_mask: Optional[Tensor]=None, tgt_key_padding_mask: Optional[Tensor]=None, memory_key_padding_mask: Optional[Tensor]=None, pos: Optional[Tensor]=None, query_pos: Optional[Tensor]=None):
        q = k = self.with_pos_embed(tgt, query_pos)
        tgt2 = self.self_attn(q, k, value=tgt, attn_mask=tgt_mask, key_padding_mask=tgt_key_padding_mask)[0]
        tgt = tgt + self.dropout1(tgt2)
        tgt = self.norm1(tgt)
        tgt2, attn_weights = self.multihead_attn(query=self.with_pos_embed(tgt, query_pos), key=self.with_pos_embed(memory, pos), value=memory, attn_mask=memory_mask, key_padding_mask=memory_key_padding_mask)
        tgt = tgt + self.dropout2(tgt2)
        tgt = self.norm2(tgt)
        tgt2 = self.linear2(self.dropout(self.activation(self.linear1(tgt))))
        tgt = tgt + self.dropout3(tgt2)
        tgt = self.norm3(tgt)
        return (tgt, attn_weights)

    def forward_pre(self, tgt, memory, tgt_mask: Optional[Tensor]=None, memory_mask: Optional[Tensor]=None, tgt_key_padding_mask: Optional[Tensor]=None, memory_key_padding_mask: Optional[Tensor]=None, pos: Optional[Tensor]=None, query_pos: Optional[Tensor]=None):
        tgt2 = self.norm1(tgt)
        q = k = self.with_pos_embed(tgt2, query_pos)
        tgt2 = self.self_attn(q, k, value=tgt2, attn_mask=tgt_mask, key_padding_mask=tgt_key_padding_mask)[0]
        tgt = tgt + self.dropout1(tgt2)
        tgt2 = self.norm2(tgt)
        tgt2 = self.multihead_attn(query=self.with_pos_embed(tgt2, query_pos), key=self.with_pos_embed(memory, pos), value=memory, attn_mask=memory_mask, key_padding_mask=memory_key_padding_mask)[0]
        tgt = tgt + self.dropout2(tgt2)
        tgt2 = self.norm3(tgt)
        tgt2 = self.linear2(self.dropout(self.activation(self.linear1(tgt2))))
        tgt = tgt + self.dropout3(tgt2)
        return tgt

    def forward(self, tgt, memory, tgt_mask: Optional[Tensor]=None, memory_mask: Optional[Tensor]=None, tgt_key_padding_mask: Optional[Tensor]=None, memory_key_padding_mask: Optional[Tensor]=None, pos: Optional[Tensor]=None, query_pos: Optional[Tensor]=None):
        if self.normalize_before:
            return self.forward_pre(tgt, memory, tgt_mask, memory_mask, tgt_key_padding_mask, memory_key_padding_mask, pos, query_pos)
        return self.forward_post(tgt, memory, tgt_mask, memory_mask, tgt_key_padding_mask, memory_key_padding_mask, pos, query_pos)


INIT_ARGS = {
    'd_model': 4,
    'nhead': 2,
    'dim_feedforward': 8,
    'dropout': 0.1,
    'activation': 'relu',
    'normalize_before': False,
}

ARGS = {
    'tgt': torch.randn(3, 2, 4),
    'memory': torch.randn(5, 2, 4),
    'tgt_mask': None,
    'memory_mask': None,
    'tgt_key_padding_mask': None,
    'memory_key_padding_mask': None,
    'pos': None,
    'query_pos': None,
}

if __name__ == '__main__':
    layer = TransformerDecoderLayer(**INIT_ARGS)
    output = layer(**ARGS)
    print(f"Output type: {type(output)}")
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)
TransformerDecoderLayer_TP Ran
ran on a synthesized input
mjq11302010044/TATT/model/transformerSR.py
code served (permissive licence) · get_code("61cf3075977a65fb")
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
import torch.nn.functional as F
from typing import Optional
from torch import Tensor

def _get_activation_fn(activation):
    """Return an activation function given a string"""
    if activation == 'relu':
        return F.relu
    if activation == 'gelu':
        return F.gelu
    if activation == 'glu':
        return F.glu
    raise RuntimeError(f'activation should be relu/gelu, not {activation}.')

class TransformerDecoderLayer_TP(nn.Module):

    def __init__(self, d_model, nhead, dim_feedforward=2048, dropout=0.1, activation='relu', normalize_before=False):
        super().__init__()
        self.d_model_self = 1024
        self.d_model = d_model
        self.height = 16
        self.width = 64
        self.self_attn = nn.MultiheadAttention(self.d_model, nhead, dropout=dropout)
        self.multihead_attn = nn.MultiheadAttention(self.d_model, nhead, dropout=dropout)
        self.linear1 = nn.Linear(d_model, dim_feedforward)
        self.dropout = nn.Dropout(dropout)
        self.linear2 = nn.Linear(dim_feedforward, d_model)
        self.norm1 = nn.LayerNorm(d_model)
        self.norm2 = nn.LayerNorm(d_model)
        self.norm3 = nn.LayerNorm(d_model)
        self.dropout1 = nn.Dropout(dropout)
        self.dropout2 = nn.Dropout(dropout)
        self.dropout3 = nn.Dropout(dropout)
        self.activation = _get_activation_fn(activation)
        self.normalize_before = normalize_before

    def with_pos_embed(self, tensor, pos: Optional[Tensor]):
        return tensor if pos is None else tensor + pos

    def forward_post(self, tgt, memory, tgt_mask: Optional[Tensor]=None, memory_mask: Optional[Tensor]=None, tgt_key_padding_mask: Optional[Tensor]=None, memory_key_padding_mask: Optional[Tensor]=None, pos: Optional[Tensor]=None, query_pos: Optional[Tensor]=None):
        q = k = self.with_pos_embed(tgt, query_pos)
        tgt2, attn_weights = self.multihead_attn(self.with_pos_embed(tgt, query_pos), self.with_pos_embed(memory, pos), memory, attn_mask=memory_mask, key_padding_mask=memory_key_padding_mask)
        tgt = tgt + self.dropout2(tgt2)
        tgt = self.norm2(tgt)
        tgt2 = self.linear2(self.dropout(self.activation(self.linear1(tgt))))
        tgt = tgt + self.dropout3(tgt2)
        tgt = self.norm3(tgt)
        return (tgt, attn_weights)

    def forward_pre(self, tgt, memory, tgt_mask: Optional[Tensor]=None, memory_mask: Optional[Tensor]=None, tgt_key_padding_mask: Optional[Tensor]=None, memory_key_padding_mask: Optional[Tensor]=None, pos: Optional[Tensor]=None, query_pos: Optional[Tensor]=None):
        tgt2 = self.norm1(tgt)
        q = k = self.with_pos_embed(tgt2, query_pos)
        tgt2 = self.self_attn(q, k, value=tgt2, attn_mask=tgt_mask, key_padding_mask=tgt_key_padding_mask)[0]
        tgt = tgt + self.dropout1(tgt2)
        tgt2 = self.norm2(tgt)
        tgt2 = self.multihead_attn(query=self.with_pos_embed(tgt2, query_pos), key=self.with_pos_embed(memory, pos), value=memory, attn_mask=memory_mask, key_padding_mask=memory_key_padding_mask)[0]
        tgt = tgt + self.dropout2(tgt2)
        tgt2 = self.norm3(tgt)
        tgt2 = self.linear2(self.dropout(self.activation(self.linear1(tgt2))))
        tgt = tgt + self.dropout3(tgt2)
        return tgt

    def forward(self, tgt, memory, tgt_mask: Optional[Tensor]=None, memory_mask: Optional[Tensor]=None, tgt_key_padding_mask: Optional[Tensor]=None, memory_key_padding_mask: Optional[Tensor]=None, pos: Optional[Tensor]=None, query_pos: Optional[Tensor]=None):
        if self.normalize_before:
            return self.forward_pre(tgt, memory, tgt_mask, memory_mask, tgt_key_padding_mask, memory_key_padding_mask, pos, query_pos)
        return self.forward_post(tgt, memory, tgt_mask, memory_mask, tgt_key_padding_mask, memory_key_padding_mask, pos, query_pos)


INIT_ARGS = {
    'd_model': 8,
    'nhead': 2,
    'dim_feedforward': 32,
    'dropout': 0.1,
    'activation': 'relu',
    'normalize_before': False,
}

ARGS = {
    'tgt': torch.randn(3, 2, 8),
    'memory': torch.randn(5, 2, 8),
    'tgt_mask': None,
    'memory_mask': None,
    'tgt_key_padding_mask': None,
    'memory_key_padding_mask': None,
    'pos': None,
    'query_pos': None,
}

if __name__ == '__main__':
    model = TransformerDecoderLayer_TP(**INIT_ARGS)
    output = model(**ARGS)
    print("Output type:", type(output))
    print("Output shapes:", output[0].shape, output[1].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 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)
TransformerEncoder Ran
ran on a synthesized input
mjq11302010044/TATT/model/transformerSR.py
code served (permissive licence) · get_code("362e18db540151f7")
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, 3, 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
import math
import copy
from typing import Optional

def _get_clones(module, N):
    return nn.ModuleList([copy.deepcopy(module) for i in range(N)])

class TransformerEncoderLayer(nn.Module):
    def __init__(self, d_model, nhead, dim_feedforward=2048, dropout=0.1):
        super().__init__()
        self.self_attn = nn.MultiheadAttention(d_model, nhead, dropout=dropout, batch_first=True)
        self.linear1 = nn.Linear(d_model, dim_feedforward)
        self.dropout = nn.Dropout(dropout)
        self.linear2 = nn.Linear(dim_feedforward, d_model)
        self.norm1 = nn.LayerNorm(d_model)
        self.norm2 = nn.LayerNorm(d_model)
        self.dropout1 = nn.Dropout(dropout)
        self.dropout2 = nn.Dropout(dropout)

    def forward(self, src, src_mask=None, src_key_padding_mask=None, pos=None):
        x = src
        x = self.norm1(x + self._sa_block(x, src_mask, src_key_padding_mask))
        x = self.norm2(x + self._ff_block(x))
        return x

    def _sa_block(self, x, attn_mask, key_padding_mask):
        x = self.self_attn(x, x, x, attn_mask=attn_mask, key_padding_mask=key_padding_mask, need_weights=False)[0]
        return self.dropout1(x)

    def _ff_block(self, x):
        x = self.linear2(self.dropout(torch.relu(self.linear1(x))))
        return self.dropout2(x)

class TransformerEncoder(nn.Module):

    def __init__(self, encoder_layer, num_layers, norm=None):
        super().__init__()
        self.layers = _get_clones(encoder_layer, num_layers)
        self.num_layers = num_layers
        self.norm = norm

    def forward(self, src, mask: Optional[torch.Tensor]=None, src_key_padding_mask: Optional[torch.Tensor]=None, pos: Optional[torch.Tensor]=None):
        if type(src) == list:
            output = src[-1]
        else:
            output = src
        i = 0
        for layer in self.layers:
            if type(src) == list:
                src_item = src[i]
                i += 1
            else:
                src_item = src
            output = layer(output + src_item, src_mask=mask, src_key_padding_mask=src_key_padding_mask, pos=pos)
        if self.norm is not None:
            output = self.norm(output)
        return output


d_model = 4
nhead = 2
num_layers = 2
batch_size = 2
seq_len = 3

encoder_layer = TransformerEncoderLayer(d_model=d_model, nhead=nhead, dim_feedforward=8, dropout=0.1)
norm_layer = nn.LayerNorm(d_model)

INIT_ARGS = {
    'encoder_layer': encoder_layer,
    'num_layers': num_layers,
    'norm': norm_layer
}

src = torch.randn(batch_size, seq_len, d_model)

ARGS = {
    'src': src,
    'mask': None,
    'src_key_padding_mask': None,
    'pos': None
}

if __name__ == '__main__':
    encoder = TransformerEncoder(**INIT_ARGS)
    output = encoder(**ARGS)
    print("Output shape:", output.shape)
    print("Output:", output)
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 3, dtype family float, shape (2, 3, 4) — shape (2, 3, 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)
TransformerEncoderLayer Ran
ran on a synthesized input
mjq11302010044/TATT/model/transformerSR.py
code served (permissive licence) · get_code("5d4de4fe8da8b3bc")
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 (3, 2, 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
import torch.nn.functional as F
from typing import Optional
from torch import Tensor

def _get_activation_fn(activation):
    """Return an activation function given a string"""
    if activation == 'relu':
        return F.relu
    if activation == 'gelu':
        return F.gelu
    if activation == 'glu':
        return F.glu
    raise RuntimeError(f'activation should be relu/gelu, not {activation}.')

class TransformerEncoderLayer(nn.Module):

    def __init__(self, d_model, nhead, dim_feedforward=2048, dropout=0.1, activation='relu', normalize_before=False):
        super().__init__()
        self.self_attn = nn.MultiheadAttention(d_model, nhead, dropout=dropout)
        self.linear1 = nn.Linear(d_model, dim_feedforward)
        self.dropout = nn.Dropout(dropout)
        self.linear2 = nn.Linear(dim_feedforward, d_model)
        self.norm1 = nn.LayerNorm(d_model)
        self.norm2 = nn.LayerNorm(d_model)
        self.dropout1 = nn.Dropout(dropout)
        self.dropout2 = nn.Dropout(dropout)
        self.activation = _get_activation_fn(activation)
        self.normalize_before = normalize_before

    def with_pos_embed(self, tensor, pos: Optional[Tensor]):
        return tensor if pos is None else tensor + pos

    def forward_post(self, src, src_mask: Optional[Tensor]=None, src_key_padding_mask: Optional[Tensor]=None, pos: Optional[Tensor]=None):
        q = k = self.with_pos_embed(src, pos)
        src2 = self.self_attn(q, k, src, attn_mask=src_mask, key_padding_mask=src_key_padding_mask)[0]
        src = src + self.dropout1(src2)
        src = self.norm1(src)
        src2 = self.linear2(self.dropout(self.activation(self.linear1(src))))
        src = src + self.dropout2(src2)
        src = self.norm2(src)
        return src

    def forward_pre(self, src, src_mask: Optional[Tensor]=None, src_key_padding_mask: Optional[Tensor]=None, pos: Optional[Tensor]=None):
        src2 = self.norm1(src)
        q = k = self.with_pos_embed(src2, pos)
        src2 = self.self_attn(q, k, value=src2, attn_mask=src_mask, key_padding_mask=src_key_padding_mask)[0]
        src = src + self.dropout1(src2)
        src2 = self.norm2(src)
        src2 = self.linear2(self.dropout(self.activation(self.linear1(src2))))
        src = src + self.dropout2(src2)
        return src

    def forward(self, src, src_mask: Optional[Tensor]=None, src_key_padding_mask: Optional[Tensor]=None, pos: Optional[Tensor]=None):
        if self.normalize_before:
            return self.forward_pre(src, src_mask, src_key_padding_mask, pos)
        return self.forward_post(src, src_mask, src_key_padding_mask, pos)


INIT_ARGS = {
    'd_model': 4,
    'nhead': 2,
    'dim_feedforward': 8,
    'dropout': 0.1,
    'activation': 'relu',
    'normalize_before': False,
}

ARGS = {
    'src': torch.randn(3, 2, 4),
    'src_mask': None,
    'src_key_padding_mask': None,
    'pos': None,
}

if __name__ == '__main__':
    layer = TransformerEncoderLayer(**INIT_ARGS)
    output = layer(**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
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 (3, 2, 4) — shape (3, 2, 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)
UpsampleBLock Ran
ran on a synthesized input · constructed an object; no result was computed
zhaominyiz/c3-stisr/model/c3.py
code served (permissive licence) · get_code("2d273b67edeabc41")
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, UpsampleBLock: 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

torch.manual_seed(0)

# The UpsampleBLock constructor takes:
# - in_channels: int, number of input channels
# - up_scale: int, upsampling scale factor

ARGS = {
    "in_channels": 4,
    "up_scale": 2,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type UpsampleBLock — 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 UpsampleBLock 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
UpsampleBLock Ran
ran on a synthesized input
mjq11302010044/TATT/model/transformerSR.py
code served (permissive licence) · get_code("9c3f0411c3daa744")
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, 16, 16) 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

INIT_ARGS = {
    'in_channels': 4,
    'up_scale': 2,
}

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

if __name__ == '__main__':
    block = nn.UpsampleBlock(**INIT_ARGS)
    output = block(**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, 16, 16) — shape (2, 4, 16, 16) 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)
_get_clones Ran
ran; our contract draft was wrong, not the code
mjq11302010044/TATT/model/transformerSR.py
code served (permissive licence) · get_code("c011ff5da6d9bcf3")
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) and returned ModuleList. 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 math
import copy

torch.manual_seed(0)

# Create a simple nn.Module to use as the module parameter
class SimpleModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Define arguments for _get_clones
module = SimpleModule()
N = 5

ARGS = {
    "module": module,
    "N": N
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ModuleList — a ModuleList output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ModuleList output the recorded ndim 1 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
build_output_control_points Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
mjq11302010044/TATT/model/transformerSR.py
code served (permissive licence) · get_code("e148691b723e906e")
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) and returned Tensor, ndim 2, dtype family float, shape (8, 2) 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 numpy as np

torch.manual_seed(0)

ARGS = {
    "num_control_points": 8,
    "margins": (0.1, 0.15)
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (8, 2) — shape (8, 2) 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: none by the harness; any seed is in the setup block
conv3x3_block Ran
ran; our contract draft was wrong, not the code
mjq11302010044/TATT/model/transformerSR.py
code served (permissive licence) · get_code("eaa30ce1342b3853")
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) and returned Sequential. 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

torch.manual_seed(0)

ARGS = {
    "in_planes": 3,
    "out_planes": 64,
    "stride": 1,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential output the recorded ndim 1 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
grid_sample Ran
ran; our contract draft was wrong, not the code
mjq11302010044/TATT/model/transformerSR.py
code served (permissive licence) · get_code("47ad53774f24d324")
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 Tensor, ndim 4, dtype family float, shape (2, 4, 3, 3) 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.functional as F

torch.manual_seed(0)

# Create a small input tensor (batch=2, channels=4, height=3, width=3)
input_tensor = torch.randn(2, 4, 3, 3)

# Create a grid tensor for grid_sample
# Grid should have shape (batch, height, width, 2) with values in [-1, 1]
grid = torch.zeros(2, 3, 3, 2)
grid[..., 0] = torch.linspace(-1, 1, 3).view(1, 1, 3)
grid[..., 1] = torch.linspace(-1, 1, 3).view(1, 3, 1)

# Create a canvas tensor (same shape as expected output from grid_sample)
canvas = torch.randn(2, 4, 3, 3)

ARGS = {
    "input": input_tensor,
    "grid": grid,
    "canvas": canvas
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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, 3, 3) — shape (2, 4, 3, 3) 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: none by the harness; any seed is in the setup block
mish Ran
ran on a synthesized input · constructed an object; no result was computed
zhaominyiz/c3-stisr/model/c3.py
code served (permissive licence) · get_code("2bc017e584227198")
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, mish: 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

torch.manual_seed(0)

# Create a small tensor to use as input
# The mish module's forward method expects a tensor x
# It performs operations: x * torch.tanh(F.softplus(x))
x = torch.randn(2, 4)

ARGS = {
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type mish — 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 mish 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
InfoGenTrans Not yet run
unverified (harvested, no recorded run)
mjq11302010044/TATT/model/transformerSR.py
code served (permissive licence) · get_code("d907bd3a32007ddd")
How it ran

no invocation recorded.

InfoTransformer Not yet run
unverified (harvested, no recorded run)
mjq11302010044/TATT/model/transformerSR.py
code served (permissive licence) · get_code("a66d691bbfa01975")
How it ran

no invocation recorded.

ResidualBlock Not yet run
unverified (harvested, no recorded run)
mjq11302010044/TATT/model/transformerSR.py
code served (permissive licence) · get_code("ffea63c58c2f8eb8")
How it ran

no invocation recorded.

SRTransformer_V4 Not yet run
unverified (harvested, no recorded run)
mjq11302010044/TATT/model/transformerSR.py
code served (permissive licence) · get_code("297be0ef27a83aa1")
How it ran

no invocation recorded.

STNHead Not yet run
unverified (harvested, no recorded run)
mjq11302010044/TATT/model/transformerSR.py
code served (permissive licence) · get_code("b518b64e684e26e2")
How it ran

no invocation recorded.

TPInterpreter Not yet run
unverified (harvested, no recorded run)
zhaominyiz/c3-stisr/model/c3.py
code served (permissive licence) · get_code("532bb6dd349eb8fe")
How it ran

no invocation recorded.

TSRN_TL_TRANS Not yet run
unverified (harvested, no recorded run)
zhaominyiz/c3-stisr/model/c3.py
code served (permissive licence) · get_code("7764f17a0b0cf401")
How it ran

no invocation recorded.

Also present in other papers' code

Of 25 samples lifted from this paper's linked repositories, 25 carry a function identity and 0 do not. Of the 25 distinct functions with an identity, 4 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 1 the same month, 4 later) and 21 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
_get_clones
brick of this paper's assembly: helper
73 other papers
19 dated earlier, 5 the same month, 49 later · 59 only as an assembly brick
1706.03762 (2017-06)
Attention Is All You Need
2005.12872 (2020-05)
End-to-End Object Detection with Transformers
2010.04159 (2020-10)
Deformable DETR: Deformable Transformers for End-to-End Object Detection
and 70 more not named here
conv3x3_block
brick of this paper's assembly: helper
3 other papers
1 dated earlier, 2 later
2112.08171 (2021-12)
Text Gestalt: Stroke-Aware Scene Text Image Super-Resolution
2307.09749 (2023-07)
Towards Robust Scene Text Image Super-resolution via Explicit Location Enhancement
build_output_control_points
brick of this paper's assembly: helper
2 other papers
2 later
2307.09749 (2023-07)
Towards Robust Scene Text Image Super-resolution via Explicit Location Enhancement
grid_sample
brick of this paper's assembly: helper
2 other papers
2 later
2307.09749 (2023-07)
Towards Robust Scene Text Image Super-resolution via Explicit Location Enhancement

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

Scene text image super-resolution aims to increase the resolution and readability of the text in low-resolution images. Though significant improvement has been achieved by deep convolutional neural networks (CNNs), it remains difficult to reconstruct high-resolution images for spatially deformed texts, especially rotated and curve-shaped ones. This is because the current CNN-based methods adopt locality-based operations, which are not effective to deal with the variation caused by deformations. In this paper, we propose a CNN based Text ATTention network (TATT) to address this problem. The semantics of the text are firstly extracted by a text recognition module as text prior information. Then we design a novel transformer-based module, which leverages global attention mechanism, to exert the semantic guidance of text prior to the text reconstruction process. In addition, we propose a text structure consistency loss to refine the visual appearance by imposing structural consistency on the reconstructions of regular and deformed texts. Experiments on the benchmark TextZoom dataset show that the proposed TATT not only achieves state-ofthe-art performance in terms of PSNR/SSIM metrics, but also significantly improves the recognition accuracy in the downstream text recognition task, particularly for text instances with multi-orientation and curved shapes. Code is available at https://github.com/mjq11302010044/TATT.

For agents

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

get_harvested_code_for_paper("2203.09388")
get_code_for_paper("2203.09388")
have("2203.09388")

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

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

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

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

Connect an agent — have() is free.