Search in sources :

Example 1 with MaskedGradient

use of dr.inference.hmc.MaskedGradient in project beast-mcmc by beast-dev.

the class MaskedGradientParser method parseXMLObject.

@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    GradientWrtParameterProvider gradient = (GradientWrtParameterProvider) xo.getChild(GradientWrtParameterProvider.class);
    Parameter mask = (Parameter) xo.getElementFirstChild(MaskedParameterParser.MASKING);
    if (gradient.getDimension() != mask.getDimension()) {
        throw new XMLParseException("Unmatched dimensions");
    }
    return new MaskedGradient(gradient, mask);
}
Also used : GradientWrtParameterProvider(dr.inference.hmc.GradientWrtParameterProvider) Parameter(dr.inference.model.Parameter) MaskedGradient(dr.inference.hmc.MaskedGradient)

Aggregations

GradientWrtParameterProvider (dr.inference.hmc.GradientWrtParameterProvider)1 MaskedGradient (dr.inference.hmc.MaskedGradient)1 Parameter (dr.inference.model.Parameter)1