Class CROperatorRemapParams
java.lang.Object
org.ddogleg.chainrule.ops.CROperatorRemapParams
- All Implemented Interfaces:
CROperatorBackwardsJac<double[]>, CROperatorForward<double[]>
Remaps parameters from an input format into an output format. Does not change their values but
can be configured to drop some elements. If there is no mapping to an element then it's value will
be set to 0. Output vector size can be larger than the number of remapped elects to allow you to represent
states. For example, if the consumer expected 12 states but you only need to popular 3 of them.
-
Constructor Summary
ConstructorsConstructorDescriptionCROperatorRemapParams(int outputSize, int... mappings) Constructor which specifies how the remapping is done. -
Method Summary
Modifier and TypeMethodDescriptiondef(double... values) Shorthand forsetDefaultValues(double...)voidPerforms forward pass of the function.Class<double[]> Primitive data type for the arrayintNumber of inputsintgetInputSize(int which) Returns the specified input's vector sizeintReturns the output vector's sizevoidComputes the Jacobian of all the inputs and parameters to this function.setDefaultValues(double... values) Assigns the default value for the arrayvoidSpecifies the value of an input's vector.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CROperatorForward
getSettings, normalizeAfterStep, setSettings
-
Constructor Details
-
CROperatorRemapParams
public CROperatorRemapParams(int outputSize, int... mappings) Constructor which specifies how the remapping is done. A value of -1 in mappings means it should be skipped.- Parameters:
outputSize- Size of output vectormappings- How elements from the input vector map into the output vector
-
-
Method Details
-
setDefaultValues
Assigns the default value for the array -
def
Shorthand forsetDefaultValues(double...) -
forward
Description copied from interface:CROperatorForwardPerforms forward pass of the function. Must have already updatedCROperatorForward.setInput(int, CRArray).- Specified by:
forwardin interfaceCROperatorForward<double[]>- Parameters:
output- (Output) Output vector. Modified.
-
jacobian
Description copied from interface:CROperatorBackwardsJacComputes the Jacobian of all the inputs and parameters to this function.
Mathematical explanation of how the partial derivatives are computed:
@Out(..)/@x = [@f1(x,y)/@x @f1(x,y)/@y ; @f2(x,y)/@x ... ] * @???/@fWhere Out is the final output, 'f' is this function with two inputs (x,y). '@Out/@f' is dout.
- Specified by:
jacobianin interfaceCROperatorBackwardsJac<double[]>- Parameters:
dout- (Input) Jacobian of output conditional on this function, computed from next layer.jacobianInputs- (Output) Storage for all the Jacobian inputs. All matrices must be pre-declared and included in the list. If a matrix is marked as invalid, then the jacobian is skipped for that input.
-
setInput
Description copied from interface:CROperatorForwardSpecifies the value of an input's vector.
The implementation can safely save the array
inputpoints at along with its offset. Neither the values at that offset nor the array itself will change until afterCROperatorForward.forward(CRArray)or a derived function such asCROperatorBackwardsJac.jacobian(CRMatrix, List)has been called. Theinputreference itself cannot be saved: the caller is free to recycle theCRArraythe moment the call returns, including pointing it at another offset.- Specified by:
setInputin interfaceCROperatorForward<double[]>- Parameters:
which- Which inputinput- The input's value. This reference can't be saved internally but the array and offset can be.
-
getInputSize
public int getInputSize(int which) Description copied from interface:CROperatorForwardReturns the specified input's vector size- Specified by:
getInputSizein interfaceCROperatorForward<double[]>
-
getInputCount
public int getInputCount()Description copied from interface:CROperatorForwardNumber of inputs- Specified by:
getInputCountin interfaceCROperatorForward<double[]>
-
getOutputSize
public int getOutputSize()Description copied from interface:CROperatorForwardReturns the output vector's size- Specified by:
getOutputSizein interfaceCROperatorForward<double[]>
-
getArrayType
Description copied from interface:CROperatorForwardPrimitive data type for the array- Specified by:
getArrayTypein interfaceCROperatorForward<double[]>
-