All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
org.nd4j.linalg.api.ops.impl.transforms.LegacyDropOut Maven / Gradle / Ivy
package org.nd4j.linalg.api.ops.impl.transforms;
import org.nd4j.linalg.api.complex.IComplexNumber;
import org.nd4j.linalg.api.ndarray.INDArray;
import org.nd4j.linalg.api.ops.BaseTransformOp;
import org.nd4j.linalg.api.ops.Op;
/**
* DropOut implementation as Op
*
* PLEASE NOTE: This is legacy DropOut implementation, please consider using op with the same name from randomOps
* @author [email protected]
*/
public class LegacyDropOut extends BaseTransformOp {
private double p;
public LegacyDropOut() {
}
public LegacyDropOut(INDArray x, double p) {
super(x);
this.p = p;
init(x, null, x, x.length());
}
public LegacyDropOut(INDArray x, INDArray z, double p) {
super(x, z);
this.p = p;
init(x, null, z, x.length());
}
public LegacyDropOut(INDArray x, INDArray z, double p, long n) {
super(x, z, n);
this.p = p;
init(x, null, z, n);
}
@Override
public int opNum() {
return 43;
}
@Override
public String name() {
return "legacy_dropout";
}
@Override
public IComplexNumber op(IComplexNumber origin, double other) {
return null;
}
@Override
public IComplexNumber op(IComplexNumber origin, float other) {
return null;
}
@Override
public IComplexNumber op(IComplexNumber origin, IComplexNumber other) {
return null;
}
@Override
public float op(float origin, float other) {
return 0;
}
@Override
public double op(double origin, double other) {
return 0;
}
@Override
public double op(double origin) {
return 0;
}
@Override
public float op(float origin) {
return 0;
}
@Override
public IComplexNumber op(IComplexNumber origin) {
return null;
}
@Override
public Op opForDimension(int index, int dimension) {
INDArray xAlongDimension = x.vectorAlongDimension(index, dimension);
if (y() != null)
return new LegacyDropOut(xAlongDimension, z.vectorAlongDimension(index, dimension), p,
xAlongDimension.length());
else
return new LegacyDropOut(xAlongDimension, z.vectorAlongDimension(index, dimension), p,
xAlongDimension.length());
}
@Override
public Op opForDimension(int index, int... dimension) {
INDArray xAlongDimension = x.tensorAlongDimension(index, dimension);
if (y() != null)
return new LegacyDropOut(xAlongDimension, z.tensorAlongDimension(index, dimension), p,
xAlongDimension.length());
else
return new LegacyDropOut(xAlongDimension, z.tensorAlongDimension(index, dimension), p,
xAlongDimension.length());
}
@Override
public void init(INDArray x, INDArray y, INDArray z, long n) {
super.init(x, y, z, n);
this.extraArgs = new Object[] {p, (double) n};
}
}