return sycl::log(x);
}
+template<typename T>
+static __dpct_inline__ T op_softplus(T x) {
+ const float xf = (float) x;
+ const float ax = sycl::fabs(xf);
+ const float m = sycl::fmax(xf, 0.0f);
+ const float y = m + sycl::log1p(sycl::exp(-ax));
+ return (T) y;
+}
+
template<typename T>
static __dpct_inline__ T op_neg(T x) {
return -x;
});
}
+static inline void ggml_sycl_op_softplus(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {
+ ggml_sycl_detail::ggml_sycl_op_unary(ctx, dst, [](auto x) {
+ return op_softplus(x);
+ });
+}
+
static inline void ggml_sycl_op_neg(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {
ggml_sycl_detail::ggml_sycl_op_unary(ctx, dst, [](auto x) {
return op_neg(x);
ggml_sycl_op_log(ctx, dst);
}
+void ggml_sycl_softplus(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {
+ scope_op_debug_print scope_dbg_print(__func__, dst, /*num_src=*/1);
+ ggml_sycl_op_softplus(ctx, dst);
+}
+
void ggml_sycl_neg(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {
scope_op_debug_print scope_dbg_print(__func__, dst, /*num_src=*/1);
ggml_sycl_op_neg(ctx, dst);
void ggml_sycl_log(ggml_backend_sycl_context & ctx, ggml_tensor * dst);
+void ggml_sycl_softplus(ggml_backend_sycl_context & ctx, ggml_tensor * dst);
+
void ggml_sycl_neg(ggml_backend_sycl_context & ctx, ggml_tensor * dst);
void ggml_sycl_step(ggml_backend_sycl_context & ctx, ggml_tensor * dst);
case GGML_UNARY_OP_EXP:
ggml_sycl_exp(ctx, dst);
break;
+ case GGML_UNARY_OP_SOFTPLUS:
+ ggml_sycl_softplus(ctx, dst);
+ break;
case GGML_UNARY_OP_SGN:
ggml_sycl_sgn(ctx, dst);
break;
case GGML_UNARY_OP_GELU_QUICK:
case GGML_UNARY_OP_GELU_ERF:
case GGML_UNARY_OP_EXP:
+ case GGML_UNARY_OP_SOFTPLUS:
case GGML_UNARY_OP_ELU:
return true;
case GGML_UNARY_OP_FLOOR: