MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / scan

Function scan

tensorflow/contrib/data/python/ops/scan_ops.py:25–45  ·  view source on GitHub ↗

A transformation that scans a function across an input dataset. This transformation is a stateful relative of `tf.data.Dataset.map`. In addition to mapping `scan_func` across the elements of the input dataset, `scan()` accumulates one or more state tensors, whose initial values are `initial

(initial_state, scan_func)

Source from the content-addressed store, hash-verified

23
24@deprecation.deprecated(None, "Use `tf.data.experimental.scan(...)`.")
25def scan(initial_state, scan_func):
26 """A transformation that scans a function across an input dataset.
27
28 This transformation is a stateful relative of `tf.data.Dataset.map`.
29 In addition to mapping `scan_func` across the elements of the input dataset,
30 `scan()` accumulates one or more state tensors, whose initial values are
31 `initial_state`.
32
33 Args:
34 initial_state: A nested structure of tensors, representing the initial state
35 of the accumulator.
36 scan_func: A function that maps `(old_state, input_element)` to
37 `(new_state, output_element). It must take two arguments and return a
38 pair of nested structures of tensors. The `new_state` must match the
39 structure of `initial_state`.
40
41 Returns:
42 A `Dataset` transformation function, which can be passed to
43 `tf.data.Dataset.apply`.
44 """
45 return scan_ops.scan(initial_state, scan_func)

Callers

nothing calls this directly

Calls 1

scanMethod · 0.80

Tested by

no test coverage detected