Agent skill · Audited from source
Tensorflow Guide
skill · brycewang-stanford/Auto-Empirical-Research-SkillsNOASSERTION licenceAudited 8 Oct 2026 · source e1ba289846fd
Is it safe? Yes — SAFE, grade B (89/100). We read this skill's source at commit e1ba289846fd and found no filesystem, network or shell access and no hard-coded secrets. What it does: TensorFlow best practices for tf.function, GPU memory, and deployment
Cite
Cite this page
ModelsAtlas. “Tensorflow Guide (brycewang-stanford/Auto-Empirical-Research-Skills)”. Retrieved 8 Oct 2026. https://modelsatlas.com/skills/brycewang-stanford/tensorflow-guide
Trust audit
Audit 0.4.1 · source read 8 Oct 2026
SAFE means nothing in the source contradicts what the skill says it does. Grade B is shared by 17,406 of 18,389 audited skills.
What the source does
- FilesystemNone observedNo reads or writes in the source
- NetworkNone observedNo outbound calls in the source
- ShellNone observedNo commands run in the source
- DependenciesPinnedNothing floats
- SecretsNone foundNo keys in source
Five audit layers
| Layer | What we check | Result | Findings |
|---|---|---|---|
L0 Provenance | Repo owner, licence, archive status, activity | PASS | 0 |
L1 Static source | Secrets, path traversal, supply chain, hidden code | NA | 0 |
L2 Instructions | Prompt injection, authority framing, hidden directives | PASS | 0 |
L3 Inventory | The files and declarations match the source | PASS | 0 |
L4 Sandbox | Run in isolation and watch behaviour | SKIPPED why | 0 |
Gates applied: no behavioural pass.
Findings (0)
No findings at any severity. We re-audit when the source changes.
Audit 0.4.1 · source sha e1ba289846fd · 8 Oct 2026Report an issue or request a re-scan
Provenance
Who published it, and what the verdict is pinned to
- Publisherbrycewang-stanford GitHub userOwner of the repository this skill is read from
- Source folderbrycewang-stanford/Auto-Empirical-Research-Skills/skills/43-wentorai-research-plugins/skills/domains/ai-ml/tensorflow-guideThe exact folder we audited
- LicenceNOASSERTIONAs the repository states it
- Commit pinned for this verdicte1ba289846fdA new audit runs when the source changes
- Repository statusNot archivedLast push 3 days ago
- Sandboxed runNot runSkills are read, not executed; layer L4 is skipped
What it tells the agent
Full source on GitHub ↗Its description: TensorFlow best practices for tf.function, GPU memory, and deployment
---
name: tensorflow-guide
description: "TensorFlow best practices for tf.function, GPU memory, and deployment"
metadata:
openclaw:
emoji: "🧮"
category: "domains"
subcategory: "ai-ml"
keywords: ["TensorFlow", "tf.function", "GPU", "SavedModel", "distributed training", "XLA"]
source: "https://github.com/tensorflow/tensorflow"
---
# TensorFlow Guide
## Overview
TensorFlow is a production-grade machine learning framework that excels at deployment, distributed training, and hardware acceleration. While PyTorch dominates pure research prototyping, TensorFlow remains the standard in industry ML systems and is heavily used in applied research where models must move from experiment to production.
TensorFlow 2.x unified eager execution with graph-mode performance through `tf.function`, but this hybrid approach introduces subtle pitfalls. Understanding when and how TensorFlow traces functions, manages GPU memory, and distributes computation is essential for writing correct and efficient code.
This guide covers the key patterns that trip up researchers: `tf.function` tracing semantics, GPU memory management, distributed strategies, model export, and the ecosystem of tools (TFX, TensorBoard, TF Serving) that make TensorFlow uniquely powerful for end-to-end ML workflows.
## tf.function: The Critical Abstraction
### How Tracing Works
```python
import tensorflow as tf
@tf.function
def add(a, b):
print("Tracing!") # Runs only during tracing, NOT every call
tf.print("Executing!") # Runs every call (TF op)
return a + b
# First call with float32 shape (2,) -- traces
add(tf.constant([1.0, 2.0]), tf.constant([3.0, 4.0])) # Prints "Tracing!" + "Executing!"
# Second call with same signature -- reuses trace
add(tf.constant([5.0, 6.0]), tf.constant([7.0, 8.0])) # Prints only "Executing!"
# Third call with different dtype -- re-traces!
add(tf.constant([1, 2]), tf.constant([3, 4])) # Prints "Tracing!" + "Executing!"
```
### Common tf.function Pitfalls
```python
# PITFALL 1: Python side effects in tf.function
counter = 0
@tf.function
def increment():
global counter
counter += 1 # Only runs during tracing! counter stays at 1 forever.
return counter
# FIX: Use tf.Variable for mutable state
counter = tf.Variable(0)
@tf.function
def increment():
counter.assign_add(1)
return counter
# PITFALL 2: Creating variables inside tf.function
@tf.function
def bad_function(x):
w = tf.Variable(tf.random.normal([3, 3])) # ERROR on second call!
return x @ w
# FIX: Create variables outside, pass as arguments or use Keras layers
w = tf.Variable(tf.random.normal([3, 3]))
@tf.function
def good_function(x):
return x @ w
# PITFALL 3: Python lists that grow
@tf.function
def bad_accumulate(dataset):
results = []
for x in dataset:
results.append(x * 2) # Creates new trace on every iteration!
return results
# FIX: Use tf.TensorArray
@tf.function
def good_accumulate(dataset):
results = tf.TensorArray(tf.float32, size=0, dynamic_size=True)
for i, x in enumerate(dataset):
results = results.write(i, x * 2)
return results.stack()
```
### Input Signatures for Stable Tracing
```python
@tf.function(input_signature=[
tf.TensorSpec(shape=[None, 224, 224, 3], dtype=tf.float32),
tf.TensorSpec(shape=[None], dtype=tf.int64),
])
def train_step(images, labels):
"""Fixed signature prevents re-tracing on different batch sizes."""
with tf.GradientTape() as tape:
predictions = model(images, training=True)
loss = loss_fn(labels, predictions)
gradients = tape.gradient(loss, model.trainable_variables)
optimizer.apply_gradients(zip(gradients, model.trainable_variables))
return loss
```
## GPU Memory Management
```python
# Problem: TensorFlow grabs ALL GPU memory by default
# Solution: Enable memory growth
gpus = tf.config.list_physical_devices("GPU")
for gpu in gpus:
tf.config.experimental.set_memory_growth(gpu, True)
# Alternative: Set a hard memory limit
tf.config.set_logical_device_configuration(
gpus[0],
[tf.config.LogicalDeviceConfiguration(memory_limit=8192)] # 8 GB
)
# Monitor memory usage
print(tf.config.experimental.get_memory_info("GPU:0"))
```
## Distributed Training Strategies
| Strategy | GPUs | Machines | Sync | Use Case |
|----------|------|----------|------|----------|
| `MirroredStrategy` | Multiple | 1 | Sync | Most common multi-GPU |
| `MultiWorkerMirroredStrategy` | Multiple | Multiple | Sync | Multi-node training |
| `TPUStrategy` | TPU cores | 1 pod | Sync | TPU training |
| `ParameterServerStrategy` | Multiple | Multiple | Async | Very large models |
```python
# Multi-GPU training with MirroredStrategy
strategy = tf.distribute.MirroredStrategy()
print(f"Number of devices: {strategy.num_replicas_in_sync}")
with strategy.scope():
model = build_model()
model.compile(
optimizer=tf.keras.optimizers.Adam(learning_rate=0.001 * strategy.num_replicas_in_sync),
loss="sparse_categorical_crossentropy",
metrics=["accuracy"],
)
# Global batch size = per_replica_batch * num_replicas
global_batch_size = 32 * strategy.num_replicas_in_sync
dataset = dataset.batch(global_batch_size)
model.fit(dataset, epochs=10)
```
## Model Export and Serving
```python
# SavedModel: The universal export format
model.save("saved_model/my_model")
# Load with full TF capabilities
loaded = tf.saved_model.load("saved_model/my_model")
infer = loaded.signatures["serving_default"]
# TF Lite for mobile/edge deployment
converter = tf.lite.TFLiteConverter.from_saved_model("saved_model/my_model")
converter.optimizations = [tf.lite.Optimize.DEFAULT]
tflite_model = converter.convert()
with open("model.tflite", "wb") as f:
f.write(tflite_model)
# TensorFlow.js for browser deployment
# Command line:
# tensorflowjs_converter --input_format=tf_saved_model saved_model/my_model web_model/
```
## Performance Optimization with XLA
```python
# XLA (AcceExcerpt, first 6,001 characters of SKILL.md, verbatim from the audited commit. It is text from someone else’s repository, quoted so you can judge it before your agent reads it.
Install
Pinned to the audited commit e1ba289
git clone https://github.com/brycewang-stanford/Auto-Empirical-Research-Skills git -C Auto-Empirical-Research-Skills checkout e1ba289846fd
The author documents no install command, so this uses the repository directly. Our verdict covers commit e1ba289846fd only.
Works in which agents?
What its own text says, not a test
| Agent | Status | More |
|---|---|---|
| OpenClaw | Mentioned in its text, not tested | Skills for OpenClaw · About OpenClaw |
Audit history
Every audit, every source change
- ✓SAFE B 89 / 100
first audit · source
e1ba289846fd
README badge
For maintainers · shows the latest audit
[](https://modelsatlas.com/skills/brycewang-stanford/tensorflow-guide/)
The badge shows our verdict and grade for this skill, and links back to this page. It changes when the audit does.
Similar skills
brycewang-stanford/Auto-Empirical-Research-Skills
GIS analysis and remote sensing workflows for geospatial research applications
brycewang-stanford/Auto-Empirical-Research-Skills
Run and manage Google Colab notebooks for Python and ML research
brycewang-stanford/Auto-Empirical-Research-Skills
Advanced Google Scholar search techniques for comprehensive literature discovery
brycewang-stanford/Auto-Empirical-Research-Skills
Ethical Google Scholar data collection techniques and best practices
brycewang-stanford/Auto-Empirical-Research-Skills
Autonomous agent for comprehensive deep research on any topic
brycewang-stanford/Auto-Empirical-Research-Skills
Practical advice for thriving in PhD programs and academic research
Add this badge to your README
[](https://modelsatlas.com/skills/brycewang-stanford/tensorflow-guide/)
<a href="https://modelsatlas.com/skills/brycewang-stanford/tensorflow-guide/"><img src="https://modelsatlas.com/skills/brycewang-stanford/tensorflow-guide/badge.svg" alt="ModelsAtlas: SAFE B"></a>
Questions about Tensorflow Guide
What does the Tensorflow Guide skill do?
Is Tensorflow Guide safe to install?
What can Tensorflow Guide access on my machine?
Which assistants does Tensorflow Guide work with?
How current is this page?
Sources
- github.com/brycewang-stanford/Auto-Empirical-Research-Skills/tre — the audited source at commit e1ba289846fd and every finding aboveObserved · 8 Oct 2026
Spotted something wrong? Report a correction · Methodology
Keep going in your AI
Opens with this page as the source. We add nothing else to the prompt.
- What does the Tensorflow Guide skill do?
- Is Tensorflow Guide safe to install?
- What can Tensorflow Guide access on my machine?