tensorflow
TensorFlowのエキスパートとして、KerasなどのAPIやツールを駆使し、ニューラルネットワークの構築から学習、本番環境での推論、モバイルやブラウザでの実装まで、機械学習開発を幅広く支援するSkill。
📜 元の英語説明(参考)
You are an expert in TensorFlow, Google's open-source machine learning framework. You help developers build, train, and deploy neural networks using Keras (TensorFlow's high-level API), custom training loops, TensorFlow Serving for production inference, TFLite for mobile/edge deployment, and TensorFlow.js for browser ML — from prototyping to production-scale distributed training.
🇯🇵 日本人クリエイター向け解説
TensorFlowのエキスパートとして、KerasなどのAPIやツールを駆使し、ニューラルネットワークの構築から学習、本番環境での推論、モバイルやブラウザでの実装まで、機械学習開発を幅広く支援するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o tensorflow.zip https://jpskill.com/download/15466.zip && unzip -o tensorflow.zip && rm tensorflow.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/15466.zip -OutFile "$d\tensorflow.zip"; Expand-Archive "$d\tensorflow.zip" -DestinationPath $d -Force; ri "$d\tensorflow.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
tensorflow.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
tensorflowフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
TensorFlow — 深層学習フレームワーク
あなたは、Googleのオープンソース機械学習フレームワークであるTensorFlowのエキスパートです。あなたは、開発者がKeras(TensorFlowのハイレベルAPI)、カスタムトレーニングループ、本番環境推論のためのTensorFlow Serving、モバイル/エッジ展開のためのTFLite、ブラウザMLのためのTensorFlow.jsを使用して、プロトタイピングから本番規模の分散トレーニングまで、ニューラルネットワークを構築、トレーニング、およびデプロイするのを支援します。
主要な機能
Keras API (ハイレベル)
import tensorflow as tf
from tensorflow import keras
# シンプルなアーキテクチャのためのSequentialモデル
model = keras.Sequential([
keras.layers.Input(shape=(784,)),
keras.layers.Dense(256, activation="relu"),
keras.layers.Dropout(0.3),
keras.layers.Dense(128, activation="relu"),
keras.layers.Dropout(0.2),
keras.layers.Dense(10, activation="softmax"),
])
model.compile(
optimizer=keras.optimizers.Adam(learning_rate=1e-3),
loss="sparse_categorical_crossentropy",
metrics=["accuracy"],
)
# Train
history = model.fit(
x_train, y_train,
epochs=20,
batch_size=64,
validation_split=0.2,
callbacks=[
keras.callbacks.EarlyStopping(patience=3, restore_best_weights=True),
keras.callbacks.ReduceLROnPlateau(factor=0.5, patience=2),
keras.callbacks.ModelCheckpoint("best_model.keras", save_best_only=True),
],
)
Functional API (複雑なアーキテクチャ)
# 複数入力、複数出力モデル
text_input = keras.Input(shape=(None,), dtype="int32", name="text")
image_input = keras.Input(shape=(224, 224, 3), name="image")
# Text branch
x = keras.layers.Embedding(vocab_size, 128)(text_input)
x = keras.layers.LSTM(64)(x)
# Image branch
y = keras.applications.EfficientNetV2B0(include_top=False, pooling="avg")(image_input)
y = keras.layers.Dense(128, activation="relu")(y)
# Combine
combined = keras.layers.Concatenate()([x, y])
combined = keras.layers.Dense(64, activation="relu")(combined)
# Multiple outputs
category = keras.layers.Dense(num_categories, activation="softmax", name="category")(combined)
sentiment = keras.layers.Dense(1, activation="sigmoid", name="sentiment")(combined)
model = keras.Model(
inputs=[text_input, image_input],
outputs=[category, sentiment],
)
Custom Training Loop
# トレーニングのきめ細かい制御
@tf.function # パフォーマンスのためにJITコンパイル
def train_step(model, optimizer, x, y):
with tf.GradientTape() as tape:
predictions = model(x, training=True)
loss = loss_fn(y, predictions)
gradients = tape.gradient(loss, model.trainable_variables)
optimizer.apply_gradients(zip(gradients, model.trainable_variables))
return loss
# Training loop
for epoch in range(num_epochs):
for batch_x, batch_y in train_dataset:
loss = train_step(model, optimizer, batch_x, batch_y)
# Validation
val_loss = tf.reduce_mean([
loss_fn(y, model(x, training=False))
for x, y in val_dataset
])
print(f"Epoch {epoch}: loss={loss:.4f}, val_loss={val_loss:.4f}")
Deployment
# Save model
model.save("my_model.keras") # Keras format
model.export("saved_model/") # SavedModel format (TF Serving)
# TFLite for mobile
converter = tf.lite.TFLiteConverter.from_keras_model(model)
converter.optimizations = [tf.lite.Optimize.DEFAULT] # Quantize
tflite_model = converter.convert()
with open("model.tflite", "wb") as f:
f.write(tflite_model)
# TensorFlow Serving (Docker)
# docker run -p 8501:8501 --mount type=bind,source=/models,target=/models \
# -e MODEL_NAME=my_model tensorflow/serving
# REST API inference
import requests
response = requests.post(
"http://localhost:8501/v1/models/my_model:predict",
json={"instances": x_test[:5].tolist()},
)
predictions = response.json()["predictions"]
Installation
pip install tensorflow # CPU + GPU (自動検出)
pip install tensorflow-metal # macOS GPU (Apple Silicon)
# GPU requires CUDA 12.x + cuDNN 8.x
Best Practices
- Keras first —
keras.SequentialまたはFunctional APIを使用します。必要な場合にのみカスタムトレーニングループに移行します。 - tf.data for pipelines — データロードには
tf.data.Datasetを使用します。パフォーマンスのために.batch().prefetch(tf.data.AUTOTUNE)を使用します。 - Mixed precision — 最新のGPUで2倍の高速化を実現するために、
keras.mixed_precision.set_global_policy("mixed_float16")を使用します。 - Transfer learning — 事前トレーニング済みのモデル(EfficientNet、ResNet、BERT)から開始します。最初に上位レイヤーを微調整します。
- Callbacks — EarlyStoppingは過学習を防ぎ、ReduceLROnPlateauは学習率を調整し、ModelCheckpointは最適なモデルを保存します。
- @tf.function — カスタムトレーニングステップをデコレートします。TFはグラフをコンパイルして2〜5倍の高速化を実現します。
- TFLite for edge — モバイル展開のために変換および量子化します。INT8量子化によりサイズが4倍に縮小されます。
- TensorBoard — トレーニングの可視化には
keras.callbacks.TensorBoard(log_dir)を使用します。tensorboard --logdir logs
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
TensorFlow — Deep Learning Framework
You are an expert in TensorFlow, Google's open-source machine learning framework. You help developers build, train, and deploy neural networks using Keras (TensorFlow's high-level API), custom training loops, TensorFlow Serving for production inference, TFLite for mobile/edge deployment, and TensorFlow.js for browser ML — from prototyping to production-scale distributed training.
Core Capabilities
Keras API (High-Level)
import tensorflow as tf
from tensorflow import keras
# Sequential model for simple architectures
model = keras.Sequential([
keras.layers.Input(shape=(784,)),
keras.layers.Dense(256, activation="relu"),
keras.layers.Dropout(0.3),
keras.layers.Dense(128, activation="relu"),
keras.layers.Dropout(0.2),
keras.layers.Dense(10, activation="softmax"),
])
model.compile(
optimizer=keras.optimizers.Adam(learning_rate=1e-3),
loss="sparse_categorical_crossentropy",
metrics=["accuracy"],
)
# Train
history = model.fit(
x_train, y_train,
epochs=20,
batch_size=64,
validation_split=0.2,
callbacks=[
keras.callbacks.EarlyStopping(patience=3, restore_best_weights=True),
keras.callbacks.ReduceLROnPlateau(factor=0.5, patience=2),
keras.callbacks.ModelCheckpoint("best_model.keras", save_best_only=True),
],
)
Functional API (Complex Architectures)
# Multi-input, multi-output model
text_input = keras.Input(shape=(None,), dtype="int32", name="text")
image_input = keras.Input(shape=(224, 224, 3), name="image")
# Text branch
x = keras.layers.Embedding(vocab_size, 128)(text_input)
x = keras.layers.LSTM(64)(x)
# Image branch
y = keras.applications.EfficientNetV2B0(include_top=False, pooling="avg")(image_input)
y = keras.layers.Dense(128, activation="relu")(y)
# Combine
combined = keras.layers.Concatenate()([x, y])
combined = keras.layers.Dense(64, activation="relu")(combined)
# Multiple outputs
category = keras.layers.Dense(num_categories, activation="softmax", name="category")(combined)
sentiment = keras.layers.Dense(1, activation="sigmoid", name="sentiment")(combined)
model = keras.Model(
inputs=[text_input, image_input],
outputs=[category, sentiment],
)
Custom Training Loop
# Fine-grained control over training
@tf.function # JIT compile for performance
def train_step(model, optimizer, x, y):
with tf.GradientTape() as tape:
predictions = model(x, training=True)
loss = loss_fn(y, predictions)
gradients = tape.gradient(loss, model.trainable_variables)
optimizer.apply_gradients(zip(gradients, model.trainable_variables))
return loss
# Training loop
for epoch in range(num_epochs):
for batch_x, batch_y in train_dataset:
loss = train_step(model, optimizer, batch_x, batch_y)
# Validation
val_loss = tf.reduce_mean([
loss_fn(y, model(x, training=False))
for x, y in val_dataset
])
print(f"Epoch {epoch}: loss={loss:.4f}, val_loss={val_loss:.4f}")
Deployment
# Save model
model.save("my_model.keras") # Keras format
model.export("saved_model/") # SavedModel format (TF Serving)
# TFLite for mobile
converter = tf.lite.TFLiteConverter.from_keras_model(model)
converter.optimizations = [tf.lite.Optimize.DEFAULT] # Quantize
tflite_model = converter.convert()
with open("model.tflite", "wb") as f:
f.write(tflite_model)
# TensorFlow Serving (Docker)
# docker run -p 8501:8501 --mount type=bind,source=/models,target=/models \
# -e MODEL_NAME=my_model tensorflow/serving
# REST API inference
import requests
response = requests.post(
"http://localhost:8501/v1/models/my_model:predict",
json={"instances": x_test[:5].tolist()},
)
predictions = response.json()["predictions"]
Installation
pip install tensorflow # CPU + GPU (auto-detects)
pip install tensorflow-metal # macOS GPU (Apple Silicon)
# GPU requires CUDA 12.x + cuDNN 8.x
Best Practices
- Keras first — Use
keras.Sequentialor Functional API; drop to custom training loops only when needed - tf.data for pipelines — Use
tf.data.Datasetfor data loading;.batch().prefetch(tf.data.AUTOTUNE)for performance - Mixed precision —
keras.mixed_precision.set_global_policy("mixed_float16")for 2x speedup on modern GPUs - Transfer learning — Start from pre-trained models (EfficientNet, ResNet, BERT); fine-tune top layers first
- Callbacks — EarlyStopping prevents overfitting, ReduceLROnPlateau adapts learning rate, ModelCheckpoint saves best model
- @tf.function — Decorate custom training steps; TF compiles the graph for 2-5x speedup
- TFLite for edge — Convert and quantize for mobile deployment; INT8 quantization reduces size 4x
- TensorBoard —
keras.callbacks.TensorBoard(log_dir)for training visualization;tensorboard --logdir logs