SlidingWindow¶
-
class
tfsnippet.dataflows.
SlidingWindow
(data_array, window_size)¶ Bases:
tfsnippet.dataflows.data_mappers.DataMapper
DataMapper
for producing sliding windows according to indices.Usage:
data = np.arange(1000) sw = SlidingWindow(data, window_size=100) # construct a DataFlow from this SlidingWindow sw_flow = sw.as_flow(batch_size=64) # or equivalently sw_flow = DataFlow.seq( 0, len(data) - sw.window_size + 1, batch_size=64).map(sw)
Attributes Summary
data_array
Get the data array. window_size
Get the window size. Methods Summary
__call__
(*arrays)Transform the input arrays into outputs. as_flow
(batch_size[, shuffle, skip_incomplete])Get a DataFlow
which iterates through mini-batches of sliding windows upondata_array
.Attributes Documentation
-
data_array
¶ Get the data array.
-
window_size
¶ Get the window size.
Methods Documentation
-
__call__
(*arrays)¶ Transform the input arrays into outputs.
Parameters: *arrays – Arrays to be transformed. Returns: The output arrays. Return type: tuple[np.ndarray]
-