Repository Analysis

keras-team/keras

Deep Learning for humans

24.7 Moderate AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of keras-team/keras, a Python project with 64,171 GitHub stars. SynthScan v2.0 examined 326,365 lines of code across 1015 source files, recording 7391 pattern matches distributed across 20 syntactic categories. The overall adjusted score of 24.7 places this repository in the Moderate AI signal band.

The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).

24.7
Adjusted Score
24.7
Raw Score
100%
Time Factor
2026-07-14
Last Push
64.2K
Stars
Python
Language
326.4K
Lines of Code
1.0K
Files
7.4K
Pattern Hits
2026-07-14
Scan Date
0.38
HC Hit Rate

What These Metrics Mean

Adjusted Score
Primary synthetic code indicator. Raw score normalised per 1,000 lines of code and multiplied by the temporal discount factor. This is the definitive comparative metric — use it to rank repositories by AI authorship density.
Raw Score
The unmodified sum of all severity-weighted, context-multiplied pattern match scores before temporal discounting. Reflects the absolute signal strength independent of when the repository was last active.
Time Factor
The temporal discount multiplier (0–100%) applied to the raw score. Repositories last updated before ChatGPT's launch (Nov 2022) receive a 5% factor. Full signal is only assigned to repositories active in the post-adoption era (Jan 2024+).
Pattern Hits
Total count of individual pattern matches across all files and categories. A high hit count with a low score may indicate a very large codebase with isolated AI snippets; a low count with a high score indicates dense, concentrated AI signatures.
HC Hit Rate
High+Critical pattern hits per file, averaged across the repository. This orthogonal signal catches repositories where a few files are densely packed with high-severity AI tells — a strong indicator even when the normalised score appears moderate due to codebase size.
Lines of Code / Files
Total lines and files analysed. The scanner examines 94 file extensions. These denominators are used to normalise the score, enabling fair comparison between repositories of vastly different sizes.

Score History

This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.

Severity Breakdown

Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.

CRITICAL 0HIGH 382MEDIUM 148LOW 6861

Directory Score Breakdown

This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.

Pattern Findings

The scanner identified 7391 distinct pattern matches across 20 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.

Unused Imports3708 hits · 2617 pts
SeverityFileLineSnippetContext
LOWpip_build.py29CODE
LOWkeras/__init__.py9CODE
LOWkeras/__init__.py10CODE
LOWkeras/api/__init__.py7CODE
LOWkeras/api/__init__.py8CODE
LOWkeras/api/__init__.py9CODE
LOWkeras/api/__init__.py10CODE
LOWkeras/api/__init__.py11CODE
LOWkeras/api/__init__.py12CODE
LOWkeras/api/__init__.py13CODE
LOWkeras/api/__init__.py14CODE
LOWkeras/api/__init__.py15CODE
LOWkeras/api/__init__.py16CODE
LOWkeras/api/__init__.py17CODE
LOWkeras/api/__init__.py18CODE
LOWkeras/api/__init__.py19CODE
LOWkeras/api/__init__.py20CODE
LOWkeras/api/__init__.py21CODE
LOWkeras/api/__init__.py22CODE
LOWkeras/api/__init__.py23CODE
LOWkeras/api/__init__.py24CODE
LOWkeras/api/__init__.py25CODE
LOWkeras/api/__init__.py26CODE
LOWkeras/api/__init__.py27CODE
LOWkeras/api/__init__.py28CODE
LOWkeras/api/__init__.py29CODE
LOWkeras/api/__init__.py30CODE
LOWkeras/api/__init__.py31CODE
LOWkeras/api/__init__.py32CODE
LOWkeras/api/__init__.py33CODE
LOWkeras/api/__init__.py34CODE
LOWkeras/api/__init__.py35CODE
LOWkeras/api/__init__.py36CODE
LOWkeras/api/__init__.py37CODE
LOWkeras/api/__init__.py38CODE
LOWkeras/api/__init__.py39CODE
LOWkeras/api/__init__.py40CODE
LOWkeras/api/__init__.py41CODE
LOWkeras/api/__init__.py42CODE
LOWkeras/api/__init__.py43CODE
LOWkeras/api/__init__.py46CODE
LOWkeras/api/__init__.py49CODE
LOWkeras/api/__init__.py50CODE
LOWkeras/api/__init__.py53CODE
LOWkeras/api/__init__.py54CODE
LOWkeras/api/__init__.py55CODE
LOWkeras/api/__init__.py56CODE
LOWkeras/api/__init__.py57CODE
LOWkeras/api/__init__.py58CODE
LOWkeras/api/__init__.py59CODE
LOWkeras/api/__init__.py60CODE
LOWkeras/api/__init__.py61CODE
LOWkeras/api/__init__.py62CODE
LOWkeras/api/__init__.py63CODE
LOWkeras/api/__init__.py64CODE
LOWkeras/api/__init__.py65CODE
LOWkeras/api/__init__.py66CODE
LOWkeras/api/__init__.py67CODE
LOWkeras/api/activations/__init__.py7CODE
LOWkeras/api/activations/__init__.py8CODE
3648 more matches not shown…
Hyper-Verbose Identifiers2518 hits · 2553 pts
SeverityFileLineSnippetContext
LOWconftest.py40def pytest_collection_modifyitems(config, items):CODE
LOWpip_build.py69def copy_source_to_build_directory(root_path):CODE
LOWapi_gen.py23def copy_source_to_build_directory(root_path):CODE
LOWkeras/src/api_export.py13def register_internal_serializable(path, symbol):CODE
LOWkeras/src/activations/activations_test.py106 def test_softmax_higher_dim_multiple_axes(self):CODE
LOWkeras/src/activations/activations_test.py115 def test_softmax_negative_axis(self):CODE
LOWkeras/src/activations/activations_test.py151 def test_log_softmax_higher_dim(self):CODE
LOWkeras/src/activations/activations_test.py160 def test_log_softmax_higher_dim_multiple_axes(self):CODE
LOWkeras/src/activations/activations_test.py169 def test_log_softmax_negative_axis(self):CODE
LOWkeras/src/activations/activations_test.py177 def test_temporal_log_softmax(self):CODE
LOWkeras/src/activations/activations_test.py488 def test_relu_combined_threshold_and_max_value(self):CODE
LOWkeras/src/activations/activations_test.py497 def test_relu_combined_all_parameters(self):CODE
LOWkeras/src/activations/activations_test.py514 def test_relu_to_trigger_leaky(self):CODE
LOWkeras/src/visualization/plot_bounding_box_gallery.py18def plot_bounding_box_gallery(CODE
LOW…as/src/visualization/plot_segmentation_mask_gallery.py15def plot_segmentation_mask_gallery(CODE
LOWkeras/src/tree/dmtree_impl.py162def _recursive_flatten_with_path(path, structure, flattened):CODE
LOWkeras/src/tree/torchtree_impl.py155 def func_with_check_without_shallow_structure(shallow, *args):CODE
LOWkeras/src/tree/tree_test.py163 def test_is_nested_tf_wrappers(self, t):CODE
LOWkeras/src/tree/tree_test.py430 def test_flatten_with_path_tf_wrappers(self, t):CODE
LOWkeras/src/tree/tree_test.py588 def test_pack_sequence_as_tf_wrappers(self, t):CODE
LOWkeras/src/tree/tree_test.py614 def test_map_structure_with_one_structure(self, t):CODE
LOWkeras/src/tree/tree_test.py748 def test_map_structure_with_one_structure_tf_wrappers(self, t):CODE
LOWkeras/src/tree/tree_test.py777 def test_map_structure_with_multiple_structures(self, t):CODE
LOWkeras/src/tree/tree_test.py1105 def test_map_structure_with_multiple_structures_tf_wrappers(self, t):CODE
LOWkeras/src/tree/tree_test.py1187 def test_assert_same_structure(self, t):CODE
LOWkeras/src/tree/tree_test.py1542 def test_assert_same_structure_tf_wrappers(self, t):CODE
LOWkeras/src/tree/tree_test.py1779 def test_assert_same_paths_tf_wrappers(self, t):CODE
LOWkeras/src/tree/tree_test.py2064 def test_traverse_top_down_tf_wrappers(self, t):CODE
LOWkeras/src/tree/tree_test.py2388 def test_traverse_bottom_up_tf_wrappers(self, t):CODE
LOWkeras/src/tree/optree_impl.py122 def func_with_check_without_shallow_structure(shallow, *args):CODE
LOWkeras/src/metrics/confusion_metrics_test.py727 def test_unweighted_all_correct(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py734 def test_unweighted_high_specificity(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py744 def test_unweighted_low_specificity(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py829 def test_unweighted_all_correct(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py837 def test_unweighted_high_sensitivity(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py847 def test_unweighted_low_sensitivity(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py54 def test_unweighted_with_thresholds(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py72 def test_weighted_with_thresholds(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py148 def test_unweighted_with_thresholds(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py166 def test_weighted_with_thresholds(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py237 def test_unweighted_with_thresholds(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py255 def test_weighted_with_thresholds(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py326 def test_unweighted_with_thresholds(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py344 def test_weighted_with_thresholds(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py407 def test_unweighted_all_incorrect(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py436 def test_unweighted_with_threshold(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py443 def test_weighted_with_threshold(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py504 def test_unweighted_class_id_multiclass(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py532 def test_unweighted_top_k_and_threshold(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py572 def test_unweighted_all_incorrect(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py599 def test_unweighted_with_threshold(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py605 def test_weighted_with_threshold(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py665 def test_unweighted_class_id_multiclass(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py693 def test_unweighted_top_k_and_threshold(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py784 def test_invalid_num_thresholds(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py887 def test_invalid_num_thresholds(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py913 def test_unweighted_all_correct(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py921 def test_unweighted_high_recall(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py932 def test_unweighted_low_recall(self):CODE
LOWkeras/src/metrics/confusion_metrics_test.py975 def test_invalid_num_thresholds(self):CODE
2458 more matches not shown…
Cross-File Repetition251 hits · 1255 pts
SeverityFileLineSnippetContext
HIGHkeras/api/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/activations/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/visualization/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/tree/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/metrics/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/losses/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/wrappers/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/layers/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/constraints/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/config/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/callbacks/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/quantizers/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/datasets/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/datasets/mnist/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/datasets/boston_housing/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/datasets/fashion_mnist/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/datasets/reuters/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/datasets/cifar100/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/datasets/imdb/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/datasets/california_housing/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/datasets/cifar10/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/distribution/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/distillation/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/mixed_precision/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/legacy/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/legacy/saving/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/utils/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/utils/bounding_boxes/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/utils/legacy/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/backend/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/models/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/optimizers/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/optimizers/legacy/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/optimizers/schedules/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/regularizers/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/_tf_keras/keras/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/_tf_keras/keras/activations/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/_tf_keras/keras/visualization/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/_tf_keras/keras/tree/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/_tf_keras/keras/metrics/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/_tf_keras/keras/losses/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/_tf_keras/keras/wrappers/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/_tf_keras/keras/layers/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/_tf_keras/keras/constraints/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/_tf_keras/keras/config/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/_tf_keras/keras/callbacks/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/_tf_keras/keras/quantizers/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/_tf_keras/keras/datasets/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/_tf_keras/keras/datasets/mnist/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGH…pi/_tf_keras/keras/datasets/boston_housing/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGH…api/_tf_keras/keras/datasets/fashion_mnist/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/_tf_keras/keras/datasets/reuters/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/_tf_keras/keras/datasets/cifar100/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/_tf_keras/keras/datasets/imdb/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGH…tf_keras/keras/datasets/california_housing/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/_tf_keras/keras/datasets/cifar10/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/_tf_keras/keras/distribution/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/_tf_keras/keras/distillation/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/_tf_keras/keras/mixed_precision/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
HIGHkeras/api/_tf_keras/keras/legacy/__init__.py0do not edit. this file was autogenerated. do not edit it by hand, since your modifications would be overwritten.STRING
191 more matches not shown…
Docstring Block Structure130 hits · 592 pts
SeverityFileLineSnippetContext
HIGHkeras/src/activations/activations.py8Applies the rectified linear unit activation function. With default values, this returns the standard ReLU activatiSTRING
HIGHkeras/src/visualization/plot_bounding_box_gallery.py39Plots a gallery of images with bounding boxes. This function can display both ground truth and predicted bounding bSTRING
HIGHkeras/src/visualization/draw_bounding_boxes.py28Draws bounding boxes on images. This function draws bounding boxes on a batch of images. It supports differentSTRING
HIGHkeras/src/visualization/draw_segmentation_masks.py19Draws segmentation masks on images. The function overlays segmentation masks on the input images. The masks areSTRING
HIGH…as/src/visualization/plot_segmentation_mask_gallery.py28Plots a gallery of images with corresponding segmentation masks. Args: images: A 4D tensor or NumPy array oSTRING
HIGHkeras/src/visualization/plot_image_gallery.py19Extracts a batch of images for plotting. Args: images: The 4D tensor or NumPy array of images. num_STRING
HIGHkeras/src/tree/tree_api.py36Checks if a given structure is nested. Examples: >>> keras.tree.is_nested(42) False >>> keras.tree.is_STRING
HIGHkeras/src/tree/tree_api.py57Traverses the given nested structure, applying the given function. The traversal is depth-first. If `top_down` is TSTRING
HIGHkeras/src/tree/tree_api.py110Flattens a possibly nested structure into a list. In the case of dict instances, the sequence consists of the valueSTRING
HIGHkeras/src/tree/tree_api.py151Flattens a possibly nested structure into a list. This is a variant of flattens() which produces a list of pairSTRING
HIGHkeras/src/tree/tree_api.py177Maps `func` through given structures. Examples: >>> structure = [[1], [2], [3]] >>> keras.tree.map_structuSTRING
HIGHkeras/src/tree/tree_api.py217Maps `func` through given structures up to `shallow_structure`. This is a variant of `map_structure` which only mapSTRING
HIGHkeras/src/tree/tree_api.py254Asserts that two structures are nested in the same way. This function verifies that the nested structures match. ThSTRING
HIGHkeras/src/tree/tree_api.py310Asserts that two structures have identical paths in their tree structure. This function verifies that two nested stSTRING
HIGHkeras/src/tree/tree_api.py339Returns a given flattened sequence packed into a given structure. If `structure` is an atom, `flat_sequence` must bSTRING
HIGHkeras/src/losses/losses.py2316Computes the sparse categorical crossentropy loss. Args: y_true: Ground truth values. y_pred: The pSTRING
HIGHkeras/src/layers/layer.py72This is the class from which all layers inherit. A layer is a callable object that takes as input one or more tensoSTRING
HIGHkeras/src/layers/core/einsum_dense.py945Performs int8 quantized einsum with a custom gradient. Computes the einsum operation with quantized inputs STRING
HIGHkeras/src/layers/core/einsum_dense.py1615Parses an einsum string to determine the shapes of the weights. This function is the main entry point for analyzingSTRING
HIGHkeras/src/layers/core/einsum_dense.py1682Computes kernel and bias shapes from a parsed einsum equation. This function takes the components of an einsum equaSTRING
HIGHkeras/src/layers/convolutional/depthwise_conv2d.py72D depthwise convolution layer. Depthwise convolution is a type of convolution in which each input channel is cSTRING
HIGHkeras/src/layers/convolutional/depthwise_conv1d.py71D depthwise convolution layer. Depthwise convolution is a type of convolution in which each input channel is cSTRING
HIGHkeras/src/layers/convolutional/conv3d_transpose.py123D transposed convolution layer. The need for transposed convolutions generally arise from the desire to use a STRING
HIGHkeras/src/layers/convolutional/conv1d.py81D convolution layer (e.g. temporal convolution). This layer creates a convolution kernel that is convolved with thSTRING
HIGHkeras/src/layers/convolutional/conv2d_transpose.py122D transposed convolution layer. The need for transposed convolutions generally arise from the desire to use a STRING
HIGHkeras/src/layers/convolutional/conv3d.py73D convolution layer. This layer creates a convolution kernel that is convolved with the layer input over a 3D STRING
HIGHkeras/src/layers/convolutional/conv2d.py72D convolution layer. This layer creates a convolution kernel that is convolved with the layer input over a 2D STRING
HIGHkeras/src/layers/convolutional/conv1d_transpose.py121D transposed convolution layer. The need for transposed convolutions generally arise from the desire to use a STRING
HIGHkeras/src/layers/preprocessing/stft_spectrogram.py14Layer to compute the Short-Time Fourier Transform (STFT) on a 1D signal. A layer that computes Spectrograms of the STRING
HIGH…ssing/image_preprocessing/bounding_boxes/converters.py14Converts bounding boxes between formats. Supported formats (case-insensitive): `"xyxy"`: [left, top, right, botSTRING
HIGH…ssing/image_preprocessing/bounding_boxes/converters.py265Encodes bounding boxes relative to anchors as deltas. This function calculates the deltas that represent the differSTRING
HIGH…ssing/image_preprocessing/bounding_boxes/converters.py357Converts bounding boxes from delta format to the specified `box_format`. This function decodes bounding box deltas STRING
HIGHkeras/src/layers/merging/concatenate.py10Concatenates a list of inputs. It takes as input a list of tensors, all of the same shape except for the concatSTRING
HIGHkeras/src/layers/merging/add.py42Functional interface to the `keras.layers.Add` layer. Args: inputs: A list of input tensors with the same sSTRING
HIGHkeras/src/layers/merging/subtract.py53Functional interface to the `keras.layers.Subtract` layer. Args: inputs: A list of input tensors of size 2,STRING
HIGHkeras/src/layers/merging/multiply.py63Functional interface to the `keras.layers.Multiply` layer. Args: inputs: A list of input tensors , all of tSTRING
HIGHkeras/src/layers/merging/maximum.py39Functional interface to the `keras.layers.Maximum` layer. Args: inputs: A list of input tensors , all of thSTRING
HIGHkeras/src/layers/merging/minimum.py39Functional interface to the `keras.layers.Minimum` layer. Args: inputs: A list of input tensors , all of thSTRING
HIGHkeras/src/layers/merging/average.py42Functional interface to the `keras.layers.Average` layer. Args: inputs: A list of input tensors , all of thSTRING
HIGHkeras/src/layers/merging/base_merge.py61Computes the shape of the resultant of an elementwise operation. Args: shape1: Tuple or None. ShapeSTRING
HIGHkeras/src/callbacks/tensorboard_test.py65Read all summaries under the logdir into a `_SummaryFile`. Args: logdir: A path to a directory that contains STRING
HIGHkeras/src/callbacks/tensorboard.py660Writes a Keras model as JSON to as a Summary. Writing the Keras model configuration allows the TensorBoard graph plSTRING
HIGHkeras/src/quantizers/awq_core.py194Get group size from config or dtype policy. Args: layer: The layer to get group size for. config: OSTRING
HIGHkeras/src/quantizers/gptq_core.py369Determine the group size for GPTQ quantization. The group size can be specified either through the `config` argumenSTRING
HIGHkeras/src/quantizers/gptq_core.py410Determine the number of weight bits for GPTQ quantization. The number of weight bits can be specified either througSTRING
HIGHkeras/src/distillation/distiller.py11Distillation model for transferring knowledge from teacher to student. Knowledge distillation transfers knowledge fSTRING
HIGHkeras/src/legacy/preprocessing/image.py1385Applies a transformation to an image according to given parameters. Args: x: 3D tensor, single imagSTRING
HIGHkeras/src/legacy/preprocessing/image.py1705Performs a brightness shift. DEPRECATED. Args: x: Input tensor. Must be 3D. brightness: Float.STRING
HIGHkeras/src/legacy/preprocessing/image.py1736Performs a random brightness shift. DEPRECATED. Args: x: Input tensor. Must be 3D. brightness_STRING
HIGHkeras/src/legacy/saving/saving_utils.py24Instantiates a Keras model from its config. Args: config: Configuration dictionary. custom_objects:STRING
HIGHkeras/src/legacy/saving/json_utils.py134Serializes any object to a JSON-serializable structure. Args: obj: the object to serialize Returns: STRING
HIGHkeras/src/legacy/saving/legacy_h5_format.py81Loads a model saved via `save_model_to_hdf5`. Args: filepath: One of the following: - String, pSTRING
HIGHkeras/src/legacy/saving/legacy_h5_format.py577Load layer weights of a model from hdf5. Args: group: HDF5 group. Returns: List of NumPy arraySTRING
HIGHkeras/src/backend/config.py46Set the default float dtype. Note: It is not recommended to set this to `"float16"` for training, as this will STRING
HIGHkeras/src/backend/common/variables.py16Represents a backend-agnostic variable in Keras. A `Variable` acts as a container for state. It holds a tensor valuSTRING
HIGHkeras/src/backend/common/dtypes.py282Returns the type from applying the Keras type promotion rules. In general, each argument is first parsed by `backenSTRING
HIGHkeras/src/backend/jax/nn.py1580Applies a wrapped flash attention mechanism using the Splash kernel. This function prepares the appropriate attentioSTRING
HIGHkeras/src/optimizers/multi_optimizer.py37Retrieves the corresponding `Optimizer` by the string key. This method first attempts an exact key match. If noSTRING
HIGH…ras/src/optimizers/schedules/learning_rate_schedule.py189A `LearningRateSchedule` that uses a piecewise constant decay schedule. The function returns a 1-arg callable to coSTRING
HIGHkeras/src/dtype_policies/dtype_policy_map.py126Retrieves the corresponding `DTypePolicy` by the string key. This method first attempts an exact key match. If STRING
70 more matches not shown…
Deep Nesting289 hits · 278 pts
SeverityFileLineSnippetContext
LOWconftest.py14CODE
LOWapi_gen.py36CODE
LOWkeras/src/visualization/draw_bounding_boxes.py17CODE
LOWkeras/src/tree/dmtree_impl.py162CODE
LOWkeras/src/tree/dmtree_impl.py244CODE
LOWkeras/src/tree/torchtree_impl.py99CODE
LOWkeras/src/losses/loss.py56CODE
LOWkeras/src/layers/input_spec.py122CODE
LOWkeras/src/layers/layer.py873CODE
LOWkeras/src/layers/layer.py1373CODE
LOWkeras/src/layers/layer.py1864CODE
LOWkeras/src/layers/activations/softmax.py55CODE
LOW…s/src/layers/attention/grouped_query_attention_test.py106CODE
LOWkeras/src/layers/attention/multi_head_attention_test.py113CODE
LOWkeras/src/layers/reshaping/cropping3d.py125CODE
LOWkeras/src/layers/reshaping/cropping2d.py145CODE
LOWkeras/src/layers/core/embedding.py261CODE
LOWkeras/src/layers/core/embedding.py303CODE
LOWkeras/src/layers/core/dense.py159CODE
LOWkeras/src/layers/core/dense.py297CODE
LOWkeras/src/layers/core/dense.py334CODE
LOWkeras/src/layers/core/dense.py454CODE
LOWkeras/src/layers/core/dense.py1031CODE
LOWkeras/src/layers/core/einsum_dense.py238CODE
LOWkeras/src/layers/core/einsum_dense.py380CODE
LOWkeras/src/layers/core/einsum_dense.py417CODE
LOWkeras/src/layers/core/einsum_dense.py543CODE
LOWkeras/src/layers/core/einsum_dense.py584CODE
LOWkeras/src/layers/core/einsum_dense.py700CODE
LOWkeras/src/layers/core/einsum_dense.py1267CODE
LOWkeras/src/layers/core/reversible_embedding.py383CODE
LOWkeras/src/layers/convolutional/conv_transpose_test.py178CODE
LOWkeras/src/layers/preprocessing/index_lookup.py645CODE
LOWkeras/src/layers/preprocessing/index_lookup.py844CODE
LOWkeras/src/layers/preprocessing/hashed_crossing.py138CODE
LOWkeras/src/layers/preprocessing/discretization.py159CODE
LOWkeras/src/layers/preprocessing/text_vectorization.py393CODE
LOWkeras/src/layers/preprocessing/text_vectorization.py563CODE
LOWkeras/src/layers/preprocessing/stft_spectrogram.py290CODE
LOWkeras/src/layers/preprocessing/normalization.py251CODE
LOWkeras/src/layers/preprocessing/feature_space.py386CODE
LOWkeras/src/layers/preprocessing/feature_space.py462CODE
LOWkeras/src/layers/preprocessing/feature_space.py493CODE
LOWkeras/src/layers/preprocessing/feature_space.py580CODE
LOWkeras/src/layers/preprocessing/feature_space.py712CODE
LOW…ayers/preprocessing/image_preprocessing/center_crop.py184CODE
LOW…ssing/image_preprocessing/bounding_boxes/validation.py24CODE
LOW…ssing/image_preprocessing/bounding_boxes/validation.py118CODE
LOWkeras/src/layers/merging/base_merge.py60CODE
LOWkeras/src/layers/merging/base_merge.py143CODE
LOWkeras/src/layers/rnn/bidirectional.py199CODE
LOWkeras/src/layers/rnn/bidirectional.py309CODE
LOWkeras/src/layers/rnn/bidirectional.py415CODE
LOWkeras/src/layers/rnn/lstm.py529CODE
LOWkeras/src/layers/rnn/gru.py547CODE
LOWkeras/src/callbacks/callback_list.py59CODE
LOWkeras/src/callbacks/swap_ema_weights.py116CODE
LOWkeras/src/callbacks/reduce_lr_on_plateau.py99CODE
LOWkeras/src/callbacks/orbax_checkpoint.py301CODE
LOWkeras/src/callbacks/model_checkpoint.py255CODE
229 more matches not shown…
Self-Referential Comments104 hits · 277 pts
SeverityFileLineSnippetContext
MEDIUMkeras/src/activations/activations_test.py460 # Define the input tensorCOMMENT
MEDIUMkeras/src/activations/activations_test.py471 # Define the input tensorCOMMENT
MEDIUMkeras/src/activations/activations_test.py480 # Define the input tensorCOMMENT
MEDIUMkeras/src/activations/activations_test.py489 # Define the input tensorCOMMENT
MEDIUMkeras/src/activations/activations_test.py498 # Define the input tensorCOMMENT
MEDIUMkeras/src/layers/layer.py160 # Create the state of the layer (weights)STRING
MEDIUMkeras/src/layers/layer.py200 # Create a non-trainable weight.STRING
MEDIUMkeras/src/layers/layer_test.py189 # Create a mock to track calls to rematCOMMENT
MEDIUMkeras/src/layers/layer_test.py987 # Create an input tensor WITHOUT an attached mask.COMMENT
MEDIUMkeras/src/layers/layer_test.py991 # Create a mask to be passed explicitly.COMMENT
MEDIUMkeras/src/layers/preprocessing/text_vectorization.py172 >>> # Create the layer.STRING
MEDIUMkeras/src/layers/preprocessing/text_vectorization.py194 >>> # Create the layer, passing the vocab directly. You can also pass theSTRING
MEDIUMkeras/src/layers/preprocessing/discretization_test.py406 # Create a KerasTensor inputCOMMENT
MEDIUM…/src/layers/preprocessing/image_preprocessing/clahe.py58 # Create a CLAHE layer with default parametersSTRING
MEDIUM…yers/preprocessing/image_preprocessing/equalization.py48 # Create an equalization layer for standard 8-bit imagesSTRING
MEDIUMkeras/src/callbacks/orbax_checkpoint_test.py220 # Create a new model with the same architectureCOMMENT
MEDIUMkeras/src/callbacks/orbax_checkpoint.py171 # Create the V1 Checkpointer with direct parameter passingCOMMENT
MEDIUMkeras/src/callbacks/model_checkpoint.py37 # Define a learning rate scheduleSTRING
MEDIUMkeras/src/callbacks/model_checkpoint.py97 # Define a learning rate scheduleSTRING
MEDIUMkeras/src/quantizers/quantizers_test.py146 # Create a random tensor with int4 values in the specified range andCOMMENT
MEDIUMkeras/src/quantizers/quantizers_test.py552 # Define the function to compute gradients forCOMMENT
MEDIUMkeras/src/quantizers/awq.py281 # Create a temporary object that holds a reshaped 2D versionCOMMENT
MEDIUMkeras/src/quantizers/gptq.py313 # Create a temporary object that holds a reshapedCOMMENT
MEDIUMkeras/src/distribution/distribution_lib.py548 # Create a mesh with 2 devices for data parallelism and 4 devices forSTRING
MEDIUMkeras/src/distribution/distribution_lib.py552 # Create a layout map that shard the `Dense` layer and `Conv2D`STRING
MEDIUMkeras/src/distillation/distiller_test.py130 # Create a new teacher that is trainable and verify it gets frozenCOMMENT
MEDIUMkeras/src/utils/config.py26 # Create a config via constructor argumentsSTRING
MEDIUMkeras/src/utils/file_utils_test.py136 # Creating a TarInfo-like object with a name attributeCOMMENT
MEDIUMkeras/src/utils/summary_utils.py351 # Create a rich console for printing. Capture for non-interactive logging.COMMENT
MEDIUMkeras/src/backend/openvino/core.py1322 # Create a zeros tensor of the target shape.COMMENT
MEDIUMkeras/src/backend/openvino/numpy.py1334 # Create a slice of zeros with the same type as xCOMMENT
MEDIUMkeras/src/backend/openvino/trainer.py242 # Create an iterator that yields batches of input data.COMMENT
MEDIUMkeras/src/backend/torch/nn.py379 # Create a real tensor to execute the ops.COMMENT
MEDIUMkeras/src/backend/torch/trainer.py204 # Create the validation data using the training data. Only supportedCOMMENT
MEDIUMkeras/src/backend/torch/trainer.py221 # Create an iterator that yields batches for one epoch.COMMENT
MEDIUMkeras/src/backend/torch/trainer.py348 # Create an iterator that yields batches of input/target data.COMMENT
MEDIUMkeras/src/backend/torch/trainer.py398 # Create an iterator that yields batches of input data.COMMENT
MEDIUMkeras/src/backend/numpy/trainer.py176 # Create an iterator that yields batches of input data.COMMENT
MEDIUMkeras/src/backend/numpy/trainer.py246 # Create an iterator that yields batches of input/target data.COMMENT
MEDIUMkeras/src/backend/common/remat.py175 # Define a simple model using the custom layerSTRING
MEDIUMkeras/src/backend/common/name_scope_test.py55 # Create a name_scope instanceCOMMENT
MEDIUMkeras/src/backend/common/name_scope_test.py72 # Create a name_scope instanceCOMMENT
MEDIUMkeras/src/backend/common/name_scope_test.py118 # Create a name_scope but don't enter itCOMMENT
MEDIUMkeras/src/backend/common/remat_test.py118 # Define a function that uses keyword argumentsCOMMENT
MEDIUMkeras/src/backend/common/variables_test.py1277 # Create a mock SymInt objectCOMMENT
MEDIUMkeras/src/backend/common/symbolic_scope_test.py11 # Define a function that behaves differently according toCOMMENT
MEDIUMkeras/src/backend/tensorflow/numpy.py3683 # Create a smaller square eye and pad appropriately.COMMENT
MEDIUMkeras/src/backend/tensorflow/trainer.py343 # Create the validation data using the training data. Only supportedCOMMENT
MEDIUMkeras/src/backend/tensorflow/trainer.py359 # Create an iterator that yields batches for one epoch.COMMENT
MEDIUMkeras/src/backend/tensorflow/trainer.py476 # Create an iterator that yields batches of input/target data.COMMENT
MEDIUMkeras/src/backend/tensorflow/trainer.py525 # Create an iterator that yields batches of input data.COMMENT
MEDIUMkeras/src/backend/jax/core.py414 # Create a _DimExpr instance for one dimension by creating a symbolicCOMMENT
MEDIUM…src/backend/jax/jax_multi_process_distribution_test.py97 # Create a dataset with range, so that we can verify the numericalCOMMENT
MEDIUMkeras/src/backend/jax/trainer.py50 """This method is stateless and is intended for use with jax.grad."""STRING
MEDIUMkeras/src/backend/jax/trainer.py390 # Create the validation data using the training data. Only supportedCOMMENT
MEDIUMkeras/src/backend/jax/trainer.py406 # Create an iterator that yields batches for one epoch.COMMENT
MEDIUMkeras/src/backend/jax/trainer.py571 # Create an iterator that yields batches ofCOMMENT
MEDIUMkeras/src/backend/jax/trainer.py656 # Create an iterator that yields batches of input data.COMMENT
MEDIUMkeras/src/models/cloning.py81 # Create a test Sequential model.STRING
MEDIUMkeras/src/models/cloning.py87 # Create a copy of the test model (with freshly initialized weights).STRING
44 more matches not shown…
AI Structural Patterns193 hits · 192 pts
SeverityFileLineSnippetContext
LOWkeras/src/visualization/plot_bounding_box_gallery.py18CODE
LOW…as/src/visualization/plot_segmentation_mask_gallery.py15CODE
LOWkeras/src/visualization/plot_image_gallery.py45CODE
LOWkeras/src/metrics/confusion_metrics.py1189CODE
LOWkeras/src/losses/losses.py869CODE
LOWkeras/src/losses/losses.py1130CODE
LOWkeras/src/layers/input_spec.py51CODE
LOWkeras/src/layers/layer.py524CODE
LOWkeras/src/layers/attention/grouped_query_attention.py103CODE
LOWkeras/src/layers/attention/grouped_query_attention.py257CODE
LOWkeras/src/layers/attention/grouped_query_attention.py593CODE
LOWkeras/src/layers/attention/multi_head_attention.py115CODE
LOWkeras/src/layers/attention/multi_head_attention.py610CODE
LOWkeras/src/layers/attention/multi_head_attention.py850CODE
LOWkeras/src/layers/core/embedding.py87CODE
LOWkeras/src/layers/core/dense.py84CODE
LOWkeras/src/layers/core/input_layer.py146CODE
LOWkeras/src/layers/core/input_layer.py11CODE
LOWkeras/src/layers/core/einsum_dense.py127CODE
LOWkeras/src/layers/normalization/batch_normalization.py160CODE
LOWkeras/src/layers/normalization/layer_normalization.py105CODE
LOWkeras/src/layers/normalization/group_normalization.py67CODE
LOWkeras/src/layers/convolutional/base_depthwise_conv.py83CODE
LOWkeras/src/layers/convolutional/depthwise_conv2d.py101CODE
LOWkeras/src/layers/convolutional/depthwise_conv1d.py100CODE
LOWkeras/src/layers/convolutional/base_conv_transpose.py71CODE
LOWkeras/src/layers/convolutional/separable_conv2d.py99CODE
LOWkeras/src/layers/convolutional/separable_conv1d.py98CODE
LOWkeras/src/layers/convolutional/conv3d_transpose.py113CODE
LOWkeras/src/layers/convolutional/conv1d.py95CODE
LOWkeras/src/layers/convolutional/conv2d_transpose.py109CODE
LOWkeras/src/layers/convolutional/conv3d.py95CODE
LOWkeras/src/layers/convolutional/conv2d.py98CODE
LOWkeras/src/layers/convolutional/conv1d_transpose.py101CODE
LOWkeras/src/layers/convolutional/base_separable_conv.py77CODE
LOWkeras/src/layers/convolutional/base_conv.py90CODE
LOWkeras/src/layers/preprocessing/mel_spectrogram.py87CODE
LOWkeras/src/layers/preprocessing/index_lookup.py111CODE
LOWkeras/src/layers/preprocessing/integer_lookup.py335CODE
LOWkeras/src/layers/preprocessing/text_vectorization.py211CODE
LOWkeras/src/layers/preprocessing/stft_spectrogram.py134CODE
LOWkeras/src/layers/preprocessing/string_lookup.py302CODE
LOW…essing/image_preprocessing/random_elastic_transform.py84CODE
LOW…rc/layers/preprocessing/image_preprocessing/aug_mix.py86CODE
LOWkeras/src/layers/merging/dot.py323CODE
LOWkeras/src/layers/rnn/conv_lstm3d.py122CODE
LOWkeras/src/layers/rnn/conv_lstm2d.py123CODE
LOWkeras/src/layers/rnn/lstm.py88CODE
LOWkeras/src/layers/rnn/lstm.py448CODE
LOWkeras/src/layers/rnn/gru.py86CODE
LOWkeras/src/layers/rnn/gru.py465CODE
LOWkeras/src/layers/rnn/conv_lstm1d.py123CODE
LOWkeras/src/layers/rnn/simple_rnn.py79CODE
LOWkeras/src/layers/rnn/simple_rnn.py296CODE
LOWkeras/src/layers/rnn/conv_lstm.py85CODE
LOWkeras/src/layers/rnn/conv_lstm.py472CODE
LOWkeras/src/callbacks/reduce_lr_on_plateau.py48CODE
LOWkeras/src/callbacks/orbax_checkpoint.py110CODE
LOWkeras/src/callbacks/early_stopping.py66CODE
LOWkeras/src/callbacks/tensorboard.py156CODE
133 more matches not shown…
Decorative Section Separators18 hits · 69 pts
SeverityFileLineSnippetContext
MEDIUMkeras/src/backend/jax/trainer_test.py33 # ----------------------------------------------------------------COMMENT
MEDIUMkeras/src/backend/jax/trainer_test.py35 # ----------------------------------------------------------------COMMENT
MEDIUMkeras/src/saving/file_editor.py459 # ------------------------------------------------------COMMENT
MEDIUMkeras/src/saving/file_editor.py461 # ------------------------------------------------------COMMENT
MEDIUMkeras/src/saving/file_editor.py470 # ------------------------------------------------------COMMENT
MEDIUMkeras/src/saving/file_editor.py472 # ------------------------------------------------------COMMENT
MEDIUMkeras/src/saving/file_editor.py575 # ------------------------------------------------------COMMENT
MEDIUMkeras/src/saving/file_editor.py577 # ------------------------------------------------------COMMENT
MEDIUMkeras/src/saving/file_editor.py580 # ------------------------------------------------------COMMENT
MEDIUMkeras/src/saving/file_editor.py582 # ------------------------------------------------------COMMENT
MEDIUMkeras/src/saving/file_editor.py489 # ------------------------------------------------------COMMENT
MEDIUMkeras/src/saving/file_editor.py491 # ------------------------------------------------------COMMENT
MEDIUMkeras/src/saving/file_editor.py518 # ------------------------------------------------------COMMENT
MEDIUMkeras/src/saving/file_editor.py520 # ------------------------------------------------------COMMENT
MEDIUMkeras/src/saving/file_editor.py541 # ------------------------------------------------------COMMENT
MEDIUMkeras/src/saving/file_editor.py543 # ------------------------------------------------------COMMENT
MEDIUMkeras/src/saving/file_editor.py562 # ------------------------------------------------------COMMENT
MEDIUMkeras/src/saving/file_editor.py564 # ------------------------------------------------------COMMENT
Excessive Try-Catch Wrapping53 hits · 56 pts
SeverityFileLineSnippetContext
LOWkeras/src/wrappers/sklearn_test.py158 except Exception as exc:CODE
LOWkeras/src/wrappers/sklearn_test.py212 except Exception as exc:CODE
LOWkeras/src/layers/layer.py255 except Exception:CODE
LOWkeras/src/layers/layer.py1566 except Exception as e:CODE
LOWkeras/src/callbacks/orbax_checkpoint_test.py435 except Exception:CODE
LOWkeras/src/callbacks/orbax_checkpoint.py357 except Exception:CODE
LOWkeras/src/callbacks/tensorboard.py638 except Exception as e:CODE
LOWkeras/src/callbacks/tensorboard.py652 except Exception as e:CODE
LOWkeras/src/callbacks/tensorboard.py694 except Exception as exc:CODE
LOWkeras/src/utils/traceback_utils.py118 except Exception as e:CODE
LOWkeras/src/utils/traceback_utils.py157 except Exception as e:CODE
LOWkeras/src/backend/openvino/core.py627 except Exception as e:CODE
LOWkeras/src/backend/openvino/core.py889 except Exception as e:CODE
LOWkeras/src/backend/openvino/core.py931 except Exception:CODE
LOWkeras/src/backend/openvino/core.py949 except Exception as inner_exception:CODE
MEDIUMkeras/src/backend/openvino/core.py623def __array__(self, dtype=None):CODE
LOWkeras/src/backend/openvino/numpy.py273 except Exception:CODE
LOWkeras/src/backend/openvino/numpy.py692 except Exception:CODE
LOWkeras/src/backend/openvino/numpy.py2635 except Exception as e:CODE
LOWkeras/src/backend/torch/core.py189 except Exception:CODE
MEDIUMkeras/src/backend/torch/core.py186def __eq__(self, other):CODE
LOWkeras/src/backend/torch/rnn.py617 except Exception:CODE
LOWkeras/src/backend/torch/rnn.py807 except Exception:CODE
LOWkeras/src/backend/common/variables.py635 except Exception as e:CODE
LOWkeras/src/backend/jax/nn.py1793 except Exception:CODE
LOWkeras/src/backend/jax/nn.py1815 except Exception:CODE
LOWkeras/src/trainers/trainer.py1164 except Exception as e:CODE
LOWkeras/src/trainers/data_adapters/py_dataset_adapter.py681 except Exception as e:CODE
LOWkeras/src/trainers/data_adapters/py_dataset_adapter.py714 except Exception as e:CODE
LOWkeras/src/dtype_policies/dtype_policy_map.py229 except Exception:CODE
LOWkeras/src/ops/numpy.py7155 except Exception:CODE
LOWkeras/src/ops/operation.py142 except Exception as e:CODE
LOWkeras/src/ops/operation.py358 except Exception as e:CODE
MEDIUMkeras/src/ops/operation.py139def compute_output_spec(self, *args, **kwargs):CODE
LOWkeras/src/ops/linalg.py47 except Exception as e:CODE
LOWkeras/src/ops/linalg.py93 except Exception as e:CODE
LOWkeras/src/saving/saving_lib.py737 except Exception:CODE
LOWkeras/src/saving/saving_lib.py845 except Exception as e:CODE
LOWkeras/src/saving/saving_lib.py857 except Exception as e:CODE
LOWkeras/src/export/openvino_test.py110 except Exception as e:CODE
LOWkeras/src/export/openvino_test.py165 except Exception as e:CODE
LOWkeras/src/export/openvino_test.py200 except Exception as e:CODE
LOWkeras/src/export/openvino_test.py233 except Exception as e:CODE
LOWkeras/src/export/onnx.py284 except Exception:CODE
LOWkeras/src/export/litert_torch_test.py45 except Exception:CODE
LOWkeras/src/export/tf2onnx_lib.py127 except Exception as ex:CODE
LOWkeras/src/export/torch.py100 except Exception as e:CODE
LOWkeras/src/export/litert.py245 except Exception as e:CODE
LOWintegration_tests/pytorch_export_test.py102 except Exception as e:CODE
LOWintegration_tests/pytorch_export_test.py163 except Exception as e:CODE
LOWintegration_tests/pytorch_export_test.py179 except Exception as e:CODE
LOWintegration_tests/pytorch_export_test.py246 except Exception as e:CODE
LOWintegration_tests/pytorch_export_test.py297 except Exception as e:CODE
Redundant / Tautological Comments28 hits · 42 pts
SeverityFileLineSnippetContext
LOWkeras/src/tree/dmtree_impl.py207 # Check if the reference entry (first one) is NoneCOMMENT
LOWkeras/src/tree/torchtree_impl.py134 # Check if the reference entry (first one) is NoneCOMMENT
LOWkeras/src/layers/core/embedding.py293 # Check if the attribute exists on the instance before saving.COMMENT
LOWkeras/src/layers/core/embedding.py327 # Check if the attribute exists before attempting to assign.COMMENT
LOWkeras/src/layers/core/einsum_dense.py1339 # Assign values to the newly created variables.COMMENT
LOWkeras/src/layers/normalization/batch_normalization.py335 # Check if the mask has one less dimension than the inputs.COMMENT
LOWkeras/src/layers/rnn/time_distributed.py79 # Check if mask has at least 2 dimensions (batch and timesteps)COMMENT
LOWkeras/src/callbacks/orbax_checkpoint.py196 # Check if JAX distributed client is initializedCOMMENT
LOWkeras/src/distillation/distiller_test.py101 # Check if the model has been compiled (different backends may handleCOMMENT
LOWkeras/src/legacy/saving/serialization.py362 # Check if `cls_config` is a list. If it is a list, return the class and theCOMMENT
LOWkeras/src/utils/image_utils.py287 # Set back to input height / widthCOMMENT
LOWkeras/src/utils/image_utils.py401 # Set back to input height / width if crop_height / crop_width is notCOMMENT
LOWkeras/src/backend/openvino/numpy.py3017 # Check if k is oddCOMMENT
LOWkeras/src/backend/torch/rnn.py433 # Check if mask is valid for cuDNNCOMMENT
LOWkeras/src/backend/jax/nn.py1480 # Check if cuDNN is installed and raise RuntimeError if cuDNN is notCOMMENT
LOWkeras/src/models/model.py809 # Check if LiteRT export is available (requires TensorFlow orCOMMENT
LOWkeras/src/models/model.py819 # Check if Torch export is available (requires PyTorch backend)COMMENT
LOWkeras/src/trainers/data_adapters/tf_dataset_adapter.py48 # Check if the dataset is batched.COMMENT
LOWkeras/src/dtype_policies/dtype_policy.py604 # Check if mode has block_size component (e.g., "int4/128")COMMENT
LOWkeras/src/ops/ops_test.py56 # Check if that function exist. Some classes are abstract superCOMMENT
LOWkeras/src/ops/function.py134 # Check if input shapes are identical to ref input shapes,COMMENT
LOWkeras/src/saving/file_editor.py30 # Check if an active IPython shell exists.COMMENT
LOWkeras/src/saving/serialization_lib_test.py446 # Check if it resolves to the canonical keras activation functionCOMMENT
LOWkeras/src/export/onnx.py288 # Set verbose to False for TorchScript due to file system leakageCOMMENT
LOWintegration_tests/dataset_tests/imdb_test.py35 # Check if top 10 words are skipped properlyCOMMENT
LOWintegration_tests/dataset_tests/imdb_test.py46 # Check if word_index contains specific known wordsCOMMENT
LOWintegration_tests/dataset_tests/reuters_test.py43 # Check if word_index contains specific known wordsCOMMENT
LOWintegration_tests/dataset_tests/reuters_test.py49 # Check if the tuple contains specific known labelsCOMMENT
Over-Commented Block44 hits · 38 pts
SeverityFileLineSnippetContext
LOWkeras/src/tree/dmtree_impl.py1import collectionsCOMMENT
LOWkeras/src/metrics/confusion_metrics_test.py1161 # without sample_weight:COMMENT
LOWkeras/src/metrics/confusion_metrics_test.py1561 # tn = [[0, 1, 2, 2, 2], [0, 2, 2, 2, 2]]COMMENT
LOWkeras/src/metrics/metrics_utils.py141 bucket_index(y_pred) = ops.floor(y_pred * num_buckets)COMMENT
LOWkeras/src/layers/layer.py921 # TODO: consider extending this to all args and kwargs.COMMENT
LOWkeras/src/layers/preprocessing/hashing_test.py441COMMENT
LOWkeras/src/layers/preprocessing/hashing_test.py461# # Same hashed output as test_hash_sparse_input_farmhashCOMMENT
LOWkeras/src/layers/preprocessing/hashing_test.py481# empty_mask_output = empty_mask_layer(inp_data)COMMENT
LOWkeras/src/layers/preprocessing/hashing_test.py501# self.assertAllClose(expected_output[1], out_data[1])COMMENT
LOWkeras/src/layers/preprocessing/hashing_test.py521COMMENT
LOWkeras/src/layers/preprocessing/hashing_test.py541# # Same hashed output as test_hash_sparse_input_farmhashCOMMENT
LOWkeras/src/layers/preprocessing/feature_space.py521 for name in self._list_adaptable_preprocessors():COMMENT
LOW…/preprocessing/image_preprocessing/center_crop_test.py181 # np.random.rand(10, 10, 3),COMMENT
LOWkeras/src/callbacks/callback.py81COMMENT
LOWkeras/src/callbacks/tensorboard_test.py521 # self.assertEqual(COMMENT
LOWkeras/src/callbacks/tensorboard_test.py701 # Dense(1),COMMENT
LOWkeras/src/callbacks/tensorboard_test.py721COMMENT
LOWkeras/src/datasets/npz_utils.py1"""Utilities shared by the built-in datasets."""COMMENT
LOWkeras/src/distribution/distribution_lib_test.py601 shards[replica_id * processes_per_replica],COMMENT
LOWkeras/src/distribution/distribution_lib_test.py621COMMENT
LOWkeras/src/distribution/distribution_lib_test.py641# self.assertEqual(dtensor_mesh.dim_names, axis_names)COMMENT
LOWkeras/src/distribution/distribution_lib_test.py661# ValueError, "Cannot create sharding when device mesh is not set"COMMENT
LOWkeras/src/utils/model_visualization.py361 # No nesting, connect directly.COMMENT
LOWkeras/src/backend/torch/numpy.py181COMMENT
LOWkeras/src/backend/common/dtypes.py121 Returns:COMMENT
LOWkeras/src/backend/tensorflow/random.py141 dtype,COMMENT
LOWkeras/src/backend/tensorflow/rnn.py901 # after batch dim for time major or batch major inputs respectivelyCOMMENT
LOWkeras/src/optimizers/optimizer_sparse_test.py141 ):COMMENT
LOWkeras/src/trainers/data_adapters/array_data_adapter.py141 # at each step. The performance improvements here come from:COMMENT
LOWkeras/src/saving/saving_lib_test.py441 self.assertIn("keras_version", metadata)COMMENT
LOWintegration_tests/model_visualization_test.py321 # | sub (Sequential) |COMMENT
LOWintegration_tests/model_visualization_test.py381 edge_dict = get_edge_dict(model_to_dot(model))COMMENT
LOWintegration_tests/model_visualization_test.py401 # | v |COMMENT
LOWintegration_tests/model_visualization_test.py441 keras.layers.Dense(10, name="dense1"),COMMENT
LOWintegration_tests/model_visualization_test.py481 # | | inner v | |COMMENT
LOWintegration_tests/model_visualization_test.py521 model = keras.models.Sequential(COMMENT
LOWintegration_tests/model_visualization_test.py561 # | mid | |COMMENT
LOWintegration_tests/model_visualization_test.py601COMMENT
LOWintegration_tests/model_visualization_test.py641 # | +-------------------------+ |COMMENT
LOWintegration_tests/model_visualization_test.py721 )COMMENT
LOWintegration_tests/model_visualization_test.py741 {COMMENT
LOWintegration_tests/model_visualization_test.py761 # | | | dense0 | | | |inner_inp1t| |inner_inp2t| | | subclass3 | |COMMENT
LOWexamples/demo_jax_distributed.py181# Use Keras APIs to find the variable of a specific layer (we will be sharding this one in a special way)COMMENT
LOW.github/workflows/labeler.yaml1# Copyright 2024 Google LLC. All Rights Reserved.COMMENT
AI Slop Vocabulary16 hits · 36 pts
SeverityFileLineSnippetContext
LOWkeras/src/activations/__init__.py101 # Case for keras.activations builtins (simply return name)COMMENT
MEDIUMkeras/src/metrics/confusion_metrics.py1493 # Due to the hyperbolic transform, this formula is less robust thanCOMMENT
LOWkeras/src/layers/normalization/batch_normalization.py27 # If we get a string or dict, just return as we cannot and should not clone.COMMENT
MEDIUMkeras/src/layers/rnn/lstm.py548 # TF for instance, it will leverage cuDNN when feasible, andCOMMENT
MEDIUMkeras/src/layers/rnn/gru.py566 # TF for instance, it will leverage cuDNN when feasible, andCOMMENT
MEDIUMkeras/src/callbacks/orbax_checkpoint_test.py547 """Test comprehensive model state restoration with exact weightSTRING
MEDIUMkeras/src/callbacks/early_stopping_test.py282 # in conjunction with 'start_from_epoch'.COMMENT
LOWkeras/src/legacy/saving/serialization.py241 # already serialized this config. If so, just use that config. This willCOMMENT
LOWkeras/src/utils/text_dataset_utils_test.py72 # We just return the texts, no labelsCOMMENT
LOWkeras/src/backend/openvino/numpy.py2382 # that ever changes, we could simplify this to just call that operation.COMMENT
LOWkeras/src/backend/openvino/linalg.py595 # If not continue_cond, just return A_curr and V_currCOMMENT
MEDIUMkeras/src/backend/torch/core.py357 # more robust, but more expensive.COMMENT
MEDIUMkeras/src/backend/tensorflow/numpy.py333 # Replace tf.einsum with custom ops to utilize hardware-acceleratedCOMMENT
MEDIUMkeras/src/backend/tensorflow/numpy.py3788 # unfortunately we can't leverage 'SAME' padding directly likeCOMMENT
LOWkeras/src/trainers/data_adapters/py_dataset_adapter.py749 # If a worker dies during init, the pool will just create a replacement.COMMENT
MEDIUMkeras/src/ops/function.py155 # Wrap `input_shape` into the structure of KerasTensor to utilizeCOMMENT
Slop Phrases15 hits · 22 pts
SeverityFileLineSnippetContext
MEDIUMkeras/src/layers/preprocessing/text_vectorization.py182 >>> # Now, the layer can map strings to integers -- you can use anSTRING
MEDIUMkeras/src/constraints/constraints.py17 Here's a simple example of a non-negative weight constraint:STRING
MEDIUMkeras/src/utils/dataset_utils.py63 >>> # For a tf.data.Dataset, you can use .cardinality()STRING
MEDIUMkeras/src/utils/dataset_utils.py66 >>> # For a torch.utils.data.Dataset, you can use len()STRING
MEDIUMkeras/src/initializers/initializer.py34 Here's a simple example: a random normal initializer.STRING
MEDIUMguides/custom_train_step_in_torch.py210# Just use `fit` as usual -- you can use callbacks, etc.COMMENT
MEDIUMguides/understanding_masking_and_padding.py335Here's a simple example below: a layer that computes a softmax over the time dimensionSTRING
LOWguides/writing_a_custom_training_loop_in_torch.py119Also, don't forget to call `model.zero_grad()` before `loss.backward()`, or you won'tSTRING
MEDIUMguides/distributed_training_with_tensorflow.py184Here's a simple example:STRING
MEDIUMguides/custom_train_step_in_tensorflow.py195# Just use `fit` as usual -- you can use callbacks, etc.COMMENT
MEDIUMguides/custom_train_step_in_jax.py283# Just use `fit` as usual -- you can use callbacks, etc.COMMENT
MEDIUMguides/training_with_built_in_methods.py315Here's a simple example showing how to implement a `CategoricalTruePositives` metricSTRING
MEDIUMguides/training_with_built_in_methods.py362(the one passed to `compile()`). Here's a simple example that adds activitySTRING
MEDIUMguides/training_with_built_in_methods.py1075Here's a simple example saving a list of per-batch loss values during training:STRING
MEDIUMguides/functional_api.py60# Just for demonstration purposes.COMMENT
Verbosity Indicators7 hits · 14 pts
SeverityFileLineSnippetContext
LOWkeras/src/layers/core/dense.py1167 # Step 1: Dequantize kernel to floatCOMMENT
LOWkeras/src/layers/core/dense.py1200 # Step 2: Merge LoRA weights in float domainCOMMENT
LOWkeras/src/layers/core/dense.py1206 # Step 3: Re-quantize the merged kernelCOMMENT
LOWkeras/src/quantizers/awq.py174 # Step 1: Find optimal AWQ scales via grid searchCOMMENT
LOWkeras/src/quantizers/awq.py182 # Step 2: Apply AWQ scales by MULTIPLYING (expand salient weights)COMMENT
LOWkeras/src/saving/saving_api.py407 # Step 1: Load model_config to rebuild the model.COMMENT
LOWkeras/src/saving/saving_api.py425 # Step 2: Load pytree (arrays) with optional resharding.COMMENT
Structural Annotation Overuse7 hits · 14 pts
SeverityFileLineSnippetContext
LOWkeras/src/layers/core/dense.py1167 # Step 1: Dequantize kernel to floatCOMMENT
LOWkeras/src/layers/core/dense.py1200 # Step 2: Merge LoRA weights in float domainCOMMENT
LOWkeras/src/layers/core/dense.py1206 # Step 3: Re-quantize the merged kernelCOMMENT
LOWkeras/src/quantizers/awq.py174 # Step 1: Find optimal AWQ scales via grid searchCOMMENT
LOWkeras/src/quantizers/awq.py182 # Step 2: Apply AWQ scales by MULTIPLYING (expand salient weights)COMMENT
LOWkeras/src/saving/saving_api.py407 # Step 1: Load model_config to rebuild the model.COMMENT
LOWkeras/src/saving/saving_api.py425 # Step 2: Load pytree (arrays) with optional resharding.COMMENT
Cross-Language Confusion1 hit · 8 pts
SeverityFileLineSnippetContext
HIGHkeras/src/tree/dmtree_impl.py24# non-sortable keys as unsupported (meaning behavior is undefined).COMMENT
Fake / Example Data4 hits · 6 pts
SeverityFileLineSnippetContext
LOWkeras/src/backend/torch/core_test.py25 if node.op == "placeholder":CODE
LOWkeras/src/backend/jax/core.py121 dummy_value = jnp.array(0.0)CODE
LOWkeras/src/backend/jax/core.py123 dummy_value = jnp.zeros(shape, dtype=standardize_dtype(dtype))CODE
LOWkeras/src/backend/jax/core.py126 nnx.Variable.__init__(self, value=dummy_value, **nnx_metadata)CODE
Overly Generic Function Names3 hits · 3 pts
SeverityFileLineSnippetContext
LOWkeras/src/utils/python_utils_test.py10 def my_function(x, y=1, **kwargs):CODE
LOWkeras/src/backend/jax/distribution_lib_test.py99 def test_function(inputs, target_layout):CODE
LOWkeras/src/backend/jax/distribution_lib_test.py125 def test_function(inputs, target_layout):CODE
TODO Padding1 hit · 2 pts
SeverityFileLineSnippetContext
LOWkeras/src/layers/preprocessing/feature_space.py531 # TODO: consider adding an adapt progress bar.COMMENT
Modern Structural Boilerplate1 hit · 1 pts
SeverityFileLineSnippetContext
LOWkeras/src/wrappers/__init__.py5__all__ = ["SKLearnClassifier", "SKLearnRegressor", "SKLearnTransformer"]CODE