Class BernoulliDistribution
- java.lang.Object
-
- org.nd4j.autodiff.functions.DifferentialFunction
-
- org.nd4j.linalg.api.ops.BaseOp
-
- org.nd4j.linalg.api.ops.random.BaseRandomOp
-
- org.nd4j.linalg.api.ops.random.impl.BernoulliDistribution
-
public class BernoulliDistribution extends BaseRandomOp
-
-
Field Summary
-
Fields inherited from class org.nd4j.linalg.api.ops.random.BaseRandomOp
dataType, shape
-
Fields inherited from class org.nd4j.linalg.api.ops.BaseOp
dimensionz, extraArgz, x, xVertexId, y, yVertexId, z, zVertexId
-
Fields inherited from class org.nd4j.autodiff.functions.DifferentialFunction
dimensions, extraArgs, inPlace, ownName, ownNameSetWithDefault, sameDiff, scalarValue
-
-
Constructor Summary
Constructors Constructor Description BernoulliDistribution()BernoulliDistribution(double p, DataType datatype, long... shape)BernoulliDistribution(@NonNull INDArray z, double prob)This op fills Z with bernoulli trial results, so 0, or 1, depending by common probabilityBernoulliDistribution(@NonNull INDArray z, @NonNull INDArray prob)This op fills Z with bernoulli trial results, so 0, or 1, each element will have it's own success probability defined in prob arrayBernoulliDistribution(SameDiff sd, double prob, long[] shape)BernoulliDistribution(SameDiff sd, double prob, DataType dataType, long[] shape)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<DataType>calculateOutputDataTypes(List<DataType> inputDataTypes)Calculate the data types for the output arrays.List<LongShapeDescriptor>calculateOutputShape()Calculate the output shape for this opList<LongShapeDescriptor>calculateOutputShape(OpContext oc)List<SDVariable>doDiff(List<SDVariable> f1)The actual implementation for automatic differentiation.StringonnxName()The opName of this function in onnxStringopName()The name of the opintopNum()The number of the op (mainly for old legacy XYZ ops likeOp)StringtensorflowName()The opName of this function tensorflow-
Methods inherited from class org.nd4j.linalg.api.ops.random.BaseRandomOp
isInPlace, isTripleArgRngOp, opType
-
Methods inherited from class org.nd4j.linalg.api.ops.BaseOp
clearArrays, computeVariables, defineDimensions, dimensions, equals, extraArgs, extraArgsBuff, extraArgsDataBuff, getFinalResult, getInputArgument, getNumOutputs, getOpType, hashCode, initFromOnnx, initFromTensorFlow, outputVariables, setX, setY, setZ, toCustomOp, toString, x, y, z
-
Methods inherited from class org.nd4j.autodiff.functions.DifferentialFunction
arg, arg, argNames, args, attributeAdaptersForFunction, configFieldName, configureWithSameDiff, diff, dup, getBooleanFromProperty, getDoubleValueFromProperty, getIntValueFromProperty, getLongValueFromProperty, getStringFromProperty, getValue, isConfigProperties, larg, mappingsForFunction, onnxNames, outputs, outputVariable, outputVariables, outputVariablesNames, propertiesForFunction, rarg, replaceArg, setInstanceId, setPropertiesForFunction, setValueFor, tensorflowNames
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.nd4j.linalg.api.ops.Op
clearArrays, extraArgs, extraArgsBuff, extraArgsDataBuff, setExtraArgs, setX, setY, setZ, toCustomOp, x, y, z
-
-
-
-
Constructor Detail
-
BernoulliDistribution
public BernoulliDistribution(SameDiff sd, double prob, long[] shape)
-
BernoulliDistribution
public BernoulliDistribution(SameDiff sd, double prob, DataType dataType, long[] shape)
-
BernoulliDistribution
public BernoulliDistribution()
-
BernoulliDistribution
public BernoulliDistribution(double p, DataType datatype, long... shape)
-
BernoulliDistribution
public BernoulliDistribution(@NonNull @NonNull INDArray z, double prob)This op fills Z with bernoulli trial results, so 0, or 1, depending by common probability- Parameters:
z-
-
-
Method Detail
-
opNum
public int opNum()
Description copied from class:DifferentialFunctionThe number of the op (mainly for old legacy XYZ ops likeOp)- Specified by:
opNumin interfaceOp- Overrides:
opNumin classDifferentialFunction- Returns:
-
opName
public String opName()
Description copied from class:DifferentialFunctionThe name of the op- Specified by:
opNamein interfaceOp- Overrides:
opNamein classDifferentialFunction- Returns:
- the opName of this operation
-
onnxName
public String onnxName()
Description copied from class:DifferentialFunctionThe opName of this function in onnx
-
tensorflowName
public String tensorflowName()
Description copied from class:DifferentialFunctionThe opName of this function tensorflow- Overrides:
tensorflowNamein classBaseOp- Returns:
-
calculateOutputShape
public List<LongShapeDescriptor> calculateOutputShape(OpContext oc)
- Overrides:
calculateOutputShapein classDifferentialFunction
-
calculateOutputShape
public List<LongShapeDescriptor> calculateOutputShape()
Description copied from class:DifferentialFunctionCalculate the output shape for this op- Overrides:
calculateOutputShapein classBaseRandomOp- Returns:
- List of output shape descriptors
-
doDiff
public List<SDVariable> doDiff(List<SDVariable> f1)
Description copied from class:DifferentialFunctionThe actual implementation for automatic differentiation.- Specified by:
doDiffin classDifferentialFunction- Returns:
-
calculateOutputDataTypes
public List<DataType> calculateOutputDataTypes(List<DataType> inputDataTypes)
Description copied from class:DifferentialFunctionCalculate the data types for the output arrays. Though datatypes can also be inferred fromDifferentialFunction.calculateOutputShape(), this method differs in that it does not require the input arrays to be populated. This is important as it allows us to do greedy datatype inference for the entire net - even if arrays are not available.- Overrides:
calculateOutputDataTypesin classBaseRandomOp- Parameters:
inputDataTypes- The data types of the inputs- Returns:
- The data types of the outputs
-
-