public static KerasSymbol Selu(KerasSymbol x) { var alpha = 1.6732632423543772f; var scale = 1.0507009873554805f; return(scale * K.Elu(x, alpha)); }
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)); }
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)); }
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)); }
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); }
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); }
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}"); } }
public static KerasSymbol OnesLike(KerasSymbol x, DType dtype = null, string name = "") { throw new NotImplementedException(); }
public static KerasSymbol Softplus(KerasSymbol x) { return(K.Softplus(x)); }
public static KerasSymbol Cast(KerasSymbol x, DType dtype) { throw new NotImplementedException(); }
public static KerasSymbol Elu(KerasSymbol x, float alpha = 1) { return(K.Elu(x, alpha)); }
public static KerasSymbol HardSigmoid(KerasSymbol x) { return(K.HardSigmoid(x)); }
public static KerasSymbol Linear(KerasSymbol x) { return(x); }
public static KerasSymbol Gather(KerasSymbol reference, KerasSymbol indices) { throw new NotImplementedException(); }
public static KerasSymbol Tanh(KerasSymbol x) { return(K.Tanh(x)); }
public static KerasSymbol BatchDot(KerasSymbol x, KerasSymbol y, Shape axes = null) { throw new NotImplementedException(); }
public static KerasSymbol Transpose(KerasSymbol x) { throw new NotImplementedException(); }
public static KerasSymbol Dot(KerasSymbol x, KerasSymbol y) { throw new NotImplementedException(); }
public static KerasSymbol MovingAverageUpdate(KerasSymbol x, NDArray value, float momentum) { throw new NotImplementedException(); }
public static KerasSymbol UpdateSub(KerasSymbol x, NDArray new_x) { throw new NotSupportedException("MXNet Backend: Update operations are not supported yet."); }
public static KerasSymbol Softsign(KerasSymbol x) { return(K.Softsign(x)); }
public static KerasSymbol Identity(KerasSymbol x) { throw new NotImplementedException(); }
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)); }
public static KerasSymbol Prod(KerasSymbol x, int axis, bool keepdims = false) { throw new NotImplementedException(); }
public static KerasSymbol Sigmoid(KerasSymbol x) { return(K.Sigmoid(x)); }
public static KerasSymbol CumProd(KerasSymbol x, int axis = 0) { throw new NotSupportedException("MXNet Backend: CumProd operations are not supported yet."); }
public static KerasSymbol Exponential(KerasSymbol x) { return(K.Exp(x)); }
public static KerasSymbol ToDense(KerasSymbol tensor) { throw new NotImplementedException(); }
public static KerasSymbol Embedding(KerasSymbol data, KerasSymbol weight, int input_dim, int output_dim, bool sparse_grad = false) { throw new NotImplementedException(); }
public static int CountParams(KerasSymbol x) { throw new NotImplementedException(); }