Beispiel #1
0
            public JobHandle ScheduleXSBO(BurstTensorData pinX, BurstTensorData pinS, BurstTensorData pinB, BurstTensorData pinO, int arrayLength, int innerBatchCount, FencingHelperMode fencingMode = FencingHelperMode.UpdateResourcesFencesOnScheduling)
            {
                bool AHalf = pinX.array.Type == DataType.Half;
                bool WHalf = pinS.array.Type == DataType.Half;
                bool BHalf = pinB.array.Type == DataType.Half;
                bool OHalf = pinO.array.Type == DataType.Half;

                UnityEngine.Assertions.Assert.AreEqual(AHalf, OHalf);
                UnityEngine.Assertions.Assert.AreEqual(WHalf, BHalf);
                if (AHalf && WHalf)
                {
                    var job = new DepthwiseConv2DJob_Full_Half();
                    job.data = this;
                    return(job.ScheduleXSBO(pinX, pinS, pinB, pinO, arrayLength, innerBatchCount, fencingMode));
                }
                else if (!AHalf && WHalf)
                {
                    var job = new DepthwiseConv2DJob_ActAsFloat_WeightAsHalf();
                    job.data = this;
                    return(job.ScheduleXSBO(pinX, pinS, pinB, pinO, arrayLength, innerBatchCount, fencingMode));
                }
                else if (!AHalf && !WHalf)
                {
                    var job = new DepthwiseConv2DJob_Full_Float();
                    job.data = this;
                    return(job.ScheduleXSBO(pinX, pinS, pinB, pinO, arrayLength, innerBatchCount, fencingMode));
                }
                else //if (AHalf && !WHalf)
                {
                    UnityEngine.Assertions.Assert.IsTrue(false, "DepthwiseConv2DJob does not support activation as half while weights are floats.");
                    return(new JobHandle());
                }
            }
Beispiel #2
0
            public JobHandle ScheduleXSBO(Tensor X, Tensor S, Tensor B, Tensor O, int arrayLength, int innerBatchCount, FencingHelperMode fencingMode = FencingHelperMode.UpdateResourcesFencesOnScheduling)
            {
                var pinX = Pin(X);
                var pinS = Pin(S);
                var pinB = Pin(B);
                var pinO = Pin(O, uploadCache: false);

                return(ScheduleXSBO(pinX, pinS, pinB, pinO, arrayLength, innerBatchCount, fencingMode));
            }