public MatchCondition(INDArray x, double eps, Condition condition) { super(x); this.compare = condition.getValue(); this.mode = condition.condtionNum(); this.eps = eps; this.extraArgs = new Object[] {compare, eps, (double) mode}; }
/** * With this constructor, op will check each Y element against given Condition, and if condition met, element Z will be set to Y value, and X otherwise * * Pseudocode: * z[i] = condition(y[i]) ? y[i] : x[i]; * * @param x * @param y * @param z * @param condition */ public CompareAndSet(INDArray x, INDArray y, INDArray z, Condition condition) { super(x, y, z, x.lengthLong()); this.compare = condition.getValue(); this.set = 0; this.eps = condition.epsThreshold(); this.mode = condition.condtionNum(); init(x, y, z, x.lengthLong()); }
public Choose(SameDiff sameDiff, SDVariable[] args, Condition condition) { super(null, sameDiff, args); if(condition == null) { throw new ND4JIllegalArgumentException("Must specify a condition."); } this.inPlace = true; this.inplaceCall = true; addIArgument(condition.condtionNum()); this.condition = condition; }
public CompareAndSet(INDArray x, double compare, double set, double eps, Condition condition) { super(x); this.compare = compare; this.set = set; this.eps = eps; if (condition == null) this.mode = 0; else this.mode = condition.condtionNum(); init(x, null, x, x.length()); }
public FirstIndex(INDArray x, @NonNull Condition condition, double eps) { super(x); this.condition = condition; this.compare = condition.getValue(); this.mode = condition.condtionNum(); this.eps = eps; this.extraArgs = new Object[] {compare, eps, (double) mode}; }
/** * With this constructor, op will check each X element against given Condition, and if condition met, element Z will be set to Y value, and X otherwise * * Pseudocode: * z[i] = condition(x[i]) ? y[i] : x[i]; * * @param x * @param y * @param z * @param condition */ public CompareAndReplace(INDArray x, INDArray y, INDArray z, Condition condition) { super(x, y, z, x.lengthLong()); this.compare = condition.getValue(); this.set = 0; this.mode = condition.condtionNum(); this.eps = condition.epsThreshold(); init(x, y, z, x.lengthLong()); }
public Choose(String opName, INDArray[] inputs, Condition condition) { super(opName, inputs, null); if(condition == null) { throw new ND4JIllegalArgumentException("Must specify a condition."); } addInputArgument(inputs); addIArgument(condition.condtionNum()); addOutputArgument(Nd4j.create(inputs[0].length()),Nd4j.scalar(1.0)); }
public LastIndex(INDArray x, @NonNull Condition condition, double eps) { super(x,null,null,x.length()); this.condition = condition; this.compare = condition.getValue(); this.mode = condition.condtionNum(); this.eps = eps; this.extraArgs = new Object[] {compare, eps, (double) mode}; }
/** * With this constructor, op will check each X element against given Condition, and if condition met, element will be replaced with Set value * * Pseudocode: * z[i] = condition(x[i]) ? set : x[i]; * * @param x * @param set * @param condition */ public CompareAndSet(INDArray x, INDArray z, double set, Condition condition) { super(x, null, z, x.lengthLong()); this.compare = condition.getValue(); this.set = set; this.eps = condition.epsThreshold(); this.mode = condition.condtionNum(); init(x, null, z, x.lengthLong()); }
/** * Note that iArgs (integer arguments) and tArgs(double/float arguments) * may end up being used under the following conditions: * scalar operations (if a scalar is specified the you do not need to specify an ndarray) * otherwise, if an ndarray is needed as a second input then put it in the inputs * * Usually, you only need 1 input (the equivalent of the array you're trying to do indexing on) * * @param inputs the inputs in to the op * @param iArgs the integer arguments as needed * @param tArgs the arguments * @param condition the condition to filter on */ public Choose(INDArray[] inputs,List<Integer> iArgs, List<Double> tArgs,Condition condition) { super(null, inputs, null); if(condition == null) { throw new ND4JIllegalArgumentException("Must specify a condition."); } if(!iArgs.isEmpty()) addIArgument(Ints.toArray(iArgs)); if(!tArgs.isEmpty()) addTArgument(Doubles.toArray(tArgs)); addIArgument(condition.condtionNum()); addOutputArgument(Nd4j.create(inputs[0].shape(), inputs[0].ordering()),Nd4j.trueScalar(1.0)); }
public MatchConditionTransform(INDArray x, INDArray z, double eps, @NonNull Condition condition) { super(x, null, z, z.lengthLong()); this.compare = condition.getValue(); this.mode = condition.condtionNum(); this.eps = eps; this.extraArgs = new Object[] {compare, eps, (double) mode}; }
public CompareAndSet(INDArray x, double compare, double set, double eps, Condition condition) { super(x); this.compare = compare; this.set = set; this.eps = eps; if (condition == null) this.mode = 0; else this.mode = condition.condtionNum(); init(x, null, x, x.length()); }
public MatchCondition(INDArray x, double eps, Condition condition) { super(x); this.compare = condition.getValue(); this.mode = condition.condtionNum(); this.eps = eps; this.extraArgs = new Object[] {compare, eps, (double) mode}; }
public LastIndex(INDArray x, @NonNull Condition condition, double eps) { super(x); this.condition = condition; this.compare = condition.getValue(); this.mode = condition.condtionNum(); this.eps = eps; this.extraArgs = new Object[] {compare, eps, (double) mode}; }