# Locate TensorFlow Behavior Implementations with Atlas in 2026

> Atlas helps TensorFlow developers pinpoint the exact file and symbol responsible for a behavior, even in complex Keras 3 and `tf.function` codebases.

In 2026, Atlas helps TensorFlow developers locate where a behavior is implemented by combining semantic code search, `grep` for precise text, and the `lsp` tool for symbol graph navigation, all within your terminal. This approach ensures you find the exact file and symbol responsible, even when you only know what the software does, not what the code is called, integrating directly with your `uv` managed project and `pytest` test suite.

## Key takeaways

- Atlas combines semantic search, `grep`, and LSP for comprehensive TensorFlow code location.
- Pinpoint `tf.function` and Keras 3 implementations with precise file and symbol details.
- Atlas integrates with `pytest`, `uv`, and `black` for a native TensorFlow developer experience.
- Review proposed changes with unified diffs and permission prompts before modifying TensorFlow code.
- Atlas indexes code by AST declarations, not blind line windows, for accurate TensorFlow context.
- Keep TensorFlow code off third-party servers by building Atlas's index with local Ollama embeddings.

## How Atlas Locates TensorFlow Behavior Implementations

Atlas locates TensorFlow behavior implementations by fusing three powerful search methods: semantic retrieval, keyword `grep`, and LSP symbol graph analysis. This hybrid approach ensures that by 2026, developers can pinpoint code responsible for `tf.data` pipelines or Keras 3 model logic, even with vague descriptions, providing a comprehensive view of the codebase.

When a TensorFlow developer needs to find the exact code for a behavior, Atlas employs a multi-faceted strategy. First, `codebase_search` uses a semantic index built from AST declarations, allowing it to understand the meaning of your query and return relevant code snippets from Keras model definitions or `tf.function` decorated Python loops, even if your words don't appear literally in the source. This is crucial for understanding complex TensorFlow graph tracing. Next, the `grep` tool provides keyword-based precision, running `ripgrep` with full regex support and path filters to confirm semantic results or find exact text matches in files like `training_step.py` or `input_pipeline.py`. Finally, the `lsp` tool leverages the language server protocol to work through the symbol graph, finding references to specific Keras layers or jumping to the declaration of a `tf.data` transformation, offering a complete picture of the code's structure and usage within your TensorFlow project.

## Using Semantic Search for TensorFlow Code

To find TensorFlow code when you only know its function, Atlas's `codebase_search` tool leverages a semantic index built from AST declarations. This allows it to return relevant Keras 3 model definitions or `tf.function` wrapped loops, even if your query doesn't contain a single keyword from the source, providing a powerful starting point in 2026.

The `codebase_search` tool is particularly effective for TensorFlow projects because it understands the structure of your code, not just raw text. When you describe a behavior like 'where is the custom loss function for the image classification model' or 'how does the `tf.data` pipeline preprocess images', Atlas uses its local Ollama embeddings to query its AST-based index. This means it can identify the `tf.keras.Model` subclass or the `tf.data.Dataset` transformation responsible, even if your query doesn't explicitly mention `tf.losses.Loss` or `map_fn`. This capability is vital for navigating large TensorFlow codebases where naming conventions might vary, and it keeps your proprietary code off third-party servers.

## Confirming TensorFlow Code with `grep`

After an initial semantic search, confirming the exact TensorFlow code location is crucial, and Atlas's `grep` tool provides this precision. It runs `ripgrep` with full regex support and path filters, allowing you to narrow down results to specific files like `model.py` or `training_step.py` within seconds, ensuring accuracy in 2026.

Once `codebase_search` provides candidate files or declarations, the Atlas `grep` tool allows you to validate and refine your findings with exact text matching. For instance, if you suspect a specific `tf.GradientTape` usage or a particular Keras layer name, you can run `atlas grep 'tf.GradientTape' --include '**/training_step.py'` to quickly locate all occurrences within your custom training loop. This tool is powered by `ripgrep`, offering fast and efficient searching across your entire TensorFlow project. You can use complex regular expressions and path filters to target specific directories like `src/models/` or exclude test files, ensuring you focus only on the relevant implementation code.

## Navigating TensorFlow Symbols with LSP

Once a candidate TensorFlow file is identified, the Atlas `lsp` tool becomes indispensable for understanding its call graph and symbol relationships. It can find all references to a `tf.function` decorated method or jump to the definition of a Keras 3 layer, providing deep insights into code flow in 2026.

The `lsp` tool in Atlas connects to Model Context Protocol servers, exposing powerful language server capabilities directly in your terminal. For TensorFlow developers, this means you can use `atlas lsp findReferences 'MyCustomLayer.call'` to see every place your custom Keras layer is invoked, or `atlas lsp workspaceSymbol 'tf.data.experimental.AUTOTUNE'` to jump directly to the definition of a specific TensorFlow constant or function. This is particularly useful for understanding how `tf.function` graph tracing impacts call paths or for debugging `tf.data` pipeline stages. The `lsp` tool provides a dynamic, real-time understanding of your TensorFlow codebase's symbol graph, making it easy to trace execution flow and identify dependencies.

## Reviewing and Approving TensorFlow Code Changes

Atlas ensures safety and transparency when locating and potentially modifying TensorFlow code, offering multiple layers of review before any changes are applied. Every tool call is permission-gated, and any proposed edits, such as wrapping a Python loop in `tf.function`, are presented as a unified diff for approval, preventing unintended modifications in 2026.

Even when the primary goal is just to locate code, understanding Atlas's safety mechanisms is important, especially if you later decide to make changes. Atlas operates with a read-only plan agent that drafts a strategy and asks for your approval before switching to a build agent that can execute commands. Every Atlas tool call, including `pytest` runs or `black` formatting, is permission-gated against allow, ask, and deny rules. If Atlas proposes to wrap a hot Python loop in `tf.function` or add `tf.data` prefetch stages, it computes a unified diff for every file edit and surfaces it for your explicit approval. This granular control, combined with its ability to snapshot file changes as git patches, ensures that any modifications to your TensorFlow project are intentional and fully reversible.

## Steps

1. Start Atlas in your TensorFlow project directory, ensuring your `pyproject.toml` pins `tensorflow` and `keras`.
2. Describe the behavior you want to locate using `atlas codebase_search "find where the Keras 3 model's custom training logic is implemented"`.
3. Confirm the semantic results with a precise keyword search using `atlas grep "tf.GradientTape" --include "**/training_step.py"` to narrow down to specific TensorFlow files.
4. Open the most promising candidate file with `atlas read "src/models/my_model/training_step.py"` to inspect its contents.
5. Use the `lsp` tool to explore the symbol graph, for example, `atlas lsp findReferences "MyCustomTrainingStep.call"` to see all call sites of a method.
6. Jump to related declarations with `atlas lsp workspaceSymbol "tf.data.Dataset.map"` to understand how `tf.data` transformations are defined.
7. Summarize the call path and implementation details back to yourself with `atlas summarize "Explain the call path for MyCustomTrainingStep.call, referencing src/models/my_model/training_step.py:123"`.

## FAQ

### How does Atlas find TensorFlow code without exact keywords?

Atlas uses `codebase_search` which builds a semantic index from AST declarations using tree-sitter. This allows it to understand the meaning of your query and match it to relevant TensorFlow code, such as Keras 3 model definitions or `tf.function` implementations, even if your query terms don't appear literally in the source files.

### Can Atlas help me understand `tf.function` retracing behavior?

Yes, Atlas can help. By using `codebase_search` to locate `tf.function` decorated code and then the `lsp` tool to find references or jump to declarations, you can trace the execution flow and identify where retracing might occur. Atlas can also explain retracing warnings it removes when wrapping Python loops in `tf.function`.

### What TensorFlow files does Atlas index for search?

Atlas indexes all code files within your project, particularly focusing on Python files containing Keras model definitions, `tf.data` input pipelines, custom training steps, and any other TensorFlow-related logic. It builds its index based on AST declarations, providing a rich understanding of your codebase's structure.

### How does Atlas ensure I don't accidentally change my Keras 3 model?

Atlas prioritizes safety. It drafts a plan in a read-only agent and asks for your approval before executing any actions. Every tool call is permission-gated, and any proposed file edits, such as modifying a Keras 3 model definition, are presented as a unified diff for your explicit approval before being written to disk. File changes are also snapshotted as git patches for easy rollback.

### Can Atlas integrate with my existing `uv` managed TensorFlow project?

Absolutely. Atlas is designed to work direct with your existing TensorFlow development environment. It expects to run in a project with a `pyproject.toml` that pins `tensorflow` and `keras`, and it integrates directly with your `uv` package manager, `pytest` test runner, and `black` formatter, using their actual commands.

### How do I use Atlas to find all usages of a specific Keras layer?

To find all usages of a specific Keras layer, you would first use `codebase_search` to locate its definition, then use the `lsp` tool. For example, after identifying the layer's symbol, you could run `atlas lsp findReferences 'MyCustomKerasLayer'` to get a list of every file and line where that layer is instantiated or referenced within your TensorFlow project.

---

Canonical HTML: https://runatlas.sh/resources/stacks/locate-where-a-behavior-is-implemented-in-tensorflow
Source of truth: aeo_pages row `/resources/stacks/locate-where-a-behavior-is-implemented-in-tensorflow` (segment: Stacks) (this file is generated from it, never hand-edited).
Licence: Atlas is proprietary with a free core. It is not open source and there is no public source repository.
