### Question:
CauchyVertex extends VertexImpl<DoubleTensor, DoubleVertex> implements DoubleVertex, Differentiable, ProbabilisticDouble, SamplableWithManyScalars<DoubleTensor>, LogProbGraphSupplier { @Override public LogProbGraph logProbGraph() { final DoublePlaceholderVertex xPlaceholder = new DoublePlaceholderVertex(this.getShape()); final DoublePlaceholderVertex locationPlaceholder = new DoublePlaceholderVertex(location.getShape()); final DoublePlaceholderVertex scalePlaceholder = new DoublePlaceholderVertex(scale.getShape()); return LogProbGraph.builder() .input(this, xPlaceholder) .input(location, locationPlaceholder) .input(scale, scalePlaceholder) .logProbOutput(Cauchy.logProbOutput(xPlaceholder, locationPlaceholder, scalePlaceholder)) .build(); } CauchyVertex(@LoadShape long[] tensorShape,
                        @LoadVertexParam(LOCATION_NAME) Vertex<DoubleTensor, ?> location,
                        @LoadVertexParam(SCALE_NAME) Vertex<DoubleTensor, ?> scale); @ExportVertexToPythonBindings  CauchyVertex(Vertex<DoubleTensor, ?> location, Vertex<DoubleTensor, ?> scale);  CauchyVertex(Vertex<DoubleTensor, ?> location, double scale);  CauchyVertex(double location, Vertex<DoubleTensor, ?> scale);  CauchyVertex(double location, double scale);  CauchyVertex(long[] tensorShape, Vertex<DoubleTensor, ?> location, double scale);  CauchyVertex(long[] tensorShape, double location, Vertex<DoubleTensor, ?> scale);  CauchyVertex(long[] tensorShape, double location, double scale); @SaveVertexParam(LOCATION_NAME) DoubleVertex getLocation(); @SaveVertexParam(SCALE_NAME) DoubleVertex getScale(); @Override double logProb(DoubleTensor value); @Override LogProbGraph logProbGraph(); @Override Map<Vertex, DoubleTensor> dLogProb(DoubleTensor value, Set<? extends Vertex> withRespectTo); @Override DoubleTensor sampleWithShape(long[] shape, KeanuRandom random);  }### Answer:
@Test public void logProbGraphMatchesKnownLogDensityOfScalar() { DoubleVertex location = ConstantVertex.of(0.); DoubleVertex scale = ConstantVertex.of(1.); CauchyVertex vertex = new CauchyVertex(location, scale); LogProbGraph logProbGraph = vertex.logProbGraph(); LogProbGraphValueFeeder.feedValue(logProbGraph, location, location.getValue()); LogProbGraphValueFeeder.feedValue(logProbGraph, scale, scale.getValue()); LogProbGraphValueFeeder.feedValue(logProbGraph, vertex, DoubleTensor.scalar(0.5)); CauchyDistribution distribution = new CauchyDistribution(0., 1.); double expectedDensity = distribution.logDensity(0.5); LogProbGraphContract.matchesKnownLogDensity(logProbGraph, expectedDensity); }
@Test public void logProbGraphMatchesKnownDensityOfVector() { DoubleVertex location = ConstantVertex.of(0., 0.); DoubleVertex scale = ConstantVertex.of(1., 1.); CauchyVertex vertex = new CauchyVertex(location, scale); LogProbGraph logProbGraph = vertex.logProbGraph(); LogProbGraphValueFeeder.feedValue(logProbGraph, location, location.getValue()); LogProbGraphValueFeeder.feedValue(logProbGraph, scale, scale.getValue()); LogProbGraphValueFeeder.feedValue(logProbGraph, vertex, DoubleTensor.create(0.25, -0.75)); CauchyDistribution distribution = new CauchyDistribution(0., 1.); double expectedDensity = distribution.logDensity(0.25) + distribution.logDensity(-0.75); LogProbGraphContract.matchesKnownLogDensity(logProbGraph, expectedDensity); }