TensorFlow / Keras
Understanding the training engagements for eager, GradientTape and Keras.
- Readable articles
- 24
- System Chapters
- 1
Linking concepts with system chapters.
Read the whole thing first
- TensorFlow and Keras: from GradientTape to checkable training steps
Reconciling gradient records, variable updates, data flow lines and tracing boundaries with the same linear model.
Start with definitions, symbols and minimum examples.
Introduction
- GradientTape: The operation must occur within the records
The automatic fraction requires a calculation path from the target back to the input.
- watch: Guidance for input is required first to describe the object to be observed
Training is usually conducted to guide model training variables and to explain how a user ' s identity affects predictions.
- Tensor and Variable: Value calculation and status update
Tensor represents the value calculated once, and Variable indicates a state that can be updated on a permanent basis.
- NumPy boundary: the value reserved is not equal to the gradient retained
In immediate execution, the load can be converted to a NumPy array for observation.
- padded_batch: Completion of position is not zero observed
padded_batch fills the short records to the public shape when long sequences are taken.
- Metric status: why batch mean value cannot be directly averaged
Keras Metric Object normally saves a batch status, such as the sum of values and the sum of weights.
See the difference between reasoning, realization and methodology.
Step
- Persistent recorder: Boundaries of repeated and high-level guidance
Defaults that GradientTape will release the resources required for the reverse after completing a gradient query.
- tf. function Retrace: What exactly is the difference between the maps cache
tf. function is packaged as a function that produces several specific calculations.
- TensorSpec: Interface between variable batches and fixed features
Enter the shape, data type and optional name of the signature describing the length.
- AutoGraph: Python branch and Jang branch
In tf. function, the Python Boolean conditions can be determined at the time of tracing, while the stretch conditions need to be retained to control the flow when running.
- tf . data map : parallel processing and sequential agreement
Dataset. map applies the change to each data element.
- Location of cache: Cache of raw data or random results
cache saves elements that it has produced upstream.
- prefetch: Overlapping data production and model calculations
If no advance is taken, the model may wait for data to be prepared before the calculations are performed and the next batch will be repeated.
- repeat with training steps: epoch not necessarily equals one trip
Dataset. repeat allows the data to be returned to the tail.
- RaggedTensor: Save variable long data using line boundaries
All rectangles need not be filled before the length of the length.
- shuffle buffer : Difference between local random and total disruption
Dataset. shuffle uses a limited buffer to select an output of elements from the buffer, supplemented by subsequent input.
- Keras level build and call: weights are constructed only once
The Keras subclass has usually placed the configuration unrelated to input at the initialization stage, creating weights that depend on input shapes at build and placing values forward at call.
- trainable and training: Freezing weights does not equal to switching mode
The layered trainable attribute controls which weights are incorporated into the training update and the callers ' training parameter controls the training or reasoning behaviour.
- add_loss: When the auxiliary loss enters the overall target
Some layers wish to bind themselves to activation or internal state, and pass the marker aids to the model through add_loss.
- train_step: Keep fit schedule and specify what to train
Rewrite Model. train_step allows for the retention of the fit batch schedule, echo and log frame, while defining an optimist step.
- keras. ops: Borders for portable load operations
Keras3 supports multiple computing backends, but the migration of the model is dependent on internal calculations.
- Keras Sequencing: Configuration, weights and custom objects
The Keras model recovery needs to know how to rebuild the structure and then put it back in the corresponding position.
- export: The training model is not the same as the reasoning endpoint
The preservation of models is used to continue training and the export model is used for independent reasoning and is two adjoining but distinct tasks.