SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2004.01902 · 2020

Rational neural networks

arXiv · PDF · Open in the Atlas

Code that ran

8 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 1 violated it and 6 have no contract verdict; 1 failure of our instrument; 0 no recorded run), measured 2026-11-21; 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/2004.01902.json · badge: /api/ran/2004.01902.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
NBoulle/RationalNets canonical (classifier label)
classifier basis: census
8 ran · 0 no recorded run
FunctionStatusWhere it lives
figsize Ran
ran, violated the contract we drafted
NBoulle/RationalNets/src/Approximation/plotting.py
code served (permissive licence) · get_code("a7083d5006bc1338")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned list, 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 numpy as np

ARGS = {
    'scale': 1.5,
    'nplots': 2
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
Imports
numpy — 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 float — 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
initialize_NN Ran
ran on a synthesized input
NBoulle/RationalNets/src/Approximation/KdV_poly.py
code served (permissive licence) · get_code("5572f8d4233a59d5")
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. 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 tensorflow as tf
import numpy as np

# Set seeds for reproducibility
np.random.seed(0)
tf.random.set_seed(0)

# The function takes a 'layers' parameter which is a list of integers
# representing the layer dimensions of a neural network
# Based on the function body, it iterates through consecutive pairs of layers
# and creates weight matrices and bias vectors
layers = [4, 8, 6, 3]  # Example architecture: input 4 -> hidden 8 -> hidden 6 -> output 3

ARGS = {
    "layers": layers
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — 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: none by the harness; any seed is in the setup block
neural_net Ran
ran on a synthesized input
NBoulle/RationalNets/src/Approximation/KdV_relu.py
code served (permissive licence) · get_code("75f6dfce852d99cd")
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 EagerTensor, ndim 2, dtype family float, shape (2, 2) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tensorflow as tf
import numpy as np

# Set seed for reproducibility
tf.random.set_seed(0)

# Define input X: batch_size=2, input_dim=4
X = tf.constant([[1.0, 2.0, 3.0, 4.0],
                  [5.0, 6.0, 7.0, 8.0]], dtype=tf.float32)

# Define weights for a 3-layer network
# Layer 0: 4 -> 5
# Layer 1: 5 -> 3
# Layer 2: 3 -> 2 (output)
weights = [
    tf.constant(np.random.randn(4, 5).astype(np.float32)),
    tf.constant(np.random.randn(5, 3).astype(np.float32)),
    tf.constant(np.random.randn(3, 2).astype(np.float32))
]

# Define biases for each layer
biases = [
    tf.constant(np.random.randn(5).astype(np.float32)),
    tf.constant(np.random.randn(3).astype(np.float32)),
    tf.constant(np.random.randn(2).astype(np.float32))
]

ARGS = {
    "X": X,
    "weights": weights,
    "biases": biases
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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, shape (2, 2) — shape (2, 2) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
neural_net Ran
ran on a synthesized input
NBoulle/RationalNets/src/Approximation/KdV_sine.py
code served (permissive licence) · get_code("09a3613cfdf9d121")
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 EagerTensor, ndim 2, dtype family float, shape (2, 2) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tensorflow as tf
import numpy as np

# Set random seeds for reproducibility
np.random.seed(0)
tf.random.set_seed(0)

# Define small input tensor X (batch_size=2, input_dim=4)
X = tf.constant([[1.0, 2.0, 3.0, 4.0],
                 [5.0, 6.0, 7.0, 8.0]], dtype=tf.float32)

# Define weights list - 3 weight matrices for a 3-layer network
# Layer 0: input_dim=4 -> hidden_dim=5
# Layer 1: hidden_dim=5 -> hidden_dim=3
# Layer 2: hidden_dim=3 -> output_dim=2
weights = [
    tf.constant(np.random.randn(4, 5).astype(np.float32)),
    tf.constant(np.random.randn(5, 3).astype(np.float32)),
    tf.constant(np.random.randn(3, 2).astype(np.float32))
]

# Define biases list - one bias vector for each layer
biases = [
    tf.constant(np.random.randn(5).astype(np.float32)),
    tf.constant(np.random.randn(3).astype(np.float32)),
    tf.constant(np.random.randn(2).astype(np.float32))
]

ARGS = {
    'X': X,
    'weights': weights,
    'biases': biases
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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, shape (2, 2) — shape (2, 2) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
newfig Ran
ran; our contract draft was wrong, not the code
NBoulle/RationalNets/src/Approximation/plotting.py
code served (permissive licence) · get_code("5f2fe5254661d168")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) 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 numpy as np
import matplotlib.pyplot as plt

# The newfig function takes two parameters:
# 1. width: a scale factor (numeric)
# 2. nplots: number of plots (integer, default=1)

# Based on the function body, width is used as a scale parameter
# and nplots is used to determine the figure height

ARGS = {
    'width': 1.5,
    'nplots': 2
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
Imports
matplotlib, numpy — 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
rat_init Ran
ran on a synthesized input
NBoulle/RationalNets/src/Approximation/KdV_poly.py
code served (permissive licence) · get_code("25351cc2e570b1b3")
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 list, 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

# Construct arguments for rat_init function
# The function iterates over layers[:-2] and creates tf.Variable objects
# from coefficients in initP

# layers parameter: a list where len(layers) determines num_layers
# The function uses: len(layers) and iterates range(0, num_layers - 2)
layers = [10, 20, 15, 8]  # 4 layers means loop runs for l in range(0, 2)

# initP parameter: a list of coefficients that will be wrapped in tf.Variable
# Each element should be something that can be passed to tf.Variable([coeffs], dtype=tf.float32)
initP = [1.5, 2.3, 0.8]  # 3 coefficients

ARGS = {
    "layers": layers,
    "initP": initP
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 2, dtype family float — 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
rat_init Ran
ran on a synthesized input
NBoulle/RationalNets/src/Approximation/KdV_rat.py
code served (permissive licence) · get_code("5765a539e4d4991b")
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 3, 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

# Build minimal valid arguments for rat_init

# layers: a list that the function checks len() on
# The function iterates range(0, num_layers - 2), so we need at least 2 layers
# to avoid an empty range. Let's use 4 layers for a meaningful iteration.
layers = [10, 20, 30, 40]

# initP: a list of coefficients that will be wrapped in tf.Variable([coeffs], ...)
# The function iterates over initP and creates a Variable for each element
# Let's create a few simple numeric coefficients
initP = [1.0, 2.0, 3.0]

# initQ: similar to initP, a list of coefficients
initQ = [0.5, 1.5, 2.5]

ARGS = {
    "layers": layers,
    "initP": initP,
    "initQ": initQ,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 3, 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
xavier_init Ran
ran on a synthesized input
NBoulle/RationalNets/src/Approximation/KdV_poly.py
code served (permissive licence) · get_code("df01ac91ccf49144")
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 ResourceVariable, ndim 2, dtype family float, shape (4, 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 tensorflow as tf
import numpy as np

ARGS = {
    "size": (4, 3)
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ResourceVariable, ndim 2, dtype family float, shape (4, 3) — shape (4, 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

Also present in other papers' code

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

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

FunctionAlso present inEarliest-datedOthers named
figsize 8 other papers
5 dated earlier, 3 later
1711.10561 (2017-11)
Physics Informed Deep Learning (Part I): Data-driven Solutions of Nonlinear Partial Differential Equations
1711.10566 (2017-11)
Physics Informed Deep Learning (Part II): Data-driven Discovery of Nonlinear Partial Differential Equations
1804.07010 (2018-04)
Forward-Backward Stochastic Neural Networks: Deep Learning of High-dimensional Partial Differential Equations
and 5 more not named here
newfig 7 other papers
5 dated earlier, 2 later
1711.10561 (2017-11)
Physics Informed Deep Learning (Part I): Data-driven Solutions of Nonlinear Partial Differential Equations
1711.10566 (2017-11)
Physics Informed Deep Learning (Part II): Data-driven Discovery of Nonlinear Partial Differential Equations
1804.07010 (2018-04)
Forward-Backward Stochastic Neural Networks: Deep Learning of High-dimensional Partial Differential Equations
and 4 more not named here

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

Repositories linked to this paper

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

Abstract

We consider neural networks with rational activation functions. The choice of the nonlinear activation function in deep learning architectures is crucial and heavily impacts the performance of a neural network. We establish optimal bounds in terms of network complexity and prove that rational neural networks approximate smooth functions more efficiently than ReLU networks with exponentially smaller depth. The flexibility and smoothness of rational activation functions make them an attractive alternative to ReLU, as we demonstrate with numerical experiments.

For agents

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

get_harvested_code_for_paper("2004.01902")
get_code_for_paper("2004.01902")
have("2004.01902")

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

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

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

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

Connect an agent — have() is free.