SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2106.09309 · 2021

Layer Folding: Neural Network Depth Reduction using Activation Linearization

arXiv · PDF · Open in the Atlas

Code that ran

9 of 12 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 7 have no contract verdict; 2 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/2106.09309.json · badge: /api/ran/2106.09309.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
LayerFolding/Layer-Folding canonical (classifier label)
classifier basis: census
9 ran · 3 no recorded run
FunctionStatusWhere it lives
bytes_list_feature Ran
ran on a synthesized input
LayerFolding/Layer-Folding/Folded-Mobilenets/dataset_utils.py
code served (permissive licence) · get_code("ebb225e100d48e3d")
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 Feature. 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.compat.v1 as tf

# The bytes_list_feature function takes a 'values' parameter
# which should be a string or list of strings.
# The function passes it to tf.train.BytesList(value=values)
# BytesList expects a list of bytes objects.

# Create test data: a list of byte strings
values = [b'hello', b'world', b'test']

ARGS = {
    'values': values
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Feature — a Feature output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Feature 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
conv Ran
ran on a synthesized input
LayerFolding/Layer-Folding/ResNet_Cifar10_postfold.py
code served (permissive licence) · get_code("9e4ed0ee1e56b044")
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 Conv2d. 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": 3,
    "out_channels": 64,
    "stride": 1,
    "kernel": 3,
    "bias": False,
}
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 Conv2d — a Conv2d output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Conv2d 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
conv5x5 Ran
ran on a synthesized input
LayerFolding/Layer-Folding/VGG_Cifar10_postfold.py
code served (permissive licence) · get_code("09dcc50c884b217d")
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 Conv2d. 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": 3,
    "out_channels": 64,
    "stride": 1,
    "bias": False,
}
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 Conv2d — a Conv2d output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Conv2d 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
expand_input_by_factor Ran
ran on a synthesized input
LayerFolding/Layer-Folding/Folded-Mobilenets/conv_blocks.py
code served (permissive licence) · get_code("2bd76ec2dd72540c")
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 function. 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 function expand_input_by_factor takes parameters:
# - n: a numeric multiplier
# - divisible_by: an integer divisor (default 8)

# The function returns a lambda that takes num_inputs and **_
# and calls _make_divisible(num_inputs * n, divisible_by)

# So we need to provide:
# - n: a number (e.g., 2)
# - divisible_by: a divisor (e.g., 8)

ARGS = {
    "n": 2,
    "divisible_by": 8
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
float_list_feature Ran
ran on a synthesized input
LayerFolding/Layer-Folding/Folded-Mobilenets/dataset_utils.py
code served (permissive licence) · get_code("a937f6f8be8fc311")
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 Feature. 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.compat.v1 as tf

# The function takes 'values' parameter which should be a float or list of floats
# Looking at the function body, it passes 'values' to tf.train.FloatList(value=values)
# This expects an iterable of floats

# Create a list of floats as the values argument
values = [1.5, 2.3, 3.7, 4.2]

ARGS = {
    "values": values
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Feature — a Feature output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Feature 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
int64_feature Ran
ran; our contract draft was wrong, not the code
LayerFolding/Layer-Folding/Folded-Mobilenets/dataset_utils.py
code served (permissive licence) · get_code("537870c8bbcd9607")
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 Feature. 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.compat.v1 as tf

# The function int64_feature takes a 'values' parameter
# It accepts either a scalar or a list of values
# The function converts it to a list if it's not already a tuple/list
# Then creates a TF-Feature with int64_list

# Test case 1: scalar value
scalar_value = 42

# Test case 2: list of values
list_values = [1, 2, 3, 4, 5]

# We'll use the list case as it tests the more general functionality
ARGS = {
    "values": list_values
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Feature — a Feature output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Feature 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
make_layers Ran
ran on a synthesized input
LayerFolding/Layer-Folding/VGG_Cifar10_postfold.py
code served (permissive licence) · get_code("718e3968934c45b7")
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 Sequential. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# cfg: List[Union[str, int]]
# A typical VGG-like configuration with conv layers and max pooling
cfg = [64, 'M', 128, 128, 'M', 256, 256, 'M']

# batch_norm: bool
batch_norm = True

ARGS = {
    'cfg': cfg,
    'batch_norm': batch_norm,
}
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 Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
preprocess_image Ran
ran on a synthesized input
LayerFolding/Layer-Folding/Folded-Mobilenets/preprocessing.py
code served (permissive licence) · get_code("3ef89f5a98a3352d")
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 SymbolicTensor. 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.compat.v1 as tf
import numpy as np

tf.disable_v2_behavior()

# Create a small test image tensor with shape [height, width, channels]
# Using distinct dimensions: 8x6x3 so we can distinguish height/width/channels
image_data = np.random.randint(0, 256, size=(8, 6, 3), dtype=np.uint8)
image = tf.constant(image_data, dtype=tf.uint8)

# Convert to the proper dtype that the function expects (uint8 or similar)
image = tf.cast(image, tf.uint8)

image_size = 224
resize_method = None  # Will use bicubic by default

ARGS = {
    "image": image,
    "image_size": image_size,
    "resize_method": resize_method,
}
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 SymbolicTensor — a SymbolicTensor 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
wrapped_partial Ran
ran; our contract draft was wrong, not the code
LayerFolding/Layer-Folding/Folded-Mobilenets/mobilenet_v2.py
code served (permissive licence) · get_code("b6e06004f7efe660")
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 partial. 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 functools
import torch

def example_function(x, y, z=10):
    """A simple function to partially wrap"""
    return x + y + z

def another_function(a, b, c=5):
    """Another function for testing"""
    return a * b + c

torch.manual_seed(0)

ARGS = {
    "func": example_function,
    "args": (5, 3),
    "kwargs": {"z": 20}
}
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 partial — a partial output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a partial 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
vgg16 Not yet run
unverified (harvested, no recorded run)
LayerFolding/Layer-Folding/VGG_Cifar10_prefold.py
code served (permissive licence) · get_code("58bbc7ac2c2a5474")
How it ran

no invocation recorded.

vgg19 Not yet run
unverified (harvested, no recorded run)
LayerFolding/Layer-Folding/VGG_Cifar10_postfold.py
code served (permissive licence) · get_code("1ad77b38966daedd")
How it ran

no invocation recorded.

vgg19 Not yet run
unverified (harvested, no recorded run)
LayerFolding/Layer-Folding/VGG_Cifar10_prefold.py
code served (permissive licence) · get_code("50714c640ea17fb6")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 1 later) and 8 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
wrapped_partial 8 other papers
6 dated earlier, 2 later
1701.06487 (2017-01)
Dirty Pixels: Towards End-to-End Image Processing and Perception
1703.07737 (2017-03)
In Defense of the Triplet Loss for Person Re-Identification
1710.06081 (2017-10)
Boosting Adversarial Attacks with Momentum
and 5 more not named here
int64_feature 2 other papers
2 dated earlier
1608.06993 (2016-08)
Densely Connected Convolutional Networks
1904.07850 (2019-04)
Objects as Points
expand_input_by_factor 1 other paper
1 dated earlier
1808.00897 (2018-08)
BiSeNet: Bilateral Segmentation Network for Real-time Semantic Segmentation

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

Despite the increasing prevalence of deep neural networks, their applicability in resource-constrained devices is limited due to their computational load. While modern devices exhibit a high level of parallelism, real-time latency is still highly dependent on networks' depth. Although recent works show that below a certain depth, the width of shallower networks must grow exponentially, we presume that neural networks typically exceed this minimal depth to accelerate convergence and incrementally increase accuracy. This motivates us to transform pre-trained deep networks that already exploit such advantages into shallower forms. We propose a method that learns whether non-linear activations can be removed, allowing to fold consecutive linear layers into one. We apply our method to networks pre-trained on CIFAR-10 and CIFAR-100 and find that they can all be transformed into shallower forms that share a similar depth. Finally, we use our method to provide more efficient alternatives to MobileNetV2 and EfficientNet-Lite architectures on the ImageNet classification task.

For agents

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

get_harvested_code_for_paper("2106.09309")
get_code_for_paper("2106.09309")
have("2106.09309")

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

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

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

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

Connect an agent — have() is free.