public class SubGraphPredicate extends OpPredicate
Modifier and Type | Field and Description |
---|---|
protected Integer |
inputCount |
protected Map<Integer,OpPredicate> |
opInputMatchPredicates |
protected Map<Integer,OpPredicate> |
opInputSubgraphPredicates |
protected Integer |
outputCount |
protected OpPredicate |
root |
Modifier | Constructor and Description |
---|---|
protected |
SubGraphPredicate(OpPredicate root) |
Modifier and Type | Method and Description |
---|---|
SubGraph |
getSubGraph(SameDiff sd,
DifferentialFunction rootFn)
Get the SubGraph that matches the predicate
|
boolean |
matches(SameDiff sameDiff,
DifferentialFunction rootFn)
Determine if the subgraph, starting with the root function, matches the predicate
|
SubGraphPredicate |
withInputCount(int inputCount)
Modify the current subgraph to match only if the function has the specified number of inputs
|
SubGraphPredicate |
withInputMatching(int inputNum,
@NonNull OpPredicate opPredicate)
Require the subgraph to match the specified predicate for the specified input.
Note that this does NOT add the specified input to part of the subgraph i.e., the subgraph matches if the input matches the predicate, but when returning the SubGraph itself, the function for this input is not added to the SubGraph |
SubGraphPredicate |
withInputSubgraph(int inputNum,
@NonNull OpPredicate opPredicate)
Require the subgraph to match the specified predicate for the specified input.
Note that this DOES add the specified input to part of the subgraph i.e., the subgraph matches if the input matches the predicate, and when returning the SubGraph itself, the function for this input IS added to the SubGraph |
SubGraphPredicate |
withOutputCount(int outputCount)
Modify the current subgraph to match only if the function has the specified number of outputs
|
static SubGraphPredicate |
withRoot(@NonNull OpPredicate root)
Create a SubGraphPredicate with the specified root predicate
|
classEquals, nameEquals, nameMatches, opNameEquals, opNameMatches
protected final OpPredicate root
protected Integer inputCount
protected Integer outputCount
protected Map<Integer,OpPredicate> opInputMatchPredicates
protected Map<Integer,OpPredicate> opInputSubgraphPredicates
protected SubGraphPredicate(OpPredicate root)
public boolean matches(SameDiff sameDiff, DifferentialFunction rootFn)
matches
in class OpPredicate
sameDiff
- SameDiff instance the function belongs torootFn
- Function that defines the root of the subgraphpublic SubGraph getSubGraph(SameDiff sd, DifferentialFunction rootFn)
sd
- SameDiff instance the function belongs torootFn
- Function that defines the root of the subgraphpublic static SubGraphPredicate withRoot(@NonNull @NonNull OpPredicate root)
root
- Predicate for matching the rootpublic SubGraphPredicate withInputCount(int inputCount)
inputCount
- Match only if the function has the specified number of inputspublic SubGraphPredicate withOutputCount(int outputCount)
outputCount
- Match only if the function has the specified number of outputspublic SubGraphPredicate withInputMatching(int inputNum, @NonNull @NonNull OpPredicate opPredicate)
inputNum
- Input numberopPredicate
- Predicate that the input must matchpublic SubGraphPredicate withInputSubgraph(int inputNum, @NonNull @NonNull OpPredicate opPredicate)
inputNum
- Input numberopPredicate
- Predicate that the input must matchCopyright © 2020. All rights reserved.