public static cudnnReduceTensorOp ToCudnn(this TensorReduceOp op) { switch (op) { case TensorReduceOp.Add: return(cudnnReduceTensorOp.Add); case TensorReduceOp.Mul: return(cudnnReduceTensorOp.Mul); case TensorReduceOp.Min: return(cudnnReduceTensorOp.Min); case TensorReduceOp.Max: return(cudnnReduceTensorOp.Max); case TensorReduceOp.AMax: return(cudnnReduceTensorOp.AMax); case TensorReduceOp.Avg: return(cudnnReduceTensorOp.Avg); case TensorReduceOp.Norm1: return(cudnnReduceTensorOp.Norm1); case TensorReduceOp.Norm2: return(cudnnReduceTensorOp.Norm2); default: throw new ArgumentOutOfRangeException(nameof(op), op, null); } }
public override void DoReduce(Volume <double> result, TensorReduceOp op) { switch (op) { case TensorReduceOp.Add: DoSum(result); break; case TensorReduceOp.Mul: throw new NotImplementedException(); case TensorReduceOp.Min: throw new NotImplementedException(); case TensorReduceOp.Max: DoMax(result); break; case TensorReduceOp.AMax: throw new NotImplementedException(); case TensorReduceOp.Avg: throw new NotImplementedException(); case TensorReduceOp.Norm1: DoNorm1(result); break; case TensorReduceOp.Norm2: throw new NotImplementedException(); default: throw new ArgumentOutOfRangeException(nameof(op), op, null); } }
public override void Reduce(TensorReduceOp op, Volume <float> result) { if (this.Shape.Equals(result.Shape)) { result.Storage.CopyFrom(this.Storage); return; } switch (op) { case TensorReduceOp.Add: Sum(result); break; case TensorReduceOp.Mul: throw new NotImplementedException(); case TensorReduceOp.Min: Min(result); break; case TensorReduceOp.Max: Max(result); break; case TensorReduceOp.AMax: throw new NotImplementedException(); case TensorReduceOp.Avg: throw new NotImplementedException(); case TensorReduceOp.Norm1: Norm1(result); break; case TensorReduceOp.Norm2: throw new NotImplementedException(); default: throw new ArgumentOutOfRangeException(nameof(op), op, null); } }
public abstract void Reduce(TensorReduceOp op, Volume <T> result);
public abstract void DoReduce(Volume <T> result, TensorReduceOp op);
public override void DoReduce(Volume <float> result, TensorReduceOp op) { DoReduce(result, op.ToCudnn()); }
public override void DoReduce(Volume <double> result, TensorReduceOp op) { throw new NotImplementedException(); }
public override void Reduce(TensorReduceOp op, Volume <double> result) { this.Reduce(result, op.ToCudnn()); }