SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2206.00888 · NeurIPS · 2022

Squeezeformer: An Efficient Transformer for Automatic Speech Recognition

Kurt Keutzer, Michael Mahoney, Jitendra Malik, Sehoon Kim, Amir Gholami, Albert Shaw, Nicholas Lee, Karttikeya Mangalam

arXiv · PDF · Open in the Atlas

Code that ran

31 of 49 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (12 of them constructed an object rather than computing a result; 3 honoured the contract we drafted, 0 violated it and 25 have no contract verdict; 3 failures of our instrument; 18 no recorded run), measured 2026-11-23; 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/2206.00888.json · badge: /api/ran/2206.00888.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
upskyy/Squeezeformer reimplementation (classifier label)
classifier basis: classifier_2025
14 ran · 4 no recorded run
msalhab96/SpeeQ community
Papers with Code archive
12 ran · 4 no recorded run
kssteven418/squeezeformer marked official in Papers with Code
Papers with Code archive
5 ran · 10 no recorded run
FunctionStatusWhere it lives
AddAndNorm Ran
ran on a synthesized input
msalhab96/SpeeQ/speeq/models/encoders.py
code served (permissive licence) · get_code("17b0a7a2343ae12d")
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
from torch import nn, Tensor

class AddAndNorm(nn.Module):
    """Implements the Add and Norm module of the transformer model as described
    in the paper https://arxiv.org/abs/1706.03762

    Args:

        d_model (int): The model dimensionality.

    """

    def __init__(self, d_model: int) -> None:
        super().__init__()
        self.lnorm = nn.LayerNorm(normalized_shape=d_model)

    def forward(self, x: Tensor, sub_x: Tensor) -> Tensor:
        """takes the output tensor `x` from the last layer and the output tensor
        `sub_x` from the sub-layer, adds them, and then normalizes the sum
        using layer normalization.

        Args:
            x (Tensor): The output tensor of the last layer with shape [B, M, d].

            sub_x (Tensor): The output tensor of the sub-layer with shape
            [B, M, d].

        Returns:
            Tensor: The result tensor obtained after normalizing the sum of
            the inputs with shape [B, M, d].

        """
        return self.lnorm(x + sub_x)


INIT_ARGS = {
    "d_model": 4
}

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

if __name__ == "__main__":
    module = AddAndNorm(**INIT_ARGS)
    output = module(**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)
ConformerConvModule Ran
ran on a synthesized input
msalhab96/SpeeQ/speeq/models/encoders.py
code served (permissive licence) · get_code("ac9fc9672ce1f61d")
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, 5, 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, Tensor

class ConformerConvModule(nn.Module):
    """Implements the conformer convolution module
    as described in https://arxiv.org/abs/2005.08100

    Args:

        d_model (int): The model dimension.

        kernel_size (int): The depth-wise convolution kernel size.

        p_dropout (float): The dropout rate.
    """

    def __init__(self, d_model: int, kernel_size: int, p_dropout: float) -> None:
        super().__init__()
        self.lnorm = nn.LayerNorm(normalized_shape=d_model)
        self.pwise_conv1 = nn.Conv1d(in_channels=d_model, out_channels=2 * d_model, kernel_size=1)
        self.act1 = nn.GLU(dim=1)
        self.dwise_conv = nn.Conv1d(in_channels=d_model, out_channels=d_model, kernel_size=kernel_size, groups=d_model, padding='same')
        self.bnorm = nn.BatchNorm1d(num_features=d_model)
        self.act2 = nn.SiLU()
        self.pwise_conv2 = nn.Conv1d(in_channels=d_model, out_channels=d_model, kernel_size=1)
        self.dropout = nn.Dropout(p_dropout)

    def forward(self, x: Tensor) -> Tensor:
        """
        Passes the input tensor through the Conformer Convolutional Module.

        Args:
            x (Tensor): Input tensor of shape [B, M, d].

        Returns:
            Tensor: Result tensor of shape [B, M, d].
        """
        out = self.lnorm(x)
        out = out.transpose(-1, -2)
        out = self.pwise_conv1(out)
        out = self.act1(out)
        out = self.dwise_conv(out)
        out = self.bnorm(out)
        out = self.act2(out)
        out = self.pwise_conv2(out)
        out = self.dropout(out)
        out = out.transpose(-1, -2)
        return out


INIT_ARGS = {
    'd_model': 4,
    'kernel_size': 3,
    'p_dropout': 0.1,
}

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

if __name__ == '__main__':
    module = ConformerConvModule(**INIT_ARGS)
    module.eval()
    output = module(**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, 5, 4) — shape (2, 5, 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)
ConformerFeedForward Ran
ran on a synthesized input
msalhab96/SpeeQ/speeq/models/encoders.py
code served (permissive licence) · get_code("e8be6862875569ea")
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
from torch import nn, Tensor

class ConformerFeedForward(nn.Module):
    """Implements the feed-forward module used in Conformer models
    as described in https://arxiv.org/abs/2005.08100

    Args:
        d_model (int): The input feature dimensionality.

        expansion_factor (int): The expansion factor used by the linear layer.

        p_dropout (float): The dropout rate.
    """

    def __init__(self, d_model: int, expansion_factor: int, p_dropout: float) -> None:
        super().__init__()
        self.lnrom = nn.LayerNorm(normalized_shape=d_model)
        self.fc1 = nn.Linear(in_features=d_model, out_features=expansion_factor * d_model)
        self.fc2 = nn.Linear(in_features=expansion_factor * d_model, out_features=d_model)
        self.swish = nn.SiLU()
        self.dropout = nn.Dropout(p_dropout)

    def forward(self, x: Tensor) -> Tensor:
        """Passes the input x through the conformer feed-forward module.

        Args:
            x (Tensor): The input tensor of shape [B, M, d].

        Returns:
            Tensor: The output tensor of shape [B, M, d].
        """
        out = self.lnrom(x)
        out = self.fc1(out)
        out = self.swish(out)
        out = self.dropout(out)
        out = self.fc2(out)
        out = self.dropout(out)
        return out


INIT_ARGS = {
    "d_model": 4,
    "expansion_factor": 2,
    "p_dropout": 0.1,
}

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

if __name__ == "__main__":
    model = ConformerFeedForward(**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)
Conv1DLayers Ran
ran on a synthesized input
msalhab96/SpeeQ/speeq/models/encoders.py
code served (permissive licence) · get_code("4a641fcb9f0a3313")
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 List, Union

def calc_data_len(result_len: int, pad_len: Union[Tensor, int], data_len: Union[Tensor, int], kernel_size: int, stride: int) -> Union[Tensor, int]:
    """Calculates the new data portion size after applying convolution on a padded tensor"""
    if type(pad_len) != type(data_len):
        raise ValueError(f'expected both pad_len and data_len to be of the same type\n            but {type(pad_len)}, and {type(data_len)} passed')
    inp_len = data_len + pad_len
    new_pad_len = 0
    convolved_pad_mask = pad_len >= kernel_size
    unconvolved = (inp_len - kernel_size) % stride
    undiscarded_pad_mask = unconvolved < pad_len
    convolved = pad_len - unconvolved
    new_pad_len = (convolved - kernel_size) // stride + 1
    new_pad_len *= convolved_pad_mask
    new_pad_len *= undiscarded_pad_mask
    return result_len - new_pad_len

class Conv1DLayers(nn.Module):
    """Implements stack of Conv1d layers."""

    def __init__(self, in_size: int, out_size: Union[List[int], int], kernel_size: Union[List[int], int], stride: Union[List[int], int], n_layers: int, p_dropout: float, groups: Union[List[int], int]=1, activation: nn.Module=None) -> None:
        super().__init__()
        self.layers = nn.ModuleList()
        _kernel_size = kernel_size
        _stride = stride
        _groups = groups
        for i in range(n_layers):
            in_channels = out_size
            if i == 0:
                in_channels = in_size
            elif isinstance(out_size, list):
                in_channels = out_size[i - 1]
            out_channels = out_size
            if isinstance(out_size, list):
                out_channels = out_size[i]
            if isinstance(kernel_size, list):
                _kernel_size = kernel_size[i]
            if isinstance(stride, list):
                _stride = stride[i]
            if isinstance(groups, list):
                _groups = groups[i]
            if activation is not None:
                self.layers.append(nn.Sequential(nn.Conv1d(in_channels=in_channels, out_channels=out_channels, kernel_size=_kernel_size, stride=_stride, groups=_groups), activation))
            else:
                self.layers.append(nn.Sequential(nn.Conv1d(in_channels=in_channels, out_channels=out_channels, kernel_size=_kernel_size, stride=_stride, groups=_groups)))
        self.dropout = nn.Dropout(p_dropout)

    def forward(self, x: Tensor, data_len: Tensor) -> tuple:
        """Passes the input tensor x through the Conv1D layers and returns the result."""
        x = x.transpose(1, 2)
        out = x
        pad_len = x.shape[-1] - data_len
        for layer in self.layers:
            out = layer(out)
            out = self.dropout(out)
            result_len = out.shape[-1]
            data_len = calc_data_len(result_len=result_len, pad_len=pad_len, data_len=data_len, kernel_size=layer[0].kernel_size[0], stride=layer[0].stride[0])
            pad_len = result_len - data_len
        out = out.transpose(1, 2)
        return (out, data_len)


INIT_ARGS = {
    'in_size': 4,
    'out_size': [8, 16],
    'kernel_size': [3, 3],
    'stride': [1, 1],
    'n_layers': 2,
    'p_dropout': 0.1,
    'groups': 1,
    'activation': nn.ReLU()
}

ARGS = {
    'x': torch.randn(2, 12, 4),
    'data_len': torch.tensor([10, 9])
}

if __name__ == '__main__':
    model = Conv1DLayers(**INIT_ARGS)
    output, new_data_len = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"New data lengths: {new_data_len}")
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)
ConvModule Ran
ran on a synthesized input · constructed an object; no result was computed
upskyy/Squeezeformer/squeezeformer/model.py
code served (permissive licence) · get_code("a6e14d81239e64ad")
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, ConvModule: 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)

ARGS = {
    'in_channels': 4,
    'kernel_size': 31,
    'expansion_factor': 2,
    'dropout_p': 0.1,
}
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 ConvModule — 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 ConvModule 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
DepthwiseConv1d Ran
ran on a synthesized input · constructed an object; no result was computed
upskyy/Squeezeformer/squeezeformer/model.py
code served (permissive licence) · get_code("f8183fb916aefe76")
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, DepthwiseConv1d: 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)

# Define the DepthwiseConv1d module
class DepthwiseConv1d(nn.Module):
    """
    When groups == in_channels and out_channels == K * in_channels, where K is a positive integer,
    this operation is termed in literature as depthwise convolution.
    ref : https://pytorch.org/docs/stable/generated/torch.nn.Conv2d.html

    Args:
        in_channels (int): Number of channels in the input
        out_channels (int): Number of channels produced by the convolution
        stride (int, optional): Stride of the convolution. Default: 1
        padding (int or tuple, optional): Zero-padding added to both sides of the input. Default: 0
        bias (bool, optional): If True, adds a learnable bias to the output. Default: False
    Inputs: inputs
        - **inputs** (batch, in_channels, time): Tensor containing input vector
    Returns: outputs
        - **outputs** (batch, out_channels, time): Tensor produces by depthwise 1-D convolution.
    """

    def __init__(self, in_channels: int, out_channels: int, kernel_size: int, stride: int=1, padding: int=0, bias: bool=False) -> None:
        super(DepthwiseConv1d, self).__init__()
        assert out_channels % in_channels == 0, 'out_channels should be constant multiple of in_channels'
        self.conv = nn.Conv1d(in_channels=in_channels, out_channels=out_channels, kernel_size=kernel_size, groups=in_channels, stride=stride, padding=padding, bias=bias)

    def forward(self, inputs: torch.Tensor) -> torch.Tensor:
        return self.conv(inputs)


# Construct valid arguments for DepthwiseConv1d
in_channels = 4
out_channels = 8  # Must be a multiple of in_channels (8 = 2 * 4)
kernel_size = 3
stride = 1
padding = 1
bias = False

ARGS = {
    'in_channels': in_channels,
    'out_channels': out_channels,
    'kernel_size': kernel_size,
    'stride': stride,
    'padding': padding,
    'bias': bias
}
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 DepthwiseConv1d — 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 DepthwiseConv1d 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
DepthwiseConv2d Ran
ran on a synthesized input · constructed an object; no result was computed
upskyy/Squeezeformer/squeezeformer/model.py
code served (permissive licence) · get_code("86a8c140aa415e79")
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, DepthwiseConv2d: 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
from typing import Tuple, Union

torch.manual_seed(0)

ARGS = {
    'in_channels': 3,
    'out_channels': 12,
    'kernel_size': (3, 3),
    'stride': 2,
    'padding': 1,
}
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 DepthwiseConv2d — 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 DepthwiseConv2d 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
DepthwiseConv2dSubsampling Ran
ran on a synthesized input
upskyy/Squeezeformer/squeezeformer/model.py
code served (permissive licence) · get_code("98a41dcbe0265925")
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 import Tensor
from typing import Tuple, Union

# Import the classes
from typing import Tuple
import torch.nn as nn
from torch import Tensor
from typing import Tuple, Union

class DepthwiseConv2d(nn.Module):
    """
    When groups == in_channels and out_channels == K * in_channels, where K is a positive integer,
    this operation is termed in literature as depthwise convolution.
    ref : https://pytorch.org/docs/stable/generated/torch.nn.Conv2d.html

    Args:
        in_channels (int): Number of channels in the input
        out_channels (int): Number of channels produced by the convolution
        kernel_size (int or tuple): Size of the convolving kernel
        stride (int, optional): Stride of the convolution. Default: 2
        padding (int or tuple, optional): Zero-padding added to both sides of the input. Default: 0
    Inputs: inputs
        - **inputs** (batch, in_channels, time): Tensor containing input vector
    Returns: outputs
        - **outputs** (batch, out_channels, time): Tensor produces by depthwise 2-D convolution.
    """

    def __init__(self, in_channels: int, out_channels: int, kernel_size: Union[int, Tuple], stride: int=2, padding: int=0) -> None:
        super(DepthwiseConv2d, self).__init__()
        assert out_channels % in_channels == 0, 'out_channels should be constant multiple of in_channels'
        self.conv = nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=kernel_size, stride=stride, padding=padding, groups=in_channels)

    def forward(self, inputs: Tensor) -> Tensor:
        return self.conv(inputs)

class DepthwiseConv2dSubsampling(nn.Module):
    """
    Depthwise Convolutional 2D subsampling (to 1/4 length)

    Args:
        in_channels (int): Number of channels in the input image
        out_channels (int): Number of channels produced by the convolution
    Inputs: inputs, input_lengths
        - **inputs** (batch, time, dim): Tensor containing sequence of inputs
        - **input_lengths** (batch): list of sequence input lengths
    Returns: outputs, output_lengths
        - **outputs** (batch, time, dim): Tensor produced by the convolution
        - **output_lengths** (batch): list of sequence output lengths
    """

    def __init__(self, in_channels: int, out_channels: int) -> None:
        super(DepthwiseConv2dSubsampling, self).__init__()
        self.sequential = nn.Sequential(nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=2), nn.ReLU(), DepthwiseConv2d(out_channels, out_channels, kernel_size=3, stride=2), nn.ReLU())

    def forward(self, inputs: Tensor, input_lengths: Tensor) -> Tuple[Tensor, Tensor]:
        outputs = self.sequential(inputs.unsqueeze(1))
        batch_size, channels, subsampled_lengths, subsampled_dim = outputs.size()
        outputs = outputs.permute(0, 2, 1, 3)
        outputs = outputs.contiguous().view(batch_size, subsampled_lengths, channels * subsampled_dim)
        output_lengths = input_lengths >> 2
        output_lengths -= 1
        return (outputs, output_lengths)


# Setup code
INIT_ARGS = {
    'in_channels': 1,
    'out_channels': 4,
}

ARGS = {
    'inputs': torch.randn(2, 32, 16),
    'input_lengths': torch.tensor([32, 32], dtype=torch.long),
}

# Construct and call
model = DepthwiseConv2dSubsampling(**INIT_ARGS)
outputs, output_lengths = model(**ARGS)

print("Output shape:", outputs.shape)
print("Output lengths:", output_lengths)
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)
FFModule Ran
ran on a synthesized input
kssteven418/squeezeformer/src/models/conformer_encoder.py
code served (permissive licence) · get_code("29208c0089f89df9")
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 EagerTensor, 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 tensorflow as tf
import numpy as np

# Suppress TensorFlow logging
tf.get_logger().setLevel('ERROR')

INIT_ARGS = {
    'input_dim': 4,
    'dropout': 0.1,
    'fc_factor': 0.5,
    'adaptive_scale': False,
    'ff_expansion_rate': 4,
    'name': 'ff_module'
}

ARGS = {
    'inputs': tf.constant(np.random.randn(2, 3, 4).astype(np.float32)),
    'training': True
}

# Construct and call the class
ff_module = tf.keras.layers.Layer.__new__(type('FFModule', (tf.keras.layers.Layer,), {}))

# Import the actual class
import sys
from types import ModuleType

# Define the FFModule class inline
logger = tf.get_logger()

class FFModule(tf.keras.layers.Layer):

    def __init__(self, input_dim, dropout=0.0, fc_factor=0.5, adaptive_scale=False, ff_expansion_rate=4, name='ff_module', **kwargs):
        super(FFModule, self).__init__(name=name, **kwargs)
        self.fc_factor = fc_factor
        logger.info(f'fc factor set as {self.fc_factor}')
        self.adaptive_scale = adaptive_scale
        if not adaptive_scale:
            logger.info('No scaling, use preLN')
            self.ln = tf.keras.layers.LayerNormalization(name=f'{name}_ln')
        else:
            logger.info('Use scaling, no preLN')
            self.scale = tf.Variable([1.0] * input_dim, trainable=True, name=f'{name}_scale')
            self.bias = tf.Variable([0.0] * input_dim, trainable=True, name=f'{name}_bias')
        ffn1_max = input_dim ** (-0.5)
        ffn2_max = (ff_expansion_rate * input_dim) ** (-0.5)
        self.ffn1 = tf.keras.layers.Dense(ff_expansion_rate * input_dim, name=f'{name}_dense_1', kernel_initializer=tf.keras.initializers.RandomUniform(minval=-ffn1_max, maxval=ffn1_max), bias_initializer=tf.keras.initializers.RandomUniform(minval=-ffn1_max, maxval=ffn1_max))
        self.act = tf.keras.layers.Activation(tf.nn.swish, name=f'{name}_act')
        self.do1 = tf.keras.layers.Dropout(dropout, name=f'{name}_dropout_1')
        self.ffn2 = tf.keras.layers.Dense(input_dim, name=f'{name}_dense_2', kernel_initializer=tf.keras.initializers.RandomUniform(minval=-ffn2_max, maxval=ffn2_max), bias_initializer=tf.keras.initializers.RandomUniform(minval=-ffn2_max, maxval=ffn2_max))
        self.do2 = tf.keras.layers.Dropout(dropout, name=f'{name}_dropout_2')
        self.res_add = tf.keras.layers.Add(name=f'{name}_add')

    def call(self, inputs, training=False, **kwargs):
        if not self.adaptive_scale:
            outputs = self.ln(inputs, training=training)
        else:
            scale = tf.reshape(self.scale, (1, 1, -1))
            bias = tf.reshape(self.bias, (1, 1, -1))
            outputs = inputs * scale + bias
        outputs = self.ffn1(outputs, training=training)
        outputs = self.act(outputs)
        outputs = self.do1(outputs, training=training)
        outputs = self.ffn2(outputs, training=training)
        outputs = self.do2(outputs, training=training)
        outputs = self.res_add([inputs, self.fc_factor * outputs])
        return outputs

# Construct the module
module = FFModule(**INIT_ARGS)

# Call the module
output = module(**ARGS)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, 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)
FeedForwardModule Ran
ran on a synthesized input · constructed an object; no result was computed
upskyy/Squeezeformer/squeezeformer/model.py
code served (permissive licence) · get_code("425b3f6eba4ae90e")
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, FeedForwardModule: 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
from torch import Tensor

torch.manual_seed(0)

class Swish(nn.Module):

    def __init__(self) -> None:
        super(Swish, self).__init__()

    def forward(self, inputs: Tensor) -> Tensor:
        return inputs * inputs.sigmoid()

class FeedForwardModule(nn.Module):
    """
    Feed Forward Module follow pre-norm residual units and apply layer normalization within the residual unit
    and on the input before the first linear layer. This module also apply Swish activation and dropout, which helps
    regularizing the network.

    Args:
        encoder_dim (int): Dimension of squeezeformer encoder
        expansion_factor (int): Expansion factor of feed forward module.
        dropout_p (float): Ratio of dropout
    Inputs: inputs
        - **inputs** (batch, time, dim): Tensor contains input sequences
    Outputs: outputs
        - **outputs** (batch, time, dim): Tensor produces by feed forward module.
    """

    def __init__(self, encoder_dim: int=512, expansion_factor: int=4, dropout_p: float=0.1) -> None:
        super(FeedForwardModule, self).__init__()
        self.sequential = nn.Sequential(nn.Linear(encoder_dim, encoder_dim * expansion_factor, bias=True), Swish(), nn.Dropout(p=dropout_p), nn.Linear(encoder_dim * expansion_factor, encoder_dim, bias=True), nn.Dropout(p=dropout_p))

    def forward(self, inputs: Tensor) -> Tensor:
        return self.sequential(inputs)


# Create test input tensor
# Shape: (batch=2, time=3, dim=4)
test_input = torch.randn(2, 3, 4)

# Define ARGS for FeedForwardModule.__init__
ARGS = {
    "encoder_dim": 4,
    "expansion_factor": 2,
    "dropout_p": 0.1
}
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 FeedForwardModule — 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 FeedForwardModule 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
GLU Ran
ran on a synthesized input · constructed an object; no result was computed
upskyy/Squeezeformer/squeezeformer/model.py
code served (permissive licence) · get_code("46a7b3e64f094c31")
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, GLU: 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)

# GLU expects a Tensor input that will be chunked along a dimension
# The input should have size divisible by 2 along the specified dimension
# We'll use dim=1, so the input tensor should have an even size along dim 1

dim = 1
# Create input tensor: shape (2, 8) - batch size 2, feature dim 8
# After chunk(2, dim=1), we get two tensors of shape (2, 4) each
inputs = torch.randn(2, 8)

ARGS = {
    "dim": dim
}
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 GLU — 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 GLU 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
GLU Ran
ran on a synthesized input
kssteven418/squeezeformer/src/models/conformer_encoder.py
code served (permissive licence) · get_code("35285e7d41e8ab62")
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 EagerTensor, ndim 2, 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 tensorflow as tf
import numpy as np

# GLU class definition
class GLU(tf.keras.layers.Layer):

    def __init__(self, axis=-1, name='glu_activation', **kwargs):
        super(GLU, self).__init__(name=name, **kwargs)
        self.axis = axis

    def call(self, inputs, **kwargs):
        a, b = tf.split(inputs, 2, axis=self.axis)
        b = tf.nn.sigmoid(b)
        return tf.multiply(a, b)

    def get_config(self):
        conf = super(GLU, self).get_config()
        conf.update({'axis': self.axis})
        return conf

# Setup code
INIT_ARGS = {
    'axis': -1,
    'name': 'glu_activation'
}

# GLU expects input to be split in half along the specified axis
# So if axis=-1 and we want output features of 4, input needs 8 features
# Input shape: (batch=2, features=8)
ARGS = {
    'inputs': tf.constant(np.random.randn(2, 8).astype(np.float32))
}

METHOD = 'call'
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 2, 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)
IdentityLayer Ran
ran on a synthesized input
kssteven418/squeezeformer/src/models/conformer_encoder.py
code served (permissive licence) · get_code("4d0d22b07f8f313e")
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 EagerTensor, ndim 2, 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 tensorflow as tf
import numpy as np

INIT_ARGS = {}

inputs_tensor = tf.constant(np.random.randn(2, 4).astype(np.float32))

ARGS = {
    'inputs': inputs_tensor
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 2, 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)
MultiHeadAtt Ran
ran on a synthesized input
msalhab96/SpeeQ/speeq/models/encoders.py
code served (permissive licence) · get_code("e3dbd3a46a9bf6f7")
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
from torch import Tensor

class MultiHeadAtt(nn.Module):
    """A module that implements the multi-head attention mechanism described in
    https://arxiv.org/abs/1706.03762.

    Args:
        d_model (int): The dimensionality of the model.

        h (int): The number of heads to use in the attention mechanism.

        masking_value (float, optional): The value used for masking. Defaults
        to -1e15.
    """

    def __init__(self, d_model: int, h: int, masking_value: int=-1000000000000000.0) -> None:
        super().__init__()
        self.h = h
        self.dk = d_model // h
        self.d_model = d_model
        self.masking_value = masking_value
        assert d_model % h == 0, ValueError
        self.query_fc = nn.Linear(in_features=d_model, out_features=d_model)
        self.key_fc = nn.Linear(in_features=d_model, out_features=d_model)
        self.value_fc = nn.Linear(in_features=d_model, out_features=d_model)
        self.softmax = nn.Softmax(dim=-1)

    def _reshape(self, x: Tensor) -> Tensor:
        batch_size, max_len, _ = x.shape
        x = x.view(batch_size, max_len, self.h, self.dk)
        return x

    def _mask(self, att: Tensor, key_mask: Tensor, query_mask: Tensor) -> Tensor:
        key_max_len = key_mask.shape[-1]
        query_max_len = query_mask.shape[-1]
        key_mask = key_mask.repeat(1, query_max_len)
        key_mask = key_mask.view(-1, query_max_len, key_max_len)
        if query_mask.dim() != key_mask.dim():
            query_mask = query_mask.unsqueeze(dim=-1)
        mask = key_mask & query_mask
        mask = mask.unsqueeze(dim=1)
        return att.masked_fill(~mask, self.masking_value)

    def perform_attention(self, key: Tensor, query: Tensor, value: Tensor, key_mask=None, query_mask=None) -> Tensor:
        """Performs multi-head attention by computing a weighted sum of the
        values using queries and keys. The weights are computed as a softmax
        over the dot products of the queries and keys for each attention head.
        Optionally, attention can be masked using key and query masks.

        Args:
            key (Tensor): The key input tensor of shape [B, M, d]

            query (Tensor): The query of shape [B, M, d]

            value (Tensor): Teh value tensor of shape [B, M, d]

            key_mask (Tensor, optional): A boolean tensor of shape
            [B, M] where True indicates that the corresponding key position
            contains data, not padding, and should not be masked

            query_mask (Tensor, optional): A boolean tensor of shape
            [B, M] where True indicates that the corresponding query position
            contains data, not padding, and should not be masked

        Returns:
            Tensor: The tensor of shape [B, M, d] resulting from the multi-head
            attention computation.
        """
        key = self._reshape(key)
        query = self._reshape(query)
        value = self._reshape(value)
        key = key.permute(0, 2, 3, 1)
        query = query.permute(0, 2, 1, 3)
        value = value.permute(0, 2, 1, 3)
        att = torch.matmul(query, key)
        if key_mask is not None and query_mask is not None:
            att = self._mask(att=att, key_mask=key_mask, query_mask=query_mask)
        att = self.softmax(att / self.d_model)
        out = torch.matmul(att, value)
        out = out.permute(0, 2, 1, 3)
        out = out.contiguous()
        out = out.view(out.shape[0], out.shape[1], -1)
        return out

    def forward(self, key: Tensor, query: Tensor, value: Tensor, key_mask=None, query_mask=None) -> Tensor:
        """passes the input to the multi-head attention by computing a weighted
        sum of the values using queries and keys. The weights are computed as a softmax
        over the dot products of the queries and keys for each attention head.
        Optionally, attention can be masked using key and query masks.

        Args:
            key (Tensor): The key input tensor of shape [B, M, d]

            query (Tensor): The query of shape [B, M, d]

            value (Tensor): Teh value tensor of shape [B, M, d]

            key_mask (Tensor, optional): A boolean tensor of shape
            [B, M] where True indicates that the corresponding key position
            contains data, not padding, and should not be masked

            query_mask (Tensor, optional): A boolean tensor of shape
            [B, M] where True indicates that the corresponding query position
            contains data, not padding, and should not be masked

        Returns:
            Tensor: The tensor of shape [B, M, d] resulting from the multi-head
            attention computation.
        """
        key = self.key_fc(key)
        query = self.query_fc(query)
        value = self.value_fc(value)
        return self.perform_attention(key, query, value, key_mask, query_mask)


INIT_ARGS = {
    'd_model': 4,
    'h': 2,
    'masking_value': -1000000000000000.0
}

ARGS = {
    'key': torch.randn(2, 3, 4),
    'query': torch.randn(2, 3, 4),
    'value': torch.randn(2, 3, 4),
    'key_mask': None,
    'query_mask': 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 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)
PointwiseConv1d Ran
ran on a synthesized input · constructed an object; no result was computed
upskyy/Squeezeformer/squeezeformer/model.py
code served (permissive licence) · get_code("8acc35cd7fb4aa6f")
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, PointwiseConv1d: 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)

# Define arguments for PointwiseConv1d
ARGS = {
    "in_channels": 3,
    "out_channels": 5,
    "stride": 1,
    "padding": 0,
    "bias": True,
}
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 PointwiseConv1d — 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 PointwiseConv1d 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
kssteven418/squeezeformer/src/models/conformer_encoder.py
code served (permissive licence) · get_code("8008c17ae543b9f8")
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 EagerTensor, ndim 3, dtype family float, shape (1, 5, 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 tensorflow as tf
import math
import numpy as np

def shape_list(x, out_type=tf.int32):
    """Deal with dynamic shape in tensorflow cleanly."""
    static = x.shape.as_list()
    dynamic = tf.shape(x, out_type=out_type)
    return [dynamic[i] if s is None else s for i, s in enumerate(static)]

class PositionalEncoding(tf.keras.layers.Layer):
    """
    Same positional encoding method as NeMo library
    """

    def __init__(self, d_model, max_len=5000, name='positional_encoding_nemo', **kwargs):
        super().__init__(trainable=False, name=name, **kwargs)
        self.max_len = max_len
        positions = tf.expand_dims(tf.range(self.max_len - 1, -max_len, -1.0, dtype=tf.float32), axis=1)
        pos_length = tf.shape(positions)[0]
        pe = np.zeros([pos_length, d_model], 'float32')
        div_term = np.exp(tf.range(0, d_model, 2, dtype=tf.float32) * -(math.log(10000.0) / d_model))
        pe[:, 0::2] = np.sin(positions * div_term)
        pe[:, 1::2] = np.cos(positions * div_term)
        pe = tf.convert_to_tensor(pe)
        self.pe = tf.expand_dims(pe, 0)

    def call(self, inputs, **kwargs):
        _, length, dmodel = shape_list(inputs)
        center_pos = tf.shape(self.pe)[1] // 2
        start_pos = center_pos - length + 1
        end_pos = center_pos + length
        pos_emb = self.pe[:, start_pos:end_pos]
        return tf.cast(pos_emb, dtype=inputs.dtype)

    def get_config(self):
        conf = super().get_config()
        return conf.update({'max_len': self.max_len})


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

ARGS = {
    'inputs': tf.random.normal((2, 3, 4), dtype=tf.float32),
}

if __name__ == '__main__':
    layer = PositionalEncoding(**INIT_ARGS)
    output = layer(**ARGS)
    print("Output shape:", output.shape)
    print("Output dtype:", output.dtype)
    print("Success!")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 3, dtype family float, shape (1, 5, 4) — shape (1, 5, 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)
RelPositionalEncoding Ran
ran on a synthesized input · constructed an object; no result was computed
upskyy/Squeezeformer/squeezeformer/model.py
code served (permissive licence) · get_code("f528d6540416bf8b")
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, RelPositionalEncoding: 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 math

torch.manual_seed(0)

# The RelPositionalEncoding class takes two parameters in __init__:
# - d_model: int (embedding dimension)
# - max_len: int (maximum input length)

ARGS = {
    "d_model": 64,
    "max_len": 128,
}
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 RelPositionalEncoding — 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 RelPositionalEncoding 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
RelativeMultiHeadAttention Ran
ran on a synthesized input · constructed an object; no result was computed
upskyy/Squeezeformer/squeezeformer/model.py
code served (permissive licence) · get_code("0d0315fcda610792")
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, RelativeMultiHeadAttention: 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 math

torch.manual_seed(0)

# Model parameters
d_model = 8
num_heads = 2
dropout_p = 0.1

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

# Create tensors with distinct dimensions
batch_size = 2
seq_length = 4

# query: (batch, time, dim)
query = torch.randn(batch_size, seq_length, d_model)

# key: (batch, time, dim)
key = torch.randn(batch_size, seq_length, d_model)

# value: (batch, time, dim)
value = torch.randn(batch_size, seq_length, d_model)

# pos_embedding: (batch, time, dim)
pos_embedding = torch.randn(batch_size, seq_length, d_model)

# mask: (batch, 1, time2) or (batch, time1, time2)
# Create a boolean mask (batch, 1, seq_length)
mask = torch.zeros(batch_size, 1, seq_length, dtype=torch.bool)
mask[0, 0, -1] = True  # Mask last position of first batch

ARGS = {
    'd_model': d_model,
    'num_heads': num_heads,
    'dropout_p': dropout_p,
}
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 RelativeMultiHeadAttention — 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 RelativeMultiHeadAttention 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
ResidualConnectionModule Ran
ran on a synthesized input · constructed an object; no result was computed
upskyy/Squeezeformer/squeezeformer/model.py
code served (permissive licence) · get_code("aabca50483e3eae8")
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, ResidualConnectionModule: 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 simple module that takes a tensor and processes it
class SimpleLinearModule(nn.Module):
    def __init__(self, input_dim: int, output_dim: int):
        super(SimpleLinearModule, self).__init__()
        self.linear = nn.Linear(input_dim, output_dim)
    
    def forward(self, x):
        return self.linear(x)

# Create the module to use in ResidualConnectionModule
inner_module = SimpleLinearModule(input_dim=4, output_dim=4)

ARGS = {
    "module": inner_module,
    "module_factor": 0.5,
}
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 ResidualConnectionModule — 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 ResidualConnectionModule 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
Scaling1d Ran
ran on a synthesized input
msalhab96/SpeeQ/speeq/models/encoders.py
code served (permissive licence) · get_code("8c469852dc208010")
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
from torch import nn

class Scaling1d(nn.Module):
    """Implements the scaling layer proposed in
    https://arxiv.org/abs/2206.00888

    Args:

        d_model (int): The model dimension.

    """

    def __init__(self, d_model: int) -> None:
        super().__init__()
        self.gamma = nn.Parameter(torch.randn(1, 1, d_model))
        self.beta = nn.Parameter(torch.randn(1, 1, d_model))

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        """Scales the input x.

        Args:
            x (Tensor): The input tensor of shape [B, M, d].

        Returns:
            Tensor: The scaled and shifted tensor of shape [B, M, d].

        """
        return self.gamma * x + self.beta


INIT_ARGS = {
    "d_model": 4,
}

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

if __name__ == "__main__":
    model = Scaling1d(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Input shape: {ARGS['x'].shape}")
    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 (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)
SqueezeformerConvModule Ran
ran on a synthesized input
msalhab96/SpeeQ/speeq/models/encoders.py
code served (permissive licence) · get_code("4dea36bac3f898c4")
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, 5, 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

# Import the classes
import torch
from torch import Tensor, nn

class ConformerConvModule(nn.Module):
    """Implements the conformer convolution module
    as described in https://arxiv.org/abs/2005.08100

    Args:

        d_model (int): The model dimension.

        kernel_size (int): The depth-wise convolution kernel size.

        p_dropout (float): The dropout rate.
    """

    def __init__(self, d_model: int, kernel_size: int, p_dropout: float) -> None:
        super().__init__()
        self.lnorm = nn.LayerNorm(normalized_shape=d_model)
        self.pwise_conv1 = nn.Conv1d(in_channels=d_model, out_channels=2 * d_model, kernel_size=1)
        self.act1 = nn.GLU(dim=1)
        self.dwise_conv = nn.Conv1d(in_channels=d_model, out_channels=d_model, kernel_size=kernel_size, groups=d_model, padding='same')
        self.bnorm = nn.BatchNorm1d(num_features=d_model)
        self.act2 = nn.SiLU()
        self.pwise_conv2 = nn.Conv1d(in_channels=d_model, out_channels=d_model, kernel_size=1)
        self.dropout = nn.Dropout(p_dropout)

    def forward(self, x: Tensor) -> Tensor:
        """
        Passes the input tensor through the Conformer Convolutional Module.

        Args:
            x (Tensor): Input tensor of shape [B, M, d].

        Returns:
            Tensor: Result tensor of shape [B, M, d].
        """
        out = self.lnorm(x)
        out = out.transpose(-1, -2)
        out = self.pwise_conv1(out)
        out = self.act1(out)
        out = self.dwise_conv(out)
        out = self.bnorm(out)
        out = self.act2(out)
        out = self.pwise_conv2(out)
        out = self.dropout(out)
        out = out.transpose(-1, -2)
        return out

class Scaling1d(nn.Module):
    """Implements the scaling layer proposed in
    https://arxiv.org/abs/2206.00888

    Args:

        d_model (int): The model dimension.

    """

    def __init__(self, d_model: int) -> None:
        super().__init__()
        self.gamma = nn.Parameter(torch.randn(1, 1, d_model))
        self.beta = nn.Parameter(torch.randn(1, 1, d_model))

    def forward(self, x: Tensor) -> Tensor:
        """Scales the input x.

        Args:
            x (Tensor): The input tensor of shape [B, M, d].

        Returns:
            Tensor: The scaled and shifted tensor of shape [B, M, d].

        """
        return self.gamma * x + self.beta

class SqueezeformerConvModule(ConformerConvModule):
    """Implements the conformer convolution module with the modification as described in
    https://arxiv.org/abs/2206.00888

    Args:

        d_model (int): The model dimension.

        kernel_size (int): The size of the depth-wise convolution kernel.

        p_dropout (float): The dropout rate.

    """

    def __init__(self, d_model: int, kernel_size: int, p_dropout: float) -> None:
        super().__init__(d_model, kernel_size, p_dropout)
        self.pwise_conv1 = nn.Conv1d(in_channels=d_model, out_channels=d_model, kernel_size=1)
        self.act1 = nn.SiLU()
        self.scaler = Scaling1d(d_model=d_model)
        del self.lnorm

    def forward(self, x: Tensor) -> Tensor:
        """Passes the input x through the layers of the SqueezeformerConvModule.

        Args:

            x (torch.Tensor): A tensor of shape [B, M, d].

        Returns:
            Tensor: The result tensor of shape [B, M, d]
        """
        out = self.scaler(x)
        out = out.transpose(-1, -2)
        out = self.pwise_conv1(out)
        out = self.act1(out)
        out = self.dwise_conv(out)
        out = self.bnorm(out)
        out = self.act2(out)
        out = self.pwise_conv2(out)
        out = self.dropout(out)
        out = out.transpose(-1, -2)
        return out


# Setup and execution
INIT_ARGS = {
    'd_model': 4,
    'kernel_size': 3,
    'p_dropout': 0.1,
}

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

# Construct and call
module = SqueezeformerConvModule(**INIT_ARGS)
output = module(**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 3, dtype family float, shape (2, 5, 4) — shape (2, 5, 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)
SqueezeformerFeedForward Ran
ran on a synthesized input
msalhab96/SpeeQ/speeq/models/encoders.py
code served (permissive licence) · get_code("e2853e88fa2a4612")
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, 5, 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 ConformerFeedForward(nn.Module):
    """Implements the feed-forward module used in Conformer models
    as described in https://arxiv.org/abs/2005.08100

    Args:
        d_model (int): The input feature dimensionality.

        expansion_factor (int): The expansion factor used by the linear layer.

        p_dropout (float): The dropout rate.
    """

    def __init__(self, d_model: int, expansion_factor: int, p_dropout: float) -> None:
        super().__init__()
        self.lnrom = nn.LayerNorm(normalized_shape=d_model)
        self.fc1 = nn.Linear(in_features=d_model, out_features=expansion_factor * d_model)
        self.fc2 = nn.Linear(in_features=expansion_factor * d_model, out_features=d_model)
        self.swish = nn.SiLU()
        self.dropout = nn.Dropout(p_dropout)

    def forward(self, x):
        """Passes the input x through the conformer feed-forward module.

        Args:
            x (Tensor): The input tensor of shape [B, M, d].

        Returns:
            Tensor: The output tensor of shape [B, M, d].
        """
        out = self.lnrom(x)
        out = self.fc1(out)
        out = self.swish(out)
        out = self.dropout(out)
        out = self.fc2(out)
        out = self.dropout(out)
        return out

class Scaling1d(nn.Module):
    """Implements the scaling layer proposed in
    https://arxiv.org/abs/2206.00888

    Args:

        d_model (int): The model dimension.

    """

    def __init__(self, d_model: int) -> None:
        super().__init__()
        self.gamma = nn.Parameter(torch.randn(1, 1, d_model))
        self.beta = nn.Parameter(torch.randn(1, 1, d_model))

    def forward(self, x):
        """Scales the input x.

        Args:
            x (Tensor): The input tensor of shape [B, M, d].

        Returns:
            Tensor: The scaled and shifted tensor of shape [B, M, d].

        """
        return self.gamma * x + self.beta

class SqueezeformerFeedForward(ConformerFeedForward):
    """Implements the conformer feed-forward module with the modifications
    introduced in https://arxiv.org/abs/2206.00888

    Args:
        d_model (int): The model dimension.

        expansion_factor (int): The expansion factor of the linear layer.

        p_dropout (float): The dropout rate.

    """

    def __init__(self, d_model: int, expansion_factor: int, p_dropout: float) -> None:
        super().__init__(d_model=d_model, expansion_factor=expansion_factor, p_dropout=p_dropout)
        del self.lnrom
        self.scaler = Scaling1d(d_model=d_model)

    def forward(self, x):
        """Passes the input to the feed-forward layers

        Args:
            x (Tensor): Input tensor of shape [B, M, d].

        Returns:
            Tensor: Output tensor of shape [B, M, d].
        """
        out = self.scaler(x)
        out = self.fc1(out)
        out = self.swish(out)
        out = self.dropout(out)
        out = self.fc2(out)
        out = self.dropout(out)
        return out


INIT_ARGS = {
    "d_model": 4,
    "expansion_factor": 3,
    "p_dropout": 0.1,
}

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

if __name__ == "__main__":
    model = SqueezeformerFeedForward(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: (2, 5, 4)")
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, 5, 4) — shape (2, 5, 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)
Swish Ran
ran on a synthesized input · constructed an object; no result was computed
upskyy/Squeezeformer/squeezeformer/model.py
code served (permissive licence) · get_code("1cb732add54f1736")
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, Swish: 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)

# Swish module takes no parameters in __init__
# The forward method takes inputs (Tensor) and applies: inputs * inputs.sigmoid()
# We need to create a small tensor to pass through

inputs = 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 Swish — 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 Swish 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
TimeReductionLayer Ran
ran on a synthesized input · constructed an object; no result was computed
upskyy/Squeezeformer/squeezeformer/model.py
code served (permissive licence) · get_code("ab409607eeb094c4")
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, TimeReductionLayer: 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)

# TimeReductionLayer expects:
# - in_channels: int
# - out_channels: int  
# - kernel_size: int
# - stride: int
# And in forward() it expects:
# - inputs: Tensor of shape (batch, channels, height, width)
# - input_lengths: Tensor of shape (batch,) with integer values

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

# Create input_lengths tensor
# Shape: (batch=2,) with values that make sense after reduction
input_lengths = torch.tensor([8, 8], dtype=torch.long)

ARGS = {
    "in_channels": 1,
    "out_channels": 1,
    "kernel_size": 3,
    "stride": 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 TimeReductionLayer — 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 TimeReductionLayer 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
Transpose Ran
ran on a synthesized input · constructed an object; no result was computed
upskyy/Squeezeformer/squeezeformer/model.py
code served (permissive licence) · get_code("de0041a83f28b21f")
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, Transpose: 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 Transpose class takes a shape parameter which should be a tuple
# of two integers representing the dimensions to transpose.
# Looking at the forward method, it calls x.transpose(*self.shape),
# so shape should be a tuple of two dimension indices.

# Create a small test tensor: batch_size=2, with shape (2, 4, 3)
# so we can transpose different dimensions
test_tensor = torch.randn(2, 4, 3)

# The shape parameter should be a tuple of two integers for transpose
# Let's use (1, 2) to transpose dimensions 1 and 2
ARGS = {
    "shape": (1, 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 Transpose — 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 Transpose 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
add_pos_enc Ran
ran, honoured the contract we drafted
msalhab96/SpeeQ/speeq/models/encoders.py
code served (permissive licence) · get_code("cfc657760fd4bb85")
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 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
from torch import Tensor

torch.manual_seed(0)

# Create a small input tensor of shape [B, M, d]
# B=2 (batch), M=3 (sequence length), d=4 (model dimension)
x = torch.randn(2, 3, 4, dtype=torch.float)

ARGS = {
    "x": x
}
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 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: none by the harness; any seed is in the setup block
calc_data_len Ran
ran, honoured the contract we drafted
msalhab96/SpeeQ/speeq/models/encoders.py
code served (permissive licence) · get_code("860c95bcb91d9a54")
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 int, ndim 0, dtype family int, shape () 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 = {
    "result_len": 10,
    "pad_len": 3,
    "data_len": 7,
    "kernel_size": 3,
    "stride": 1,
}
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 int, ndim 0, dtype family int, shape () — shape () 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
get_mask_from_lens Ran
ran; our contract draft was wrong, not the code
msalhab96/SpeeQ/speeq/models/encoders.py
code served (permissive licence) · get_code("c9d2ed75de0f8e2e")
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 (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
from torch import Tensor

torch.manual_seed(0)

# Create a lengths tensor of shape [B] where B=2
# Values represent the actual length of each sequence in the batch
lengths = torch.tensor([3, 2], dtype=torch.long)

# Maximum length for the mask
max_len = 4

ARGS = {
    "lengths": lengths,
    "max_len": max_len,
}
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 Tensor, ndim 2, dtype family float, shape (2, 4) — shape (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: none by the harness; any seed is in the setup block
get_positional_encoding Ran
ran, honoured the contract we drafted
msalhab96/SpeeQ/speeq/models/encoders.py
code served (permissive licence) · get_code("686e499ae419b99c")
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 3, dtype family float, shape (1, 8, 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 Tensor, nn

torch.manual_seed(0)

ARGS = {
    "max_length": 8,
    "d_model": 4,
}
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 Tensor, ndim 3, dtype family float, shape (1, 8, 4) — shape (1, 8, 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: none by the harness; any seed is in the setup block
recover_resolution Ran
ran; our contract draft was wrong, not the code
upskyy/Squeezeformer/squeezeformer/model.py
code served (permissive licence) · get_code("fe25270cda3bacd8")
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 3, dtype family float, shape (2, 8, 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

torch.manual_seed(0)

# The function takes inputs as a Tensor and processes it
# Looking at the function:
# - It iterates idx from 0 to inputs.size(1) * 2
# - It indexes inputs[:, idx // 2, :]
# So inputs needs shape (batch_size, some_dim, feature_dim)

# Create a small tensor with distinct dimensions:
# batch=2, middle_dim=4, feature_dim=3
inputs = torch.randn(2, 4, 3)

ARGS = {
    "inputs": inputs
}
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 3, dtype family float, shape (2, 8, 3) — shape (2, 8, 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
shape_list Ran
ran; our contract draft was wrong, not the code
kssteven418/squeezeformer/src/models/conformer_encoder.py
code served (permissive licence) · get_code("f1f0e7aba532e2f6")
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 list, ndim 1, dtype family int; 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 tensorflow as tf
import numpy as np

# Create a small TensorFlow tensor with some dynamic dimensions
# Using a concrete tensor with shape (2, 4)
x = tf.constant(np.random.randn(2, 4).astype(np.float32))

# Also test with a tensor that has None in static shape
# Create a placeholder-like tensor with partial static shape
x_dynamic = tf.RaggedTensor.from_row_lengths(
    values=tf.constant(np.random.randn(6).astype(np.float32)),
    row_lengths=[2, 4]
)

ARGS = {
    "x": x,
    "out_type": tf.int32
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
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
ConformerBlock Not yet run
unverified (harvested, no recorded run)
kssteven418/squeezeformer/src/models/conformer_encoder.py
code served (permissive licence) · get_code("c6798a57b40a97c6")
How it ran

no invocation recorded.

ConformerEncoder Not yet run
unverified (harvested, no recorded run)
kssteven418/squeezeformer/src/models/conformer_encoder.py
code served (permissive licence) · get_code("f8af5a4e29b98e92")
How it ran

no invocation recorded.

ConformerPreNet Not yet run
unverified (harvested, no recorded run)
msalhab96/SpeeQ/speeq/models/encoders.py
code served (permissive licence) · get_code("77f464c34cf1fc3a")
How it ran

no invocation recorded.

Conv2dSubsampling Not yet run
unverified (harvested, no recorded run)
kssteven418/squeezeformer/src/models/conformer_encoder.py
code served (permissive licence) · get_code("0c18f86c9e0954b7")
How it ran

no invocation recorded.

ConvFFModule Not yet run
unverified (harvested, no recorded run)
kssteven418/squeezeformer/src/models/conformer_encoder.py
code served (permissive licence) · get_code("664e0546c35af991")
How it ran

no invocation recorded.

ConvModule Not yet run
unverified (harvested, no recorded run)
kssteven418/squeezeformer/src/models/conformer_encoder.py
code served (permissive licence) · get_code("c6e0c0f0739513ec")
How it ran

no invocation recorded.

MHSAFFModule Not yet run
unverified (harvested, no recorded run)
kssteven418/squeezeformer/src/models/conformer_encoder.py
code served (permissive licence) · get_code("3065ed179d177d1a")
How it ran

no invocation recorded.

MHSAModule Not yet run
unverified (harvested, no recorded run)
kssteven418/squeezeformer/src/models/conformer_encoder.py
code served (permissive licence) · get_code("556aca63592449fd")
How it ran

no invocation recorded.

MultiHeadAttention Not yet run
unverified (harvested, no recorded run)
kssteven418/squeezeformer/src/models/conformer_encoder.py
code served (permissive licence) · get_code("7d7f63e024f22b4b")
How it ran

no invocation recorded.

MultiHeadedSelfAttentionModule Not yet run
unverified (harvested, no recorded run)
upskyy/Squeezeformer/squeezeformer/model.py
code served (permissive licence) · get_code("85cd1ee826586a47")
How it ran

no invocation recorded.

RelPositionMultiHeadAttention Not yet run
unverified (harvested, no recorded run)
kssteven418/squeezeformer/src/models/conformer_encoder.py
code served (permissive licence) · get_code("9350e6b3773fb284")
How it ran

no invocation recorded.

Squeezeformer Not yet run
unverified (harvested, no recorded run)
upskyy/Squeezeformer/squeezeformer/model.py
code served (permissive licence) · get_code("4da7516805a0404e")
How it ran

no invocation recorded.

SqueezeformerBlock Not yet run
unverified (harvested, no recorded run)
upskyy/Squeezeformer/squeezeformer/model.py
code served (permissive licence) · get_code("96410b26ea1bc10d")
How it ran

no invocation recorded.

SqueezeformerBlock Not yet run
unverified (harvested, no recorded run)
msalhab96/SpeeQ/speeq/models/encoders.py
code served (permissive licence) · get_code("136716ec91fc7e49")
How it ran

no invocation recorded.

SqueezeformerEncoder Not yet run
unverified (harvested, no recorded run)
upskyy/Squeezeformer/squeezeformer/model.py
code served (permissive licence) · get_code("b2b5c7140fffa95d")
How it ran

no invocation recorded.

SqueezeformerEncoder Not yet run
unverified (harvested, no recorded run)
msalhab96/SpeeQ/speeq/models/encoders.py
code served (permissive licence) · get_code("74f45b8eb78d354f")
How it ran

no invocation recorded.

SqueezeformerRelativeMHSA Not yet run
unverified (harvested, no recorded run)
msalhab96/SpeeQ/speeq/models/encoders.py
code served (permissive licence) · get_code("23a9c915a6989d9a")
How it ran

no invocation recorded.

TimeReductionLayer Not yet run
unverified (harvested, no recorded run)
kssteven418/squeezeformer/src/models/conformer_encoder.py
code served (permissive licence) · get_code("480648d1fbf231db")
How it ran

no invocation recorded.

Also present in other papers' code

Of 49 samples lifted from this paper's linked repositories, 49 carry a function identity and 0 do not. Of the 49 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 49 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-23.

Repositories linked to this paper

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

Abstract

The recently proposed Conformer model has become the de facto backbone model for various downstream speech tasks based on its hybrid attention-convolution architecture that captures both local and global features. However, through a series of systematic studies, we find that the Conformer architecture's design choices are not optimal. After re-examining the design choices for both the macro and micro-architecture of Conformer, we propose Squeezeformer which consistently outperforms the state-of-the-art ASR models under the same training schemes. In particular, for the macro-architecture, Squeezeformer incorporates (i) the Temporal U-Net structure which reduces the cost of the multi-head attention modules on long sequences, and (ii) a simpler block structure of multi-head attention or convolution modules followed up by feed-forward module instead of the Macaron structure proposed in Conformer. Furthermore, for the micro-architecture, Squeezeformer (i) simplifies the activations in the convolutional block, (ii) removes redundant Layer Normalization operations, and (iii) incorporates an efficient depthwise downsampling layer to efficiently sub-sample the input signal. Squeezeformer achieves state-of-the-art results of 7.5%, 6.5%, and 6.0% word-error-rate (WER) on Lib-riSpeech test-other without external language models, which are 3.1%, 1.4%, and 0.6% better than Conformer-CTC with the same number of FLOPs. Our code is open-sourced and available online [25].

For agents

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

get_harvested_code_for_paper("2206.00888")
get_code_for_paper("2206.00888")
have("2206.00888")

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

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

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

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

Connect an agent — have() is free.