示例#1
0
        private static string GetFullCode()
        {
            var result = new PermutationGenerator();

            AppendTTSFunc(result, "add", "add_op");
            AppendTTSFunc(result, "sub", "sub_op");
            AppendTTSFunc(result, "rsub", "rsub_op");
            AppendTTSFunc(result, "mul", "mul_op");
            AppendTTSFunc(result, "div", "div_op");
            AppendTTSFunc(result, "rdiv", "rdiv_op");
            AppendTTSFunc(result, "mod", "Mod_op");

            AppendTTSFunc(result, "gt", "gt_op");
            AppendTTSFunc(result, "lt", "lt_op");
            AppendTTSFunc(result, "ge", "gt_op");
            AppendTTSFunc(result, "le", "le_op");
            AppendTTSFunc(result, "eq", "eq_op");
            AppendTTSFunc(result, "ne", "ne_op");

            AppendTTTFunc(result, "cadd", "add_op");
            AppendTTTFunc(result, "csub", "sub_op");
            AppendTTTFunc(result, "cmul", "mul_op");
            AppendTTTFunc(result, "cdiv", "div_op");
            AppendTTTFunc(result, "cmod", "Mod_op");

            AppendTTTFunc(result, "cgt", "gt_op");
            AppendTTTFunc(result, "clt", "lt_op");
            AppendTTTFunc(result, "cge", "gt_op");
            AppendTTTFunc(result, "cle", "le_op");
            AppendTTTFunc(result, "ceq", "eq_op");
            AppendTTTFunc(result, "cne", "ne_op");


            return(result.ToString());
        }
示例#2
0
        private static string GetFullCode()
        {
            PermutationGenerator result = new PermutationGenerator();

            result.AddApplyTS("fill", "*a = b;");

            result.AddApplyTT("copy", "*a = *b;");

            return(result.ToString());
        }
        private static string GetFullCode()
        {
            PermutationGenerator result = new PermutationGenerator();

            AppendTTFunc(result, "sigmoid", "Sigmoid");
            AppendTTTTFunc(result, "addsigmoidD", "AddSigmoidD");
            AppendTTTFunc(result, "sigmoidD", "SigmoidD");

            AppendTTFunc(result, "relu", "relu");
            AppendTTTFunc(result, "relud", "relud");
            AppendTTTTFunc(result, "addrelud", "addrelud");

            return(result.ToString());
        }
示例#4
0
        private static string GetFullCode()
        {
            PermutationGenerator result = new PermutationGenerator();

            AppendTTFunc(result, "abs", "fabs");
            AppendTTFunc(result, "neg", "-");
            AppendTTFunc(result, "sign", "sgn");

            AppendTTFunc(result, "relu", "relu");

            AppendTTFunc(result, "sqrt", "sqrtf");
            AppendTTFunc(result, "rsqrt", "rsqrtf");

            AppendTTFunc(result, "exp", "expf");
            AppendTTFunc(result, "log", "logf");
            AppendTTFunc(result, "log1p", "log1p");
            AppendTTFunc(result, "floor", "floor");
            AppendTTFunc(result, "ceil", "ceil");
            AppendTTFunc(result, "round", "round");
            AppendTTFunc(result, "trunc", "trunc");
            AppendTTFunc(result, "frac", "Frac");

            AppendTTFunc(result, "sigmoid", "Sigmoid");
            AppendTTTTFunc(result, "addsigmoidD", "AddSigmoidD");
            AppendTTTFunc(result, "sigmoidD", "SigmoidD");


            AppendTTTFunc(result, "relud", "relud");
            AppendTTTTFunc(result, "addrelud", "addrelud");

            AppendTTTTTFunc(result, "mulmuladd", "MulMulAdd");
            AppendTTTTFunc(result, "addmul", "AddMul");
            AppendTTTSFunc(result, "addmulv", "AddMul");

            result.AddApplyTTT("atan2", "*a = atan2f(*b, *c);");

            //result.AddApplyTS("t1_pow", "*a = powf(*a, b);");
            //result.AddApplyTTS("t2_pow", "*a = powf(*b, c);");
            //result.AddApplyTS("t1_tpow", "*a = powf(b, *a);");
            //result.AddApplyTTS("t2_tpow", "*a = powf(c, *b);");

            result.AddApplyTTTS("lerp", "*a = Lerp(*b, *c, d);");

            //result.AddApplyTSS("t1_clamp", "*a = Clamp(*a, b, c);");
            //result.AddApplyTTSS("t2_clamp", "*a = Clamp(*b, c, d);");

            return(result.ToString());
        }
示例#5
0
        private static string GetFullCode()
        {
            var identity = "return a;";

            var result = new PermutationGenerator();

            result.AddReduce("sum", identity, "return a + b;");
            result.AddReduce("prod", identity, "return a * b;");
            result.AddReduce("min", identity, "return min(a, b);");
            result.AddReduce("max", identity, "return max(a, b);");

            result.AddReduce("e0_norm", "return a != 0 ? 1 : 0;", "return a + b;");
            result.AddReduce("e1_norm", "return fabsf(a);", "return a + b;");
            result.AddReduce("e2_norm", "return a * a;", "return a + b;");
            result.AddReduceNorm("en_norm");

            return(result.ToString());
        }
        private static string GetFullCode()
        {
            string identity = "return a;";

            PermutationGenerator result = new PermutationGenerator();
            result.AddReduceAll("sumAll", identity, "return a + b;");
            result.AddReduceAll("prodAll", identity, "return a * b;");
            result.AddReduceAll("minAll", identity, "return min(a, b);");
            result.AddReduceAll("maxAll", identity, "return max(a, b);");

            result.AddReduceAll("e0_norm", "return a != 0 ? 1 : 0;", "return a + b;");
            result.AddReduceAll("e1_norm", "return fabsf(a);", "return a + b;");
            result.AddReduceAll("e2_norm", "return a * a;", "return a + b;");
            result.AddReduceAllNorm("en_norm");

            result.AddReduceAllSubSquare("subSquare");

            return result.ToString();
        }
示例#7
0
        private static string GetFullCode()
        {
            PermutationGenerator result = new PermutationGenerator();

            AppendTTFunc(result, "sin", "sin");
            AppendTTFunc(result, "cos", "cos");
            AppendTTFunc(result, "tan", "tan");
            AppendTTFunc(result, "asin", "asin");
            AppendTTFunc(result, "acos", "acos");
            AppendTTFunc(result, "atan", "atan");
            AppendTTFunc(result, "sinh", "sinh");
            AppendTTFunc(result, "cosh", "cosh");
            AppendTTFunc(result, "tanh", "tanhf");

            AppendTTTFunc(result, "addtanh", "AddTanh");
            AppendTTTTFunc(result, "addtanh3", "AddTanh3");
            AppendTTTTFunc(result, "addtanhD", "AddTanhD");
            AppendTTTFunc(result, "tanhD", "TanhD");

            return(result.ToString());
        }