public NDArray VarAll(NDArray result, NDArray src) { if (src.DimensionCount == 0 || src.ElementCount() == 0) { throw new ArgumentException("src must be a non-empty tensor"); } var mean = Ops.MeanAll(src); var writeTarget = ReduceAllOp.Invoke(cudaReduceAllKernels, 0.0f, ReduceInitType.GivenValue, "en_norm", result, src, mean); Div(writeTarget, writeTarget, src.ElementCount() - 1); return(writeTarget); }
public NDArray NormAll(NDArray result, NDArray src, float value) { if (value == 0) { return(ReduceAllOp.Invoke(cudaReduceAllKernels, 0.0f, ReduceInitType.GivenValue, "e0_norm", result, src)); } else if (value == 1) { return(ReduceAllOp.Invoke(cudaReduceAllKernels, 0.0f, ReduceInitType.GivenValue, "e1_norm", result, src)); } else if (value == 2) { var writeTarget = ReduceAllOp.Invoke(cudaReduceAllKernels, 0.0f, ReduceInitType.GivenValue, "e2_norm", result, src); Pow(writeTarget, writeTarget, 0.5f); return(writeTarget); } else { var writeTarget = ReduceAllOp.Invoke(cudaReduceAllKernels, 0.0f, ReduceInitType.GivenValue, "en_norm", result, src, value); Pow(writeTarget, writeTarget, 1.0f / value); return(writeTarget); } }
public Tensor NormAll(Tensor result, Tensor src, float value) { if (value == 0) { return(ReduceAllOp.Invoke(cudaReduceAllKernels, 0.0f, ReduceInitType.GivenValue, "e0_normAll", result, src)); } else if (value == 1) { return(ReduceAllOp.Invoke(cudaReduceAllKernels, 0.0f, ReduceInitType.GivenValue, "e1_normAll", result, src)); } else if (value == 2) { Tensor writeTarget = ReduceAllOp.Invoke(cudaReduceAllKernels, 0.0f, ReduceInitType.GivenValue, "e2_normAll", result, src); Pow(writeTarget, writeTarget, 0.5f); return(writeTarget); } else { Tensor writeTarget = ReduceAllOp.Invoke(cudaReduceAllKernels, 0.0f, ReduceInitType.GivenValue, "en_normAll", result, src, value); Pow(writeTarget, writeTarget, 1.0f / value); return(writeTarget); } }
public NDArray MaxAll(NDArray result, NDArray src) { return(ReduceAllOp.Invoke(cudaReduceAllKernels, 0, ReduceInitType.MinValue, "maxAll", result, src)); }
public NDArray ProdAll(NDArray result, NDArray src) { return(ReduceAllOp.Invoke(cudaReduceAllKernels, 1.0f, ReduceInitType.GivenValue, "prodAll", result, src)); }
public Tensor MaxAll(Tensor result, Tensor src) { return(ReduceAllOp.Invoke(cudaReduceAllKernels, 0, ReduceInitType.MinValue, "maxAll", result, src)); }
public Tensor ProdAll(Tensor result, Tensor src) { return(ReduceAllOp.Invoke(cudaReduceAllKernels, 1.0f, ReduceInitType.GivenValue, "prodAll", result, src)); }