SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2006.07214 · NeurIPS · 2020

Sparse and Continuous Attention Mechanisms

Vlad Niculae, André Martins, António Farinhas, Marcos Treviso, Pedro Aguiar, Mário Figueiredo

arXiv · PDF · Open in the Atlas

Code that ran

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

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2006.07214.json · badge: /api/ran/2006.07214.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
deep-spin/mcan-vqa-continuous-attention canonical (classifier label)
classifier basis: classifier_2025
0 ran · 2 no recorded run
deep-spin/quati community
Papers with Code archive
12 ran · 1 no recorded run
FunctionStatusWhere it lives
BasisFunctions Ran
ran on a synthesized input · constructed an object; no result was computed
deep-spin/quati/quati/modules/continuous_attention.py
code served (permissive licence) · get_code("544ace0143134f21")
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, BasisFunctions: 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 numpy as np

torch.manual_seed(0)

class ConcreteBasisFunctions:
    """Concrete implementation of BasisFunctions for testing."""
    
    def __init__(self, num_basis=3):
        self.num_basis = num_basis
    
    def __len__(self):
        """Number of basis functions."""
        return self.num_basis
    
    def evaluate(self, t):
        """Evaluate basis functions at points t."""
        if isinstance(t, (int, float)):
            t = np.array([t])
        elif isinstance(t, torch.Tensor):
            t = t.cpu().numpy()
        else:
            t = np.array(t)
        
        # Return shape (num_basis, len(t))
        result = np.zeros((self.num_basis, len(t)))
        for i in range(self.num_basis):
            result[i] = np.sin((i + 1) * t)
        return result
    
    def integrate_psi(self, a, b):
        """Compute integral int_a^b psi(t)."""
        # Return shape (num_basis,)
        result = np.zeros(self.num_basis)
        for i in range(self.num_basis):
            # Integral of sin((i+1)*t) from a to b
            result[i] = (np.cos((i + 1) * a) - np.cos((i + 1) * b)) / (i + 1)
        return result
    
    def integrate_t_times_psi(self, a, b):
        """Compute integral int_a^b t * psi(t)."""
        # Return shape (num_basis,)
        result = np.zeros(self.num_basis)
        for i in range(self.num_basis):
            # Numerical approximation for integral of t * sin((i+1)*t)
            k = i + 1
            result[i] = (-b * np.cos(k * b) + np.sin(k * b) / k + 
                        a * np.cos(k * a) - np.sin(k * a) / k) / k
        return result
    
    def integrate_t2_times_psi(self, a, b):
        """Compute integral int_a^b (t**2) * psi(t)."""
        # Return shape (num_basis,)
        result = np.zeros(self.num_basis)
        for i in range(self.num_basis):
            # Numerical approximation for integral of t^2 * sin((i+1)*t)
            k = i + 1
            result[i] = ((-b**2 * np.cos(k * b) + 2 * b * np.sin(k * b) / k + 
                         2 * np.cos(k * b) / k**2) - 
                        (-a**2 * np.cos(k * a) + 2 * a * np.sin(k * a) / k + 
                         2 * np.cos(k * a) / k**2)) / k
        return result


basis_functions = ConcreteBasisFunctions(num_basis=3)

ARGS = {}
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 BasisFunctions — 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 BasisFunctions 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
ContinuousSoftmax Ran
ran on a synthesized input · constructed an object; no result was computed
deep-spin/quati/quati/modules/continuous_attention.py
code served (permissive licence) · get_code("88d5d46a3e9f268f")
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, ContinuousSoftmax: 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
from torch import nn

torch.manual_seed(0)

class BasisFunctions:
    """Stand-in basis functions class with required methods."""
    
    def __init__(self, num_basis=3):
        self.num_basis = num_basis
    
    def __len__(self):
        return self.num_basis
    
    def integrate_psi_gaussian(self, mu, sigma_sq):
        """Return expectation of psi under Gaussian."""
        batch_size = mu.shape[0]
        return torch.randn(batch_size, self.num_basis)
    
    def integrate_t_times_psi_gaussian(self, mu, sigma_sq):
        """Return expectation of t * psi under Gaussian."""
        batch_size = mu.shape[0]
        return torch.randn(batch_size, self.num_basis)
    
    def integrate_t2_times_psi_gaussian(self, mu, sigma_sq):
        """Return expectation of t^2 * psi under Gaussian."""
        batch_size = mu.shape[0]
        return torch.randn(batch_size, self.num_basis)


class ContinuousSoftmaxFunction(torch.autograd.Function):

    @classmethod
    def _expectation_phi_psi(cls, ctx, mu, sigma_sq):
        """Compute expectation of phi(t) * psi(t).T under N(mu, sigma_sq)."""
        num_basis = [len(basis_functions) for basis_functions in ctx.psi]
        total_basis = sum(num_basis)
        V = torch.zeros((mu.shape[0], 2, total_basis), dtype=ctx.dtype, device=ctx.device)
        offsets = torch.cumsum(torch.IntTensor(num_basis).to(ctx.device), dim=0)
        start = 0
        for j, basis_functions in enumerate(ctx.psi):
            V[:, 0, start:offsets[j]] = basis_functions.integrate_t_times_psi_gaussian(mu, sigma_sq)
            V[:, 1, start:offsets[j]] = basis_functions.integrate_t2_times_psi_gaussian(mu, sigma_sq)
            start = offsets[j]
        return V

    @classmethod
    def _expectation_psi(cls, ctx, mu, sigma_sq):
        """Compute expectation of psi under N(mu, sigma_sq)."""
        num_basis = [len(basis_functions) for basis_functions in ctx.psi]
        total_basis = sum(num_basis)
        r = torch.zeros(mu.shape[0], total_basis, dtype=ctx.dtype, device=ctx.device)
        offsets = torch.cumsum(torch.IntTensor(num_basis).to(ctx.device), dim=0)
        start = 0
        for j, basis_functions in enumerate(ctx.psi):
            r[:, start:offsets[j]] = basis_functions.integrate_psi_gaussian(mu, sigma_sq)
            start = offsets[j]
        return r

    @classmethod
    def _expectation_phi(cls, ctx, mu, sigma_sq):
        """Compute expectation of phi under N(mu, sigma_sq)."""
        v = torch.zeros(mu.shape[0], 2, dtype=ctx.dtype, device=ctx.device)
        v[:, 0] = mu.squeeze(1)
        v[:, 1] = (mu ** 2 + sigma_sq).squeeze(1)
        return v

    @classmethod
    def forward(cls, ctx, theta, psi):
        ctx.dtype = theta.dtype
        ctx.device = theta.device
        ctx.psi = psi
        sigma_sq = (-0.5 / theta[:, 1]).unsqueeze(1)
        mu = theta[:, 0].unsqueeze(1) * sigma_sq
        r = cls._expectation_psi(ctx, mu, sigma_sq)
        ctx.save_for_backward(mu, sigma_sq, r)
        return r

    @classmethod
    def backward(cls, ctx, grad_output):
        mu, sigma_sq, r = ctx.saved_tensors
        J = cls._expectation_phi_psi(ctx, mu, sigma_sq)
        e_phi = cls._expectation_phi(ctx, mu, sigma_sq)
        e_psi = cls._expectation_psi(ctx, mu, sigma_sq)
        J -= torch.bmm(e_phi.unsqueeze(2), e_psi.unsqueeze(1))
        grad_input = torch.matmul(J, grad_output.unsqueeze(2)).squeeze(2)
        return (grad_input, None)


class ContinuousSoftmax(nn.Module):

    def __init__(self, psi=None):
        super(ContinuousSoftmax, self).__init__()
        self.psi = psi

    def forward(self, theta):
        return ContinuousSoftmaxFunction.apply(theta, self.psi)


# Create basis functions
basis_functions_1 = BasisFunctions(num_basis=3)
basis_functions_2 = BasisFunctions(num_basis=4)
psi_list = [basis_functions_1, basis_functions_2]

ARGS = {
    'psi': psi_list
}
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 ContinuousSoftmax — 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 ContinuousSoftmax 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
ContinuousSoftmaxFunction Ran
ran on a synthesized input · constructed an object; no result was computed
deep-spin/quati/quati/modules/continuous_attention.py
code served (permissive licence) · get_code("2abd421a2409332c")
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, ContinuousSoftmaxFunction: 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 a simple basis functions class that has the required methods
class BasisFunctions(nn.Module):
    def __init__(self, num_basis):
        super().__init__()
        self.num_basis = num_basis
        # Create some learnable parameters for the basis
        self.weights = nn.Parameter(torch.randn(num_basis, 3))
    
    def __len__(self):
        return self.num_basis
    
    def integrate_psi_gaussian(self, mu, sigma_sq):
        """Integrate psi under Gaussian N(mu, sigma_sq)."""
        # Return shape: (batch_size, num_basis)
        batch_size = mu.shape[0]
        return torch.randn(batch_size, self.num_basis)
    
    def integrate_t_times_psi_gaussian(self, mu, sigma_sq):
        """Integrate t * psi under Gaussian N(mu, sigma_sq)."""
        # Return shape: (batch_size, num_basis)
        batch_size = mu.shape[0]
        return torch.randn(batch_size, self.num_basis)
    
    def integrate_t2_times_psi_gaussian(self, mu, sigma_sq):
        """Integrate t^2 * psi under Gaussian N(mu, sigma_sq)."""
        # Return shape: (batch_size, num_basis)
        batch_size = mu.shape[0]
        return torch.randn(batch_size, self.num_basis)


# Create basis functions instances
basis1 = BasisFunctions(3)
basis2 = BasisFunctions(4)
psi_list = [basis1, basis2]

# Create theta tensor: shape (batch_size=2, 2)
# theta[:, 0] is one parameter, theta[:, 1] is another
theta = torch.randn(2, 2, dtype=torch.float32)

ARGS = {
    "ctx": None,  # ctx is created internally in forward/backward
    "theta": theta,
    "psi": psi_list,
}
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 ContinuousSoftmaxFunction — 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 ContinuousSoftmaxFunction 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
ContinuousSparsemax Ran
ran on a synthesized input · constructed an object; no result was computed
deep-spin/quati/quati/modules/continuous_attention.py
code served (permissive licence) · get_code("91ec632f03a8f06b")
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, ContinuousSparsemax: 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
from torch import nn

torch.manual_seed(0)

class BasisFunctions:
    """Stand-in basis functions class with required integration methods."""
    
    def __init__(self, num_basis=3):
        self.num_basis = num_basis
    
    def __len__(self):
        return self.num_basis
    
    def integrate_psi(self, a, b):
        """Integrate psi(t) from a to b. Returns (batch_size, num_basis)."""
        batch_size = a.shape[0]
        return torch.randn(batch_size, self.num_basis, dtype=a.dtype, device=a.device)
    
    def integrate_t_times_psi(self, a, b):
        """Integrate t * psi(t) from a to b. Returns (batch_size, num_basis)."""
        batch_size = a.shape[0]
        return torch.randn(batch_size, self.num_basis, dtype=a.dtype, device=a.device)
    
    def integrate_t2_times_psi(self, a, b):
        """Integrate t^2 * psi(t) from a to b. Returns (batch_size, num_basis)."""
        batch_size = a.shape[0]
        return torch.randn(batch_size, self.num_basis, dtype=a.dtype, device=a.device)


# Create basis functions
basis1 = BasisFunctions(num_basis=3)
basis2 = BasisFunctions(num_basis=2)
psi = [basis1, basis2]

ARGS = {
    "psi": psi,
}
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 ContinuousSparsemax — 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 ContinuousSparsemax 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
ContinuousSparsemaxFunction Ran
ran on a synthesized input · constructed an object; no result was computed
deep-spin/quati/quati/modules/continuous_attention.py
code served (permissive licence) · get_code("45b9c83a5ff5f057")
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, ContinuousSparsemaxFunction: 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)

class BasisFunctions(nn.Module):
    """Stand-in basis functions class that implements required integration methods."""
    
    def __init__(self, num_basis):
        super().__init__()
        self.num_basis = num_basis
    
    def __len__(self):
        return self.num_basis
    
    def integrate_psi(self, a, b):
        """Integrate psi(t) from a to b. Returns shape (batch_size, num_basis)."""
        batch_size = a.shape[0]
        return torch.randn(batch_size, self.num_basis)
    
    def integrate_t_times_psi(self, a, b):
        """Integrate t * psi(t) from a to b. Returns shape (batch_size, num_basis)."""
        batch_size = a.shape[0]
        return torch.randn(batch_size, self.num_basis)
    
    def integrate_t2_times_psi(self, a, b):
        """Integrate t^2 * psi(t) from a to b. Returns shape (batch_size, num_basis)."""
        batch_size = a.shape[0]
        return torch.randn(batch_size, self.num_basis)


# Create basis functions
basis_1 = BasisFunctions(num_basis=3)
basis_2 = BasisFunctions(num_basis=5)
psi = [basis_1, basis_2]

# Create theta: shape (batch_size=2, 2)
# theta[:, 0] is used for mu calculation, theta[:, 1] for sigma calculation
theta = torch.randn(2, 2, dtype=torch.float32)
theta[:, 1] = -torch.abs(theta[:, 1]) - 0.1  # Ensure negative for sqrt(-0.5 / theta[:, 1])

ARGS = {
    'theta': theta,
    'psi': psi,
}
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 ContinuousSparsemaxFunction — 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 ContinuousSparsemaxFunction 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
CosineBasisFunctions Ran
ran on a synthesized input · constructed an object; no result was computed
deep-spin/quati/quati/modules/continuous_attention.py
code served (permissive licence) · get_code("0513653665d957f6")
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, CosineBasisFunctions: 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

torch.manual_seed(0)

# CosineBasisFunctions.__init__ expects omega to be a tensor
# Looking at the code, omega is unsqueezed to shape (1, n_basis_functions)
# So we pass in a 1D tensor that will become (1, n) after unsqueeze(0)
omega = torch.tensor([0.5, 1.0, 1.5, 2.0])

ARGS = {
    "omega": omega
}
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 CosineBasisFunctions — 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 CosineBasisFunctions 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
GaussianBasisFunctions Ran
ran on a synthesized input · constructed an object; no result was computed
deep-spin/quati/quati/modules/continuous_attention.py
code served (permissive licence) · get_code("d4a4993b0f77f70a")
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, GaussianBasisFunctions: 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 math

torch.manual_seed(0)

# Create small tensor arguments for GaussianBasisFunctions
# The constructor expects mu and sigma as tensors
mu = torch.randn(4)  # 4 basis functions
sigma = torch.abs(torch.randn(4)) + 0.1  # 4 sigmas, positive values

ARGS = {
    'mu': mu,
    'sigma': sigma,
}
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 GaussianBasisFunctions — 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 GaussianBasisFunctions 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
PowerBasisFunctions Ran
ran on a synthesized input · constructed an object; no result was computed
deep-spin/quati/quati/modules/continuous_attention.py
code served (permissive licence) · get_code("af4a48bd715bb239")
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, PowerBasisFunctions: 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

torch.manual_seed(0)

# PowerBasisFunctions.__init__ expects degree to be a tensor
# that can be unsqueezed (has a squeeze/unsqueeze method)
# The class uses self.degree in operations like t ** self.degree
# and self.degree.size(1) to get the number of basis functions

degree = torch.tensor([0, 1, 2, 3], dtype=torch.float32)

ARGS = {
    "degree": degree
}
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 PowerBasisFunctions — 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 PowerBasisFunctions 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
SineBasisFunctions Ran
ran on a synthesized input · constructed an object; no result was computed
deep-spin/quati/quati/modules/continuous_attention.py
code served (permissive licence) · get_code("a041cde2266ca5ff")
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, SineBasisFunctions: 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

torch.manual_seed(0)

# SineBasisFunctions.__init__ expects omega to be a tensor
# It calls omega.unsqueeze(0), so omega should be 1D
# The class stores self.omega as a 2D tensor (1, num_basis_functions)
omega = torch.tensor([1.0, 2.0, 3.0, 4.0])

ARGS = {
    'omega': omega
}
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 SineBasisFunctions — 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 SineBasisFunctions 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_gaussian_basis_functions Ran
ran; our contract draft was wrong, not the code
deep-spin/quati/quati/modules/continuous_attention.py
code served (permissive licence) · get_code("b2b0552bda1b4c2d")
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 GaussianBasisFunctions. 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 math

torch.manual_seed(0)

ARGS = {
    'nb_basis': 4,
    'sigmas': [0.1, 0.2],
    'device': None,
}
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 GaussianBasisFunctions — a GaussianBasisFunctions output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a GaussianBasisFunctions 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_power_basis_functions Ran
ran; our contract draft was wrong, not the code
deep-spin/quati/quati/modules/continuous_attention.py
code served (permissive licence) · get_code("4500f4cfd4afb4ee")
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 PowerBasisFunctions. 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

torch.manual_seed(0)

ARGS = {
    "min_d": 0,
    "max_d": 2,
    "device": None,
}
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 PowerBasisFunctions — a PowerBasisFunctions output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PowerBasisFunctions 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_wave_basis_functions Ran
ran; our contract draft was wrong, not the code
deep-spin/quati/quati/modules/continuous_attention.py
code served (permissive licence) · get_code("7811322c90f19d30")
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 tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

ARGS = {
    "nb_waves": 8,
    "wave_b": 10.0,
    "max_seq_len": 100,
    "device": None
}
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 tuple, ndim 1, dtype family float — a tuple 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
ContinuousAttention Not yet run
unverified (harvested, no recorded run)
deep-spin/quati/quati/modules/continuous_attention.py
code served (permissive licence) · get_code("7bc1d8632d6b41c5")
How it ran

no invocation recorded.

ContinuousSparsemax Not yet run
unverified (harvested, no recorded run)
deep-spin/mcan-vqa-continuous-attention/core/model/continuous_sparsemax.py
pointer only (licence: NONE) · get_code("4d564215130f97e9")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deep-spin/mcan-vqa-continuous-attention when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

ContinuousSparsemaxFunction Not yet run
unverified (harvested, no recorded run)
deep-spin/mcan-vqa-continuous-attention/core/model/continuous_sparsemax.py
pointer only (licence: NONE) · get_code("dc6bd3d88b59cbda")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deep-spin/mcan-vqa-continuous-attention when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 15 samples lifted from this paper's linked repositories, 15 carry a function identity and 0 do not. Of the 14 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 14 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

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

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

Repositories linked to this paper

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

Abstract

Exponential families are widely used in machine learning; they include many distributions in continuous and discrete domains (e.g., Gaussian, Dirichlet, Poisson, and categorical distributions via the softmax transformation). Distributions in each of these families have fixed support. In contrast, for finite domains, there has been recent work on sparse alternatives to softmax (e.g. sparsemax and αentmax), which have varying support, being able to assign zero probability to irrelevant categories. This paper expands that work in two directions: first, we extend α-entmax to continuous domains, revealing a link with Tsallis statistics and deformed exponential families. Second, we introduce continuous-domain attention mechanisms, deriving efficient gradient backpropagation algorithms for α ∈ {1, 2}. Experiments on attention-based text classification, machine translation, and visual question answering illustrate the use of continuous attention in 1D and 2D, showing that it allows attending to time intervals and compact regions.

For agents

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

get_harvested_code_for_paper("2006.07214")
get_code_for_paper("2006.07214")
have("2006.07214")

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

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

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

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

Connect an agent — have() is free.