Marks the input tensor as a sequence.
The operator modifies the layout string of the input data to indicate that the batch contains sequences. Only the layout is affected, while the data stays untouched.
The operator can be used to feed per-frame tensor arguments when processing sequences. For example, the following snippet shows how to apply gaussian_blur
to a batch of sequences, so that a different sigma
is used for each frame in each sequence:
@pipeline_def def random_per_frame_blur(): video, _ = fn.readers.video_resize(sequence_length=50, ...) sigma = fn.random.uniform(range=[0.5, 5], shape=(50,)) blurred = fn.gaussian_blur(video, sigma=fn.per_frame(sigma)) return blurred
Note that the outermost dimension of each tensor from a batch specified as per-frame argument must match the number of frames in the corresponding sequence processed by a given operator. For instance, in the presented example, every sequence in video
batch has 50 frames, thus the shape of sigma
is (50,)
.
Please consult documentation of a given argument of a sequence processing operator to find out if it supports per-frame input.
If the input passed to per-frame
operator has no layout, a new layout is set, that starts with F
and is padded with *
to match dimensionality of the input. Otherwise, depending on the replace
flag, the operator either checks if the first character of the layout is equal to F
or replaces the character with F
.
âcpuâ
âgpuâ
__input¶ (TensorList) â Input to the operator.
bytes_per_sample_hint¶ (int or list of int, optional, default = [0]) â
Output size hint, in bytes per sample.
If specified, the operatorâs outputs residing in GPU or page-locked host memory will be preallocated to accommodate a batch of samples of this size.
preserve¶ (bool, optional, default = False) â Prevents the operator from being removed from the graph even if its outputs are not used.
replace¶ (bool, optional, default = False) â Controls handling of the input with already specified layout. If set to False, the operator errors-out if the first character of the layout is not F
. If set to True, the first character of the layout is replaced with F
.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4