Class GraphTransformUtil
- java.lang.Object
-
- org.nd4j.autodiff.samediff.transform.GraphTransformUtil
-
public class GraphTransformUtil extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<SubGraph>
getSubgraphsMatching(SameDiff sd, SubGraphPredicate p)
Get a list of all the subgraphs that match the specified predicatestatic SameDiff
replaceSubgraphsMatching(@NonNull SameDiff sd, @NonNull SubGraphPredicate p, @NonNull SubGraphProcessor processor)
Find all of the subgraphs that match the specified SubGraphPredicate and then replace them with a different subgraph.
Note that the original SameDiff instance is not modified; a copy is made, which is then modified and returned.
-
-
-
Method Detail
-
replaceSubgraphsMatching
public static SameDiff replaceSubgraphsMatching(@NonNull @NonNull SameDiff sd, @NonNull @NonNull SubGraphPredicate p, @NonNull @NonNull SubGraphProcessor processor)
Find all of the subgraphs that match the specified SubGraphPredicate and then replace them with a different subgraph.
Note that the original SameDiff instance is not modified; a copy is made, which is then modified and returned.
Note: For each subgraph to be replaced by SubGraphProcessor, its replacement should have the same number of output SDVariables.- Parameters:
sd
- SameDiff instance to copy and modifyp
- SubGraphPredicate to define and select the subgraphs that should be modified or replacedprocessor
- SubGraphProcessor is used to define how the subgraphs (selected by the SubGraphPredicate) should be modified/replaced- Returns:
- A SameDiff instance that has been modified
-
getSubgraphsMatching
public static List<SubGraph> getSubgraphsMatching(SameDiff sd, SubGraphPredicate p)
Get a list of all the subgraphs that match the specified predicate- Parameters:
sd
- SameDiff instance to get the subgraphs forp
- Subgraph predicate. This defines the subgraphs that should be selected in the SameDiff instance- Returns:
- Subgraphs
-
-