tf . data map : parallel processing and sequential agreement
Dataset. map applies the change to each data element.
Learning objectives and first steps2 objectives 2 first fixes
Try to do it after reading
- Distinguishing single samples from batch mapping
- Check the effect of parallelity on randomity and output order
Suggested first
- Python Basic Syntax:
- Counting and training closed
Parallel reading should not change the meaning of the sample
Dataset. map applies the change to each data element. This element can be a record or a batch that has been formed depending on whether it is placed before or after batch. Parallel controls can handle how many elements at the same time and do not automatically fix the false assumption of the change function as to shape.
Assuming that the original data are [1,2,3,4], map executable by 2, and batch size 2, the result is [[2,4], [6,8]]. batch first, then the same value is obtained by multiplying it by 2 elements, but if the change is to “minus the current average of elements”, the difference is: 0 for all disposals; Two groups were obtained by batch [-0.5,0.5]. The position of the water line is part of the statistical caliber.
Parsing files, photo decoding, etc. may be restricted by input or CPU, which increases vomiting in appropriate parallels. Too many parallel tasks may also compete for memory, document handlers and processors. AUTOTUNE provides running-time reconciliations that do not mean that all machines and data are optimized, much less that the memory size of each element can be ignored.
Order and randomness are checked separately
The default certainty option affects when a parallel result is delivered. As long as the label is always in the same element as the sample, the order changes do not usually disrupt the pairing; If features and labels are separated into two separate water lines and grouped behind a location, any different disruption or completion sequence may be misspelled and the training results may even appear to be declining.
Random enhancement also needs to determine how random numbers are generated. Placing a single global seed does not necessarily guarantee that each sample under a different parallel arrangement will receive the same enhancements. When a sample-by-sample recovery is required, a stable sample number can be used to produce a random indeterminate seed and to indicate whether each epoch changes it, rather than relying on the sequence that the thread incidentally executes.
Errors can first be disabled in parallel, with only the first elements being removed, and a stable number, label and changed shape printed; The semantics are confirmed before they are gradually introduced in parallel and in advance. The performance issue is to observe both ends of production and consumption, and GPU waiting cannot be attributed to the insufficient parallelness of map.
This section is for TensorFlow 2 tf. data; The metrics and the average batch values are hand-counted and not inhaled. The actual records should also contain batch locations, definitive configurations and random feed policies.
When does map for batch first and batch later vary?
When the change depends on the current elements' internal statistics, such as the impairment, sorting or random sharing of parameters, the element changes the calculation definition from a single sample to a batch.
How to avoid the mismatching of feature labels by leading to changes in the output order in parallel?
Saves a stable number, feature and label for the same Dataset element and does not re- pair with two separate sequences.
Sources and reconciliations
Definitions, methods and interfaces are available.
Figures and calculations are reorganized according to this chapter. Mathematical measurements, framework operations and real business effects are described separately in the body of the text.