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);
            }
        }
示例#2
0
        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);
            }
        }
示例#3
0
        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);
            }
        }
示例#4
0
 public abstract void Reduce(TensorReduceOp op, Volume <T> result);
示例#5
0
 public abstract void DoReduce(Volume <T> result, TensorReduceOp op);
示例#6
0
 public override void DoReduce(Volume <float> result, TensorReduceOp op)
 {
     DoReduce(result, op.ToCudnn());
 }
示例#7
0
 public override void DoReduce(Volume <double> result, TensorReduceOp op)
 {
     throw new NotImplementedException();
 }
示例#8
0
 public override void Reduce(TensorReduceOp op, Volume <double> result)
 {
     this.Reduce(result, op.ToCudnn());
 }