public abstract class Convolution extends ParameterBlock
| Modifier and Type | Class and Description |
|---|---|
static class |
Convolution.ConvolutionBuilder<T extends Convolution.ConvolutionBuilder>
A builder that can build any
Convolution block. |
| Modifier and Type | Field and Description |
|---|---|
protected Parameter |
bias |
protected Shape |
dilate |
protected boolean |
includeBias |
protected Shape |
kernel |
protected int |
numFilters |
protected int |
numGroups |
protected Shape |
pad |
protected Shape |
stride |
protected Parameter |
weight |
inputNames, inputShapes| Constructor and Description |
|---|
Convolution(Convolution.ConvolutionBuilder<?> builder)
Creates a
Convolution object. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
beforeInitialize(Shape[] inputs)
Performs any action necessary before initialization.
|
NDList |
forward(ParameterStore parameterStore,
NDList inputs,
ai.djl.util.PairList<java.lang.String,java.lang.Object> params)
Applies the operating function of the block once.
|
java.util.List<Parameter> |
getDirectParameters()
Returns a list of all the direct parameters of the block.
|
protected abstract LayoutType[] |
getExpectedLayout()
Returns the expected layout of the input.
|
Shape[] |
getOutputShapes(NDManager manager,
Shape[] inputs)
Returns the expected output shapes of the block for the specified input shapes.
|
Shape |
getParameterShape(java.lang.String name,
Shape[] inputShapes)
Returns the shape of the specified direct parameter of this block given the shapes of the
input to the block.
|
protected abstract java.lang.String |
getStringLayout()
Returns the string representing the layout of the input.
|
protected abstract byte |
getVersion()
Gets the version of the
Convolution block. |
void |
loadParameters(NDManager manager,
java.io.DataInputStream is)
Loads the parameters from the given input stream.
|
protected abstract int |
numDimensions()
Returns the number of dimensions of the input.
|
void |
saveParameters(java.io.DataOutputStream os)
Writes the parameters of the block to the given outputStream.
|
getChildren, initialize, toStringcast, clear, describeInput, getParameters, isInitialized, setInitializer, setInitializerclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforward, validateLayoutprotected Shape kernel
protected Shape stride
protected Shape pad
protected Shape dilate
protected int numFilters
protected int numGroups
protected boolean includeBias
protected Parameter weight
protected Parameter bias
public Convolution(Convolution.ConvolutionBuilder<?> builder)
Convolution object.builder - the Builder that has the necessary configurationsprotected abstract byte getVersion()
Convolution block.protected abstract LayoutType[] getExpectedLayout()
protected abstract java.lang.String getStringLayout()
protected abstract int numDimensions()
public NDList forward(ParameterStore parameterStore, NDList inputs, ai.djl.util.PairList<java.lang.String,java.lang.Object> params)
parameterStore - the parameter storeinputs - the input NDListparams - optional parametersprotected void beforeInitialize(Shape[] inputs)
beforeInitialize in class AbstractBlockinputs - the expected shapes of the inputpublic Shape[] getOutputShapes(NDManager manager, Shape[] inputs)
manager - an NDManagerinputs - the shapes of the inputspublic Shape getParameterShape(java.lang.String name, Shape[] inputShapes)
name - the name of the parameterinputShapes - the shapes of the input to the blockpublic java.util.List<Parameter> getDirectParameters()
Parameterpublic void saveParameters(java.io.DataOutputStream os)
throws java.io.IOException
os - the outputstream to save the parameters tojava.io.IOException - if an I/O error occurspublic void loadParameters(NDManager manager, java.io.DataInputStream is) throws java.io.IOException, MalformedModelException
manager - an NDManager to create the parameter arraysis - the inputstream that stream the parameter valuesjava.io.IOException - if an I/O error occursMalformedModelException - if the model file is corrupted or unsupported