示例#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();
 }