Ejemplo n.º 1
0
        public override IExpr Patch(Patch substitutions)
        {
            XSlice result;

            if (substitutions.TryGetValue(this, out result))
            {
                return(result);
            }
            var inputsPatched = Inputs.Patch(substitutions);

            if (inputsPatched != Inputs)
            {
                XSlice patched;
                if (IsSingleton)
                {
                    patched = new XSlice((Scalar <int>)inputsPatched[0]);
                }
                else
                {
                    patched = new XSlice((Scalar <int>)inputsPatched[0], (Scalar <int>)inputsPatched[1], (Scalar <int>)inputsPatched[2]);
                }
                substitutions.Add(this, patched);
                return(patched);
            }
            else
            {
                return(this);
            }
        }
Ejemplo n.º 2
0
            public override IExpr Patch(Patch substitutions)
            {
                Tensor <Type> result;

                if (substitutions.TryGetValue(this, out result))
                {
                    return(result);
                }
                var patchedLoop = Loop.Patch(substitutions);

                return(patchedLoop.Fors[Index]);
            }
Ejemplo n.º 3
0
        public override sealed IExpr Patch(Patch substitutions)
        {
            Tuple2 result;

            if (substitutions.TryGetValue(this, out result))
            {
                return(result);
            }
            var patchInputs = Inputs.Patch(substitutions);

            if (patchInputs == Inputs)
            {
                return(this);
            }
            result = Clone(patchInputs);
            substitutions.Add(this, result);
            return(result);
        }