Refine search
/** * This method does element-wise assessing for 2 equal-sized matrices, for each element that matches Condition * * @param to * @param set * @param condition */ public static void replaceWhere(@NonNull INDArray to, @NonNull Number set, @NonNull Condition condition) { if (!(condition instanceof BaseCondition)) throw new UnsupportedOperationException("Only static Conditions are supported"); Nd4j.getExecutioner().exec(new CompareAndSet(to, set.doubleValue(), condition)); }
/** * Fill the given ndarray with random numbers drawn from a normal distribution utilizing the given random generator * * @param target target array * @param rng the random generator to use * @return the given target array */ public static INDArray randn(INDArray target, org.nd4j.linalg.api.rng.Random rng) { return getExecutioner().exec(new GaussianDistribution(target), rng); }
/** * Returns entropy along dimension * @param dimension * @return */ @Override public INDArray entropy(int... dimension) { return Nd4j.getExecutioner().exec(new Entropy(this), dimension); }
@Override public INDArray sample(INDArray ret) { if (means != null) { return Nd4j.getExecutioner().exec(new org.nd4j.linalg.api.ops.random.impl.TruncatedNormalDistribution( ret, means, standardDeviation), random); } else { return Nd4j.getExecutioner().exec(new org.nd4j.linalg.api.ops.random.impl.TruncatedNormalDistribution( ret, mean, standardDeviation), random); } } }
@Override public INDArray lti(Number other) { Nd4j.getExecutioner().exec(new ScalarLessThan(this, other)); return this; }
/** * Returns log entropy along dimension * @param dimension * @return */ @Override public INDArray logEntropy(int... dimension) { return Nd4j.getExecutioner().exec(new LogEntropy(this), dimension); }
/** * Returns the norm2 along the specified dimension * * @param dimension the dimension to getScalar the norm2 along * @return the norm2 along the specified dimension */ @Override public INDArray norm2(int... dimension) { return Nd4j.getExecutioner().exec(new Norm2(this), dimension); }
@Override public INDArray sample(INDArray ret) { if (means != null) { return Nd4j.getExecutioner().exec(new org.nd4j.linalg.api.ops.random.impl.LogNormalDistribution( ret, means, standardDeviation), random); } else { return Nd4j.getExecutioner().exec(new org.nd4j.linalg.api.ops.random.impl.LogNormalDistribution( ret, mean, standardDeviation), random); } } }
/** * Fill the given ndarray with random numbers drawn from a uniform distribution using the given RandomGenerator * * @param target target array * @param rng the random generator to use * @return the given target array */ public static INDArray rand(INDArray target, org.nd4j.linalg.api.rng.Random rng) { return getExecutioner().exec(new UniformDistribution(target), rng); }
/** * Returns the normmax along the specified dimension * * @param dimension the dimension to getScalar the norm1 along * @return the norm1 along the specified dimension */ @Override public INDArray normmax(int... dimension) { return Nd4j.getExecutioner().exec(new NormMax(this), dimension); }
/** * Set the value of the ndarray to the specified value * * @param value the value to assign * @return the ndarray with the values */ @Override public INDArray assign(Number value) { Nd4j.getExecutioner().exec(new ScalarSet(this, value)); return this; }
/** * Returns the overall mean of this ndarray * * @param dimension the dimension to getScalar the mean along * @return the mean along the specified dimension of this ndarray */ @Override public INDArray mean(int... dimension) { return Nd4j.getExecutioner().exec(new Mean(this), dimension); }
/** * Generate a linearly spaced vector * * @param lower upper bound * @param upper lower bound * @param num the step size * @return the linearly spaced vector */ public static INDArray linspace(double lower, double upper, long num) { // FIXME: int cast return Nd4j.getExecutioner().exec(new Linspace(lower, upper, (int) num)); }
/** * Clear nans from an ndarray * * @param arr the array to clear */ public static void clearNans(INDArray arr) { //BooleanIndexing.applyWhere(arr, Conditions.isNan(), new Value(Nd4j.EPS_THRESHOLD)); getExecutioner().exec(new ReplaceNans(arr, Nd4j.EPS_THRESHOLD)); }
@Override public INDArray gti(Number other) { Nd4j.getExecutioner().exec(new ScalarGreaterThan(this, other)); return this; }
/** * Returns the overall variance of this ndarray * * @param biasCorrected boolean on whether to apply corrected bias * @param dimension the dimension to getScalar the mean along * @return the mean along the specified dimension of this ndarray */ @Override public INDArray var(boolean biasCorrected, int... dimension) { return Nd4j.getExecutioner().exec(new Variance(this, biasCorrected), dimension); }
/** * Returns the overall max of this ndarray * * @param dimension the dimension to getScalar the mean along * @return the mean along the specified dimension of this ndarray */ @Override public INDArray max(int... dimension) { return Nd4j.getExecutioner().exec(new Max(this), dimension); }
/** * Returns non-normalized Shannon entropy along dimension * @param dimension * @return */ @Override public INDArray shannonEntropy(int... dimension) { return Nd4j.getExecutioner().exec(new ShannonEntropy(this), dimension); }
@Override public INDArray std(boolean biasCorrected, int... dimension) { return Nd4j.getExecutioner().exec(new StandardDeviation(this, biasCorrected), dimension); }
@Override public INDArray fmod(INDArray denominator, INDArray result) { OldFModOp op = new OldFModOp(this, denominator, result); Nd4j.getExecutioner().exec(op); return result; }