Search in sources :

Example 1 with FastRandom

use of com.simiacryptus.util.FastRandom in project MindsEye by SimiaCryptus.

the class StochasticBinaryNoiseLayer method eval.

@Override
public Result eval(@Nonnull final Result... inObj) {
    assert null == inObj || 0 == inObj.length;
    Tensor mask = masks.computeIfAbsent(seed, s -> {
        Tensor m = new Tensor(dimensions);
        FastRandom random = new FastRandom(seed ^ layerSeed);
        for (int i = 0; i < m.length(); i++) {
            m.set(i, s == 0 || (random.random() < density) ? amplitude : 0);
        }
        m.detach();
        return m;
    });
    return new Result(TensorArray.create(mask), null);
}
Also used : Tensor(com.simiacryptus.mindseye.lang.Tensor) FastRandom(com.simiacryptus.util.FastRandom) Result(com.simiacryptus.mindseye.lang.Result)

Aggregations

Result (com.simiacryptus.mindseye.lang.Result)1 Tensor (com.simiacryptus.mindseye.lang.Tensor)1 FastRandom (com.simiacryptus.util.FastRandom)1