SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2205.09671 · 2022

A graph-transformer for whole slide image classification

arXiv · PDF · Open in the Atlas

Code that ran

10 of 10 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; 1 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 4 failures of our instrument; 0 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/2205.09671.json · badge: /api/ran/2205.09671.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
vkola-lab/tmi2022 canonical (classifier label)
classifier basis not recorded on the link
10 ran · 0 no recorded run
FunctionStatusWhere it lives
adj_matrix Ran
ran on a synthesized input
vkola-lab/tmi2022/feature_extractor/build_graphs.py
code served (permissive licence) · get_code("52cdef895690da2c")
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 (4, 4) as a later run recorded it. 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, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# The function expects csv_file_path to be a list of file paths
# It extracts coordinates from filenames like "x_y.csv"
# It builds an adjacency matrix based on whether coordinates are within distance 1

csv_file_path = [
    "/path/to/0_0.csv",
    "/path/to/1_0.csv",
    "/path/to/1_1.csv",
    "/path/to/5_5.csv"
]

output = None

ARGS = {
    "csv_file_path": csv_file_path,
    "output": output
}
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 Tensor, ndim 2, dtype family float, shape (4, 4) — shape (4, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
bag_dataset Ran
ran; our contract draft was wrong, not the code
vkola-lab/tmi2022/feature_extractor/build_graphs.py
code served (permissive licence) · get_code("e383c38d070af79f")
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
import tempfile
import os
from PIL import Image
import numpy as np

torch.manual_seed(0)

# Create temporary directory with dummy images
temp_dir = tempfile.mkdtemp()
csv_file_path = []

# Create a few dummy image files
for i in range(3):
    img_array = np.random.randint(0, 256, (64, 64, 3), dtype=np.uint8)
    img = Image.fromarray(img_array)
    img_path = os.path.join(temp_dir, f"image_{i}.png")
    img.save(img_path)
    csv_file_path.append(img_path)

# Create args object with required attributes
class Args:
    def __init__(self):
        self.batch_size = 2
        self.num_workers = 0

args = Args()

ARGS = {
    "args": args,
    "csv_file_path": csv_file_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch, torchvision — 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
cam_to_mask Ran
ran on a synthesized input
vkola-lab/tmi2022/src/vis_graphcam.py
code served (permissive licence) · get_code("0c4725cf9e1614b0")
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 ndarray, ndim 2, dtype family float, shape (100, 120) 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 numpy as np

# Construct arguments for cam_to_mask function
# gray: numpy array (grayscale image)
# patches: list of patch identifiers with format "x_y.ext"
# cam_matrix: numpy array with shape (num_patches, 1) containing CAM values
# w: image width
# h: image height
# w_s: patch width stride (width of each patch in pixels)
# h_s: patch height stride (height of each patch in pixels)

# Create a small grayscale image
gray = np.zeros((100, 120), dtype=np.float32)

# Create patches list with identifiers in "x_y.ext" format
# Using patches that are within bounds (not at edges)
patches = [
    "10_10.jpg",
    "15_12.jpg",
    "8_8.jpg",
    "20_15.jpg"
]

# Create CAM matrix with values for each patch
cam_matrix = np.array([
    [0.5],
    [0.7],
    [0.3],
    [0.9]
], dtype=np.float32)

# Image dimensions
w = 120  # width in pixels
h = 100  # height in pixels

# Patch stride dimensions
w_s = 8   # width stride (each patch is 8 pixels wide)
h_s = 10  # height stride (each patch is 10 pixels tall)

ARGS = {
    "gray": gray,
    "patches": patches,
    "cam_matrix": cam_matrix,
    "w": w,
    "h": h,
    "w_s": w_s,
    "h_s": h_s
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (100, 120) — shape (100, 120) 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
collate Ran
ran on a synthesized input
vkola-lab/tmi2022/helper.py
code served (permissive licence) · get_code("cd1f597238e8dea4")
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 dict. 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)

# Create sample batch data
batch = [
    {
        'image': torch.randn(4, 3),
        'label': torch.tensor(0),
        'id': 'sample_0',
        'adj_s': torch.randn(4, 4)
    },
    {
        'image': torch.randn(4, 3),
        'label': torch.tensor(1),
        'id': 'sample_1',
        'adj_s': torch.randn(4, 4)
    }
]

ARGS = {
    'batch': batch
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
compute_rollout_attention Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
vkola-lab/tmi2022/models/ViT.py
code served (permissive licence) · get_code("927e684e71ca3ee9")
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 Tensor, ndim 3, dtype family float, shape (2, 5, 5) 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)

batch_size = 2
num_tokens = 5
num_layers = 3

# Create a list of attention matrices, one per layer
# Each matrix is of shape (batch_size, num_tokens, num_tokens)
all_layer_matrices = []
for i in range(num_layers):
    # Create random attention-like matrices (should sum to 1 along last dim for realism, but not required)
    attn_matrix = torch.rand(batch_size, num_tokens, num_tokens)
    attn_matrix = attn_matrix / attn_matrix.sum(dim=-1, keepdim=True)
    all_layer_matrices.append(attn_matrix)

start_layer = 1

ARGS = {
    'all_layer_matrices': all_layer_matrices,
    'start_layer': start_layer
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 5, 5) — shape (2, 5, 5) 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
preparefeatureLabel Ran
ran on a synthesized input
vkola-lab/tmi2022/helper.py
code served (permissive licence) · get_code("7d76114278992e2e")
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. 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 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)

# batch_graph: list of tensors, each with shape (num_nodes, n_features)
batch_graph = [
    torch.randn(3, 512),  # Graph 1 with 3 nodes, 512 features
    torch.randn(2, 512),  # Graph 2 with 2 nodes, 512 features
]

# batch_label: list of class labels
batch_label = [0, 1]

# batch_adjs: list of adjacency matrices, each with shape (num_nodes, num_nodes)
batch_adjs = [
    torch.randn(3, 3),  # Adjacency for graph 1
    torch.randn(2, 2),  # Adjacency for graph 2
]

# n_features: number of node features
n_features = 512

ARGS = {
    "batch_graph": batch_graph,
    "batch_label": batch_label,
    "batch_adjs": batch_adjs,
    "n_features": n_features,
}
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 — 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
safe_divide Ran
ran, honoured the contract we drafted
vkola-lab/tmi2022/models/layers.py
code served (permissive licence) · get_code("507e144112f81dc6")
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, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function safe_divide takes two tensors a and b
# It performs element-wise division with clamping and masking operations
# Both parameters should be torch tensors with numeric values

a = torch.randn(2, 4)
b = torch.randn(2, 4)

ARGS = {
    "a": a,
    "b": 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 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
show_cam_on_image Ran
ran on a synthesized input
vkola-lab/tmi2022/src/vis_graphcam.py
code served (permissive licence) · get_code("ad7b295017b82497")
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 ndarray, ndim 3, dtype family float, shape (4, 3, 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 numpy as np
import cv2

# Create a sample image (img parameter)
# The function uses img in: cam = heatmap + np.float32(img)
# So it should be a numpy array that can be added to a heatmap
# heatmap comes from cv2.applyColorMap which returns BGR image (3 channels)
# So img should be shape (height, width, 3) with values in [0, 1] range
img = np.random.rand(4, 3, 3).astype(np.float32)

# Create a mask (mask parameter)
# The function uses mask in: heatmap = cv2.applyColorMap(np.uint8(255 * mask), ...)
# mask is multiplied by 255 and converted to uint8
# cv2.applyColorMap expects a 2D array (grayscale)
# So mask should be shape (height, width) with values in [0, 1] range
mask = np.random.rand(4, 3).astype(np.float32)

ARGS = {
    "img": img,
    "mask": mask
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cv2, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 3, dtype family float, shape (4, 3, 3) — shape (4, 3, 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
trunc_normal_ Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
vkola-lab/tmi2022/models/ViT.py
code served (permissive licence) · get_code("a3cdd23a719c231f")
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, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import warnings

torch.manual_seed(0)

# Create a tensor to be filled with truncated normal values
tensor = torch.empty(2, 4)

# Define arguments for trunc_normal_
ARGS = {
    "tensor": tensor,
    "mean": 0.0,
    "std": 1.0,
    "a": -2.0,
    "b": 2.0
}
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, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
xml_read_labels Ran
ran; our contract draft was wrong, not the code
vkola-lab/tmi2022/src/tile_WSI.py
pointer only (licence: MIT); the stored copy get_code serves, from HKU-MedAI/WSI-HGNN, is pointer only (licence: NONE) · get_code("8ce93d785861725e")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from HKU-MedAI/WSI-HGNN, and GitHub detected no licence in that repository 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. A run is recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 5 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 1 the same month, 5 later) and 5 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
trunc_normal_ 160 other papers
34 dated earlier, 4 the same month, 121 later, 1 same year, order not determinable · 36 only as an assembly brick
1911.10194 (2019-11)
Panoptic-DeepLab: A Simple, Strong, and Fast Baseline for Bottom-Up Panoptic Segmentation
2005.10242 (2020-05)
Understanding Contrastive Representation Learning through Alignment and Uniformity on the Hypersphere
2007.12911 (2020-07)
Tighter risk certificates for neural networks
and 157 more not named here
safe_divide 6 other papers
4 dated earlier, 2 later · 4 only as an assembly brick
2103.14030 (2021-03)
Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
2104.11227 (2021-04)
Multiscale Vision Transformers
2201.04676 (2022-01)
UniFormer: Unified Transformer for Efficient Spatiotemporal Representation Learning
and 3 more not named here
compute_rollout_attention 4 other papers
4 later
2206.10552 (2022-06)
Vicinity Vision Transformer
2308.06248 (2023-08)
FunnyBirds: A Synthetic Vision Dataset for a Part-Based Analysis of Explainable AI Methods
2407.11910 (2024-07)
Benchmarking the Attribution Quality of Vision Models
and 1 more not named here
bag_dataset 1 other paper
1 later
2602.01951 (2026-02)
Enabling Progressive Whole-slide Image Analysis with Multi-scale Pyramidal Network
xml_read_labels 1 other paper
1 later
2307.04189 (2023-07)
Histopathology Whole Slide Image Analysis with Heterogeneous Graph Representation Learning

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

Deep learning is a powerful tool for whole slide image (WSI) analysis. Typically, when performing supervised deep learning, a WSI is divided into small patches, trained and the outcomes are aggregated to estimate disease grade. However, patch-based methods introduce label noise during training by assuming that each patch is independent with the same label as the WSI and neglect overall WSI-level information that is significant in disease grading. Here we present a Graph-Transformer (GT) that fuses a graph-based representation of an WSI and a vision transformer for processing pathology images, called GTP, to predict disease grade. We selected $4,818$ WSIs from the Clinical Proteomic Tumor Analysis Consortium (CPTAC), the National Lung Screening Trial (NLST), and The Cancer Genome Atlas (TCGA), and used GTP to distinguish adenocarcinoma (LUAD) and squamous cell carcinoma (LSCC) from adjacent non-cancerous tissue (normal). First, using NLST data, we developed a contrastive learning framework to generate a feature extractor. This allowed us to compute feature vectors of individual WSI patches, which were used to represent the nodes of the graph followed by construction of the GTP framework. Our model trained on the CPTAC data achieved consistently high performance on three-label classification (normal versus LUAD versus LSCC: mean accuracy$= 91.2$ $\pm$ $2.5\%$) based on five-fold cross-validation, and mean accuracy $= 82.3$ $\pm$ $1.0\%$ on external test data (TCGA). We also introduced a graph-based saliency mapping technique, called GraphCAM, that can identify regions that are highly associated with the class label. Our findings demonstrate GTP as an interpretable and effective deep learning framework for WSI-level classification.

For agents

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

get_harvested_code_for_paper("2205.09671")
get_code_for_paper("2205.09671")
have("2205.09671")

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

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

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

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

Connect an agent — have() is free.