界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
效率与协作 · SKILL.md

layers-and-ops

layers-and-ops

【效率与协作】Build TFLearn TensorFlow v1 graph components, layer APIs, operations, collections, shapes, and train-op wiring.

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: layers-and-ops description: "Build TFLearn TensorFlow v1 graph components, layer APIs, operations, collections, shapes, and train-op wiring." disable-model-invocation: true metadata: disco-role: operating license: NOASSERTION

Layers and Ops

Use this sub-skill when the task is to construct, inspect, or debug TFLearn graph components: input layers, dense/dropout/reshape layers, convolution/recurrent/embedding/normalization layers, merge/multi-output branches, estimator regression, activations, objectives, metrics, optimizers, initializers, regularizers, variables, summaries, and TensorFlow graph collections.

Do not use this sub-skill for full training loops, checkpoint save/load, dataset loading, or long model-family examples. Route those to training-and-persistence, data-input-pipelines, or advanced-model-recipes respectively.

Runtime assumptions

  • TFLearn is a TensorFlow-v1-style package. The verified package baseline is TFLearn 0.5.0 with TensorFlow 1.15.5 and CPU execution.
  • Use tensorflow.compat.v1 and disable v2 behavior before building graphs when the surrounding runtime may be TensorFlow 2.x.
  • CPU is sufficient for the graph-construction workflows here. CUDA only changes performance/device placement and is not required by this sub-skill.

Read first

Operating checklist

  1. Start with a clean TensorFlow graph. Prefer with tf.Graph().as_default(): or tf.reset_default_graph() before constructing a new network in notebooks/tests.

  2. Create or register inputs. Prefer tflearn.input_data(shape=[None, ...], name="..."); if using raw placeholders, add them to tf.GraphKeys.INPUTS yourself before relying on TFLearn feed helpers.

  3. Choose layers by rank. Dense layers accept rank >=2 and flatten extra dimensions; conv1d/2d/3d require rank 3/4/5 respectively; recurrent layers expect rank >=3; embedding expects rank 2 integer-id inputs.

  4. Use operation names intentionally. String activations, losses, metrics, optimizers, initializers, and regularizers are resolved by TFLearn registries; use the valid names in the API reference or pass callables/classes.

  5. Use regression only to create train-op metadata. It returns the incoming prediction tensor while adding a target placeholder and TrainOp to graph collections. Actual fit, predict, save, and load belong to training-and-persistence.

  6. Validate collections before handing off. Check INPUTS, TARGETS, TRAIN_OPS, LAYER_TENSOR/<name>, LAYER_VARIABLES/<scope>, ACTIVATIONS, and REGULARIZATION_LOSSES as applicable.

  7. Run the bundled smoke script when verifying a new environment or debugging graph basics:

    python scripts/layer_graph_smoke.py --help
    python scripts/layer_graph_smoke.py
    python scripts/layer_graph_smoke.py --skip-session-run
    

Quick routing by task

User intentUse this sub-skill forThen route elsewhere if needed
Build an MLP/CNN/RNN graphLayer API choice, shapes, names, scopes, variables, train-op collectionActual .fit()/callbacks/checkpoints: training-and-persistence
Attach preprocessing/augmentation to an input layerThe input_data(data_preprocessing=..., data_augmentation=...) attachment pointCreating/validating preprocessing objects or loading files: data-input-pipelines
Add custom TensorFlow ops with TFLearn opsObjectives, metrics, optimizers, summaries, variables, TrainOp-ready tensorsCustom training loop orchestration: training-and-persistence
Debug invalid activation/loss/metric/shapeRegistry names, expected ranks, collection side effectsEnvironment/import failures beyond this scope: root troubleshooting
Adapt a large architecture examplePrimitive layer behavior and graph piecesRecipe selection and expensive example reduction: advanced-model-recipes

Hard boundaries

  • Do not include instructions to download datasets, run original examples, or train for many epochs.
  • Do not require the original repository checkout; all operational details needed by this sub-skill are in the references and bundled script.
  • Do not link public runtime instructions to source repository paths or private inspection environments.
我的收藏