SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2207.09684 · ECCV · 2022

On the Versatile Uses of Partial Distance Correlation in Deep Learning

Vikas Singh, Zihang Meng, Xingjian Zhen, Rudrasis Chakraborty

arXiv · PDF · Open in the Atlas

Code that ran

6 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, 0 violated it and 6 have no contract verdict; 0 failures of our instrument; 2 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/2207.09684.json · badge: /api/ran/2207.09684.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
zhenxingjian/partial_distance_correlation canonical (classifier label)
classifier basis not recorded on the link
6 ran · 2 no recorded run
FunctionStatusWhere it lives
Distance_Correlation Ran
ran on a synthesized input
zhenxingjian/partial_distance_correlation/Partial_Distance_Correlation/Partial_DC.py
code served (permissive licence) · get_code("d6a7ca2043932b32")
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 0, dtype family float, 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 torch.nn.functional as F

torch.manual_seed(0)

# Create small tensors for latent and control
# Both should be 2D tensors (batch_size, feature_dim)
latent = torch.randn(2, 4)
control = torch.randn(2, 4)

ARGS = {
    "latent": latent,
    "control": control
}
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 0, dtype family float, 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
P_Distance_Matrix Ran
ran on a synthesized input
zhenxingjian/partial_distance_correlation/Partial_Distance_Correlation/Partial_DC.py
code served (permissive licence) · get_code("91a148521688e6dd")
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 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 torch

torch.manual_seed(0)

# Create a small latent tensor with shape (2, 4)
# n=2 samples, each with 4-dimensional latent representation
latent = torch.randn(2, 4)

ARGS = {
    "latent": latent
}
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 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
P_Distance_Matrix Ran
ran on a synthesized input
zhenxingjian/partial_distance_correlation/Partial_Distance_Correlation/Partial_DC_grad.py
code served (permissive licence) · get_code("1dd8cdb411590540")
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 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 torch

torch.manual_seed(0)

# Create a small latent tensor with shape (batch_size, latent_dim)
# The function expects a 2D tensor where:
# - dim 0 is the batch dimension (n samples)
# - dim 1 is the latent feature dimension
latent = torch.randn(2, 4)

ARGS = {
    "latent": latent
}
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 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
bracket_op Ran
ran on a synthesized input
zhenxingjian/partial_distance_correlation/Partial_Distance_Correlation/Partial_DC.py
code served (permissive licence) · get_code("19c9bc4a8add35e1")
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 0, dtype family float, 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 torch.nn as nn

torch.manual_seed(0)

# Create two square matrices of the same size
# The function divides by n * (n - 3), so we need n >= 4 to avoid division issues
# Using n=5 for safety and to avoid n-3=0 or n-3=1 edge cases
n = 5

matrix_A = torch.randn(n, n)
matrix_B = torch.randn(n, n)

ARGS = {
    "matrix_A": matrix_A,
    "matrix_B": matrix_B,
}
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 0, dtype family float, 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
make_pairwise_metrics Ran
ran on a synthesized input
zhenxingjian/partial_distance_correlation/Partial_Distance_Correlation/main_similarity.py
code served (permissive licence) · get_code("2870376b8032253c")
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. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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
from torchmetrics import Metric, BootStrapper

torch.manual_seed(0)

# Mock implementation of New_DC since it's referenced but not defined
def New_DC(X, Y):
    return torch.tensor(0.5)

# Create mock hook objects
class MockHook:
    def __init__(self, name):
        self.name = name
    
    def __repr__(self):
        return f"MockHook({self.name})"

# Create lists of hooks with different sizes to distinguish them
mod1_hooks = [MockHook(f"hook_1_{i}") for i in range(3)]
mod2_hooks = [MockHook(f"hook_2_{i}") for i in range(2)]

ARGS = {
    "mod1_hooks": mod1_hooks,
    "mod2_hooks": mod2_hooks,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, torchmetrics — 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
reshape_transform Ran
ran on a synthesized input
zhenxingjian/partial_distance_correlation/Partial_Distance_Correlation/main_CAM.py
code served (permissive licence) · get_code("2af53fce5490aa77")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 4, dtype family float, shape (2, 4, 14, 14) 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

torch.manual_seed(0)

# The function expects:
# - tensor: a 3D tensor with shape (batch_size, seq_len, channels)
#   The function slices [:, 1:, :] so we need at least 2 in dim 1
#   Then reshapes to (batch_size, height, width, channels)
#   Then transposes dimensions
# - height: int (default 14)
# - width: int (default 14)

# Create a tensor that satisfies the reshape logic:
# tensor.size(0) = batch_size = 2
# tensor.size(1) = seq_len, must be > 1 (sliced as [:, 1:, :])
# tensor.size(2) = channels = 4
# After slicing [:, 1:, :], we get (2, seq_len-1, 4)
# We reshape to (2, height, width, 4) so seq_len-1 = height*width = 14*14 = 196
# Therefore seq_len = 197

batch_size = 2
seq_len = 197
channels = 4
height = 14
width = 14

tensor = torch.randn(batch_size, seq_len, channels)

ARGS = {
    "tensor": tensor,
    "height": height,
    "width": width,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 4, 14, 14) — shape (2, 4, 14, 14) 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_dataset Not yet run
unverified (harvested, no recorded run)
zhenxingjian/partial_distance_correlation/Partial_Distance_Correlation/main_pDC_models.py
code served (permissive licence) · get_code("9e7b15eb05cf47df")
How it ran

no invocation recorded.

get_normalize_layer Not yet run
unverified (harvested, no recorded run)
zhenxingjian/partial_distance_correlation/Partial_Distance_Correlation/main_pDC_models.py
code served (permissive licence) · get_code("ad49e7ad3bdf5f43")
How it ran

no invocation recorded.

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, 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 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.

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

Comparing the functional behavior of neural network models, whether it is a single network over time or two (or more networks) during or post-training, is an essential step in understanding what they are learning (and what they are not), and for identifying strategies for regularization or efficiency improvements. Despite recent progress, e.g., comparing vision transformers to CNNs, systematic comparison of function, especially across different networks, remains difficult and is often carried out layer by layer. Approaches such as canonical correlation analysis (CCA) are applicable in principle, but have been sparingly used so far. In this paper, we revisit a (less widely known) from statistics, called distance correlation (and its partial variant), designed to evaluate correlation between feature spaces of different dimensions. We describe the steps necessary to carry out its deployment for large scale models -this opens the door to a surprising array of applications ranging from conditioning one deep model w.r.t. another, learning disentangled representations as well as optimizing diverse models that would directly be more robust to adversarial attacks. Our experiments suggest a versatile regularizer (or constraint) with many advantages, which avoids some of the common difficulties one faces in such analyses 1 .

For agents

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

get_harvested_code_for_paper("2207.09684")
get_code_for_paper("2207.09684")
have("2207.09684")

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

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

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

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

Connect an agent — have() is free.