/** * Binary matrix of whether the number at a given index is greater than * * @param ndArray * @return */ public static INDArray floor(INDArray ndArray) { return floor(ndArray, true); }
static INDArray randInt(int [] shape, int upper) { return Transforms.floor(Nd4j.rand(shape).mul(upper)); }
INDArray currShape = NDArrayUtil.toNDArray(arr.shape()); INDArray startIndex = Transforms.floor(currShape.sub(shapeMatrix).divi(Nd4j.scalar(2))); INDArray endIndex = startIndex.add(shapeMatrix); INDArrayIndex[] indexes = Indices.createFromStartAndEnd(startIndex, endIndex);
print("Vector ceil", ceil); INDArray floor = floor(fourByFiveRandomZeroToOne); print("Vector floor", floor);
/** * Binary matrix of whether the number at a given index is greater than * * @param ndArray * @return */ public static INDArray floor(INDArray ndArray) { return floor(ndArray, Nd4j.copyOnOps); }
@Override public DoubleTensor floorInPlace() { Transforms.floor(tensor, false); return this; }
public static INDArray castToInteger(INDArray tensor, boolean duplicate) { INDArray tensorToDropFractionOn = duplicate ? tensor.dup() : tensor; INDArray sign = Transforms.sign(tensorToDropFractionOn); Transforms.floor(Transforms.abs(tensorToDropFractionOn, false), false).muli(sign); return tensorToDropFractionOn; } }
return Nd4j.getExecutioner().exec(new BernoulliDistribution(Nd4j.createUninitialized(shape, order), 0.5)); case INTEGER_0_10: return Transforms.floor(Nd4j.rand(shape).muli(10), false); case INTEGER_0_100: return Transforms.floor(Nd4j.rand(shape).muli(100), false); case INTEGER_0_1000: return Transforms.floor(Nd4j.rand(shape).muli(1000), false); case INTEGER_0_10000: return Transforms.floor(Nd4j.rand(shape).muli(10000), false); case INTEGER_0_100000: return Transforms.floor(Nd4j.rand(shape).muli(100000), false); default: throw new RuntimeException("Unknown enum value: " + values);
INDArray currShape = NDArrayUtil.toNDArray(arr.shape()); INDArray startIndex = Transforms.floor(currShape.sub(shapeMatrix).divi(Nd4j.scalar(2))); INDArray endIndex = startIndex.add(shapeMatrix); INDArrayIndex[] indexes = Indices.createFromStartAndEnd(startIndex, endIndex);