Exemplo n.º 1
0
 public FloatTensor RemainderElemGPU(FloatTensor divisor, FloatTensor result)
 {
     Debug.LogFormat("<color=blue>FloatTensor.RemainderElemGPU dataOnGpu: {0}</color>", dataOnGpu);
     if (dataOnGpu)
     {
         if (this.Id != divisor.Id)
         {
             shader.SetBuffer(RemainderElemKernel, "RemainderElemDataA", this.DataBuffer);
             shader.SetBuffer(RemainderElemKernel, "RemainderElemDataB", divisor.DataBuffer);
             shader.SetBuffer(RemainderElemKernel, "RemainderElemResult", result.DataBuffer);
             shader.Dispatch(RemainderElemKernel, this.size, 1, 1);
         }
         else
         {
             result.ZeroGPU_();
         }
     }
     return(result);
 }
        public FloatTensor DivElemGPU(FloatTensor tensor, FloatTensor result)
        {
            Debug.LogFormat("<color=blue>FloatTensor.DivElemGPU dataOnGpu: {0}</color>", dataOnGpu);

            if (dataOnGpu)
            {
                if (tensor.id != this.id)
                {
                    shader.SetBuffer(DivElemKernel, "DivElemDataA", dataBuffer);
                    shader.SetBuffer(DivElemKernel, "DivElemDataB", tensor.dataBuffer);
                    shader.SetBuffer(DivElemKernel, "DivElemDataResult", result.dataBuffer);
                    shader.Dispatch(DivElemKernel, this.size, 1, 1);
                }
                else
                {
                    result.ZeroGPU_();
                    result.AddScalarGPU_((float)1);
                    return(result);
                }
            }
            return(result);
        }