Basic Backends
Overview
Name | Initialization: Key/Type/Default | Forward Input: Key/Type | Forward Output: Key/Type | Function | Note |
---|---|---|---|---|---|
Identity | None | data/any | result/any | dict["result"]=dict["data"] | Default backend |
Sequential | Sequential::backend | data/any | |||
Jump | jump | Jump to other (root) node | |||
Range | Range::backend ;range | data/any | from v0.3.3b2 |
Backend Expansion Rule
For backend configuration, some backends have the ability to expand, for example, for backend="A[B]"
, it can be expanded to
backend="A"
"A::backend"="B"
Identity
Does nothing but assigns the input to the output.
Sequential
For specific examples, please refer to Sequential.
Initialization
Sequential::backend
can specify multiple sub-backends separated by commas, such as Sequential::backend=A,B,C[D],E
.
Sequential
expands sub-backends according to the backend expansion rules to obtain:
backend="E"
backend="C"
C::backend="D"
backend="B"
backend="A"
Sub-backend initialization will be performed in reverse order.
Sequential
can be composed, for example:
S[S[DecodeTensor,ResizeTensor],(or)S[DecodeMat,ResizeMat,Mat2Tensor,SyncTensor],SyncTensor]
.
Sub-backends of Sequential
may have duplicates. If you need to specify different parameters for sub-backends, you can use the |
symbol:
backend="Sequential[a,b,Jump,c,Jump]"
jump="||node_name_1||node_name_2"
# 或者,任意的占位符都是可以的:
# jump="a|b|node_name_1|c|node_name_2"
Forward
When forwarding, sub-backends are executed in series. If the result of a non-final sub-backend is empty, the execution is terminated and an exception is thrown. If the result of a non-final sub-backend is non-empty, the filter will be executed. The default is swap
.
Input Range
If the input data range of all sub-backends is [1,1], then the range of Sequential
is [1,1]. Otherwise, it is the union of the input ranges of sub-backends whose input ranges are not [1,1]. Currently, only one sub-backend is allowed to satisfy max() != 1 && max() != UINT32_MAX
at most. In Sequential
, currently only one sub-backend with non-trivial input range is allowed at most, and this sub-backend can be regarded as the main functional implementer of the entire Sequential
, while other backends are auxiliary or functional backends.
Range
Set a new maximum and minimum range [target_min, target_max].
Use dynamic programming to determine whether all the integer 'target' in [target_min, target_max] can be represented as the sum
of multiple numbers within Range::backend
's [min, max] range, and provide a result with the largest possible values.
Initialization
- range - Target [min, max]. for example,
range="1,10"
. - Range::backend - Proxy backend.
Initialization fails if the new range cannot be represented by the range in the old range. For example, target=10, [min, max]=[2,9]
=> 10 = 8+2
. And the following situations will fail: range=[10,10], [min, max]=[8,8]
=> 10 != 8
.