Exemple #1
0
        public void DivElemGPU_(FloatTensor tensor)
        {
            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.Dispatch(DivElemKernel_, this.size, 1, 1);
                }
                else
                {
                    tensor.Zero_();
                    tensor.Add_(1);
                }
            }
        }
Exemple #2
0
        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.Add_(1);
                    return(result);
                }
            }
            return(result);
        }