public static class TransferLearning.GraphBuilder extends Object
Constructor and Description |
---|
GraphBuilder(ComputationGraph origGraph)
Computation Graph to tweak for transfer learning
|
Modifier and Type | Method and Description |
---|---|
TransferLearning.GraphBuilder |
addInputs(String... inputNames) |
TransferLearning.GraphBuilder |
addLayer(String layerName,
Layer layer,
InputPreProcessor preProcessor,
String... layerInputs)
Add a layer with a specified preprocessor
|
TransferLearning.GraphBuilder |
addLayer(String layerName,
Layer layer,
String... layerInputs)
Add a layer of the specified configuration to the computation graph
|
TransferLearning.GraphBuilder |
addVertex(String vertexName,
GraphVertex vertex,
String... vertexInputs)
Add a vertex of the given configuration to the computation graph
|
ComputationGraph |
build()
Returns a computation graph build to specifications.
|
TransferLearning.GraphBuilder |
fineTuneConfiguration(FineTuneConfiguration fineTuneConfiguration)
Set parameters to selectively override existing learning parameters
Usage eg.
|
TransferLearning.GraphBuilder |
nInReplace(String layerName,
int nIn,
IWeightInit scheme)
Modify the architecture of a vertex layer by changing nIn of the specified layer.
Note that only the specified layer will be modified - all other layers will not be changed by this call. |
TransferLearning.GraphBuilder |
nInReplace(String layerName,
int nIn,
WeightInit scheme)
Modify the architecture of a vertex layer by changing nIn of the specified layer.
Note that only the specified layer will be modified - all other layers will not be changed by this call. |
TransferLearning.GraphBuilder |
nInReplace(String layerName,
int nIn,
WeightInit scheme,
Distribution dist)
Modify the architecture of a vertex layer by changing nIn of the specified layer.
Note that only the specified layer will be modified - all other layers will not be changed by this call. |
TransferLearning.GraphBuilder |
nOutReplace(String layerName,
int nOut,
Distribution dist)
Modify the architecture of a vertex layer by changing nOut
Note this will also affect the vertex layer that follows the layer specified, unless it is the output layer
Currently does not support modifying nOut of layers that feed into non-layer vertices like merge, subset etc
To modify nOut for such vertices use remove vertex, followed by add vertex
Can specify different weight init schemes for the specified layer and the layer that follows it.
|
TransferLearning.GraphBuilder |
nOutReplace(String layerName,
int nOut,
Distribution dist,
Distribution distNext)
Modified nOut of specified layer.
|
TransferLearning.GraphBuilder |
nOutReplace(String layerName,
int nOut,
Distribution dist,
WeightInit scheme) |
TransferLearning.GraphBuilder |
nOutReplace(String layerName,
int nOut,
WeightInit scheme)
Modify the architecture of a vertex layer by changing nOut
Note this will also affect the vertex layer that follows the layer specified, unless it is the output layer
Currently does not support modifying nOut of layers that feed into non-layer vertices like merge, subset etc
To modify nOut for such vertices use remove vertex, followed by add vertex
Can specify different weight init schemes for the specified layer and the layer that follows it.
|
TransferLearning.GraphBuilder |
nOutReplace(String layerName,
int nOut,
WeightInit scheme,
Distribution dist) |
TransferLearning.GraphBuilder |
nOutReplace(String layerName,
int nOut,
WeightInit scheme,
WeightInit schemeNext) |
TransferLearning.GraphBuilder |
removeVertexAndConnections(String vertexName)
Remove specified vertex and it's connections from the computation graph
|
TransferLearning.GraphBuilder |
removeVertexKeepConnections(String outputName)
Remove the specified vertex from the computation graph but keep it's connections.
|
TransferLearning.GraphBuilder |
setFeatureExtractor(String... layerName)
Specify a layer vertex to set as a "feature extractor"
The specified layer vertex and the layers on the path from an input vertex to it will be "frozen" with parameters staying constant
|
TransferLearning.GraphBuilder |
setInputs(String... inputs)
Sets new inputs for the computation graph.
|
TransferLearning.GraphBuilder |
setInputTypes(InputType... inputTypes)
Sets the input type of corresponding inputs.
|
TransferLearning.GraphBuilder |
setOutputs(String... outputNames)
Set outputs to the computation graph, will add to ones that are existing
Also determines the order, like in ComputationGraphConfiguration
|
TransferLearning.GraphBuilder |
setWorkspaceMode(WorkspaceMode workspaceMode) |
TransferLearning.GraphBuilder |
validateOutputLayerConfig(boolean validateOutputLayerConfig) |
public GraphBuilder(ComputationGraph origGraph)
origGraph
- public TransferLearning.GraphBuilder fineTuneConfiguration(FineTuneConfiguration fineTuneConfiguration)
fineTuneConfiguration
- public TransferLearning.GraphBuilder setFeatureExtractor(String... layerName)
layerName
- public TransferLearning.GraphBuilder nOutReplace(String layerName, int nOut, WeightInit scheme)
layerName
- The name of the layer to change nOut ofnOut
- Value of nOut to change toscheme
- Weight init scheme to use for params in layerName and the layers following itDISTRIBUTION
public TransferLearning.GraphBuilder nOutReplace(String layerName, int nOut, Distribution dist)
layerName
- The name of the layer to change nOut ofnOut
- Value of nOut to change todist
- Weight distribution scheme to useDISTRIBUTION
public TransferLearning.GraphBuilder nOutReplace(String layerName, int nOut, Distribution dist, Distribution distNext)
layerName
- The name of the layer to change nOut ofnOut
- Value of nOut to change todist
- Weight distribution scheme to use for layerNamedistNext
- Weight distribution scheme for layers following layerNameDISTRIBUTION
public TransferLearning.GraphBuilder nOutReplace(String layerName, int nOut, WeightInit scheme, Distribution dist)
public TransferLearning.GraphBuilder nOutReplace(String layerName, int nOut, Distribution dist, WeightInit scheme)
public TransferLearning.GraphBuilder nOutReplace(String layerName, int nOut, WeightInit scheme, WeightInit schemeNext)
public TransferLearning.GraphBuilder nInReplace(String layerName, int nIn, WeightInit scheme)
layerName
- The name of the layer to change nIn ofnIn
- Value of nIn to change toscheme
- Weight init scheme to use for params in layerNamepublic TransferLearning.GraphBuilder validateOutputLayerConfig(boolean validateOutputLayerConfig)
public TransferLearning.GraphBuilder nInReplace(String layerName, int nIn, WeightInit scheme, Distribution dist)
layerName
- The name of the layer to change nIn ofnIn
- Value of nIn to change toscheme
- Weight init scheme to use for params in layerName and the layers following itpublic TransferLearning.GraphBuilder nInReplace(String layerName, int nIn, IWeightInit scheme)
layerName
- The name of the layer to change nIn ofnIn
- Value of nIn to change toscheme
- Weight init scheme to use for params in layerName and the layers following itpublic TransferLearning.GraphBuilder removeVertexKeepConnections(String outputName)
outputName
- public TransferLearning.GraphBuilder removeVertexAndConnections(String vertexName)
vertexName
- public TransferLearning.GraphBuilder addLayer(String layerName, Layer layer, String... layerInputs)
layerName
- layer
- layerInputs
- public TransferLearning.GraphBuilder addLayer(String layerName, Layer layer, InputPreProcessor preProcessor, String... layerInputs)
layerName
- layer
- preProcessor
- layerInputs
- public TransferLearning.GraphBuilder addVertex(String vertexName, GraphVertex vertex, String... vertexInputs)
vertexName
- vertex
- vertexInputs
- public TransferLearning.GraphBuilder setOutputs(String... outputNames)
outputNames
- public TransferLearning.GraphBuilder setInputs(String... inputs)
inputs
- String names of each graph input.GraphBuilder
instance.public TransferLearning.GraphBuilder setInputTypes(InputType... inputTypes)
inputTypes
- The type of input (such as convolutional).GraphBuilder
instance.public TransferLearning.GraphBuilder addInputs(String... inputNames)
public TransferLearning.GraphBuilder setWorkspaceMode(WorkspaceMode workspaceMode)
public ComputationGraph build()
Copyright © 2020. All rights reserved.