예제 #1
0
        public static KerasSymbol Selu(KerasSymbol x)
        {
            var alpha = 1.6732632423543772f;
            var scale = 1.0507009873554805f;

            return(scale * K.Elu(x, alpha));
        }
예제 #2
0
        public static KerasSymbol Logcosh(KerasSymbol y_true, KerasSymbol y_pred)
        {
            var x        = y_pred - y_true;
            var _logcosh = x + K.Softplus(-2 * x) - (float)Math.Log(2);

            return(K.Mean(_logcosh, axis: -1));
        }
예제 #3
0
        public static KerasSymbol CategorialHinge(KerasSymbol y_true, KerasSymbol y_pred)
        {
            var pos = K.Sum(y_true * y_pred, axis: -1);
            var neg = K.Max((1 - y_true) * y_pred, axis: -1);

            return(K.Maximum(0, neg - pos + 1));
        }
예제 #4
0
        public static KerasSymbol MeanSquaredLogrithmicError(KerasSymbol y_true, KerasSymbol y_pred)
        {
            var first_log  = K.Log(K.Clip(y_pred, K.Epsilon(), null) + 1);
            var second_log = K.Log(K.Clip(y_true, K.Epsilon(), null) + 1);

            return(K.Mean(K.Square(first_log - second_log), axis: -1));
        }
예제 #5
0
        public static KerasSymbol operator %(KerasSymbol lhs, KerasSymbol rhs)
        {
            KerasSymbol ret = null;

            using (var op = new Operator("_mod"))
            {
                ret = op.Set(lhs, rhs).CreateSymbol("mod");
            }

            return(ret);
        }
예제 #6
0
        public static KerasSymbol operator %(KerasSymbol lhs, float scalar)
        {
            KerasSymbol ret = null;

            using (var op = new Operator("_mod_scalar"))
            {
                ret = op.Set(lhs, scalar).CreateSymbol("mod");
            }

            return(ret);
        }
예제 #7
0
        public static KerasSymbol Softmax(KerasSymbol x, int axis = -1)
        {
            var ndim = K.NDim(x);

            if (ndim == 2)
            {
                return(K.Softmax(x));
            }
            else if (ndim > 2)
            {
                var e = K.Exp(x - K.Max(x, axis: axis, keepdims: true));
                var s = K.Sum(e, axis: axis, keepdims: true);
                return(e / s);
            }
            else if (ndim == 0)
            {
                // x dim is not inferred yet
                return(K.Softmax(x));
            }
            else
            {
                throw new Exception($"Cannot apply softmax to a tensor that is 1D. Received input: {x}");
            }
        }
예제 #8
0
 public static KerasSymbol OnesLike(KerasSymbol x, DType dtype = null, string name = "")
 {
     throw new NotImplementedException();
 }
예제 #9
0
 public static KerasSymbol Softplus(KerasSymbol x)
 {
     return(K.Softplus(x));
 }
예제 #10
0
 public static KerasSymbol Cast(KerasSymbol x, DType dtype)
 {
     throw new NotImplementedException();
 }
예제 #11
0
 public static KerasSymbol Elu(KerasSymbol x, float alpha = 1)
 {
     return(K.Elu(x, alpha));
 }
예제 #12
0
 public static KerasSymbol HardSigmoid(KerasSymbol x)
 {
     return(K.HardSigmoid(x));
 }
예제 #13
0
 public static KerasSymbol Linear(KerasSymbol x)
 {
     return(x);
 }
예제 #14
0
 public static KerasSymbol Gather(KerasSymbol reference, KerasSymbol indices)
 {
     throw new NotImplementedException();
 }
예제 #15
0
 public static KerasSymbol Tanh(KerasSymbol x)
 {
     return(K.Tanh(x));
 }
예제 #16
0
 public static KerasSymbol BatchDot(KerasSymbol x, KerasSymbol y, Shape axes = null)
 {
     throw new NotImplementedException();
 }
예제 #17
0
 public static KerasSymbol Transpose(KerasSymbol x)
 {
     throw new NotImplementedException();
 }
예제 #18
0
 public static KerasSymbol Dot(KerasSymbol x, KerasSymbol y)
 {
     throw new NotImplementedException();
 }
예제 #19
0
 public static KerasSymbol MovingAverageUpdate(KerasSymbol x, NDArray value, float momentum)
 {
     throw new NotImplementedException();
 }
예제 #20
0
 public static KerasSymbol UpdateSub(KerasSymbol x, NDArray new_x)
 {
     throw new NotSupportedException("MXNet Backend: Update operations are not supported yet.");
 }
예제 #21
0
 public static KerasSymbol Softsign(KerasSymbol x)
 {
     return(K.Softsign(x));
 }
예제 #22
0
 public static KerasSymbol Identity(KerasSymbol x)
 {
     throw new NotImplementedException();
 }
예제 #23
0
 public static KerasSymbol Relu(KerasSymbol x, float alpha = 0, float?max_value = null, float threshold = 0)
 {
     return(K.Relu(x, alpha: alpha, max_value: max_value, threshold: threshold));
 }
예제 #24
0
 public static KerasSymbol Prod(KerasSymbol x, int axis, bool keepdims = false)
 {
     throw new NotImplementedException();
 }
예제 #25
0
 public static KerasSymbol Sigmoid(KerasSymbol x)
 {
     return(K.Sigmoid(x));
 }
예제 #26
0
 public static KerasSymbol CumProd(KerasSymbol x, int axis = 0)
 {
     throw new NotSupportedException("MXNet Backend: CumProd operations are not supported yet.");
 }
예제 #27
0
 public static KerasSymbol Exponential(KerasSymbol x)
 {
     return(K.Exp(x));
 }
예제 #28
0
 public static KerasSymbol ToDense(KerasSymbol tensor)
 {
     throw new NotImplementedException();
 }
예제 #29
0
 public static KerasSymbol Embedding(KerasSymbol data, KerasSymbol weight, int input_dim, int output_dim, bool sparse_grad = false)
 {
     throw new NotImplementedException();
 }
예제 #30
0
 public static int CountParams(KerasSymbol x)
 {
     throw new NotImplementedException();
 }