anijain2305 commented on a change in pull request #5241: [Relay][OP] Add 
fast_erf implementation
URL: https://github.com/apache/incubator-tvm/pull/5241#discussion_r403762862
 
 

 ##########
 File path: topi/include/topi/elemwise.h
 ##########
 @@ -461,5 +462,75 @@ inline Tensor fast_exp(const Tensor& x,
   }
 }
 
+/*!
+ * \brief Fast_tanh_float implementation from Eigen
+ * 
https://github.com/eigenteam/eigen-git-mirror/blob/master/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h#L290
+ */
+inline Tensor fast_erf_float32(const Tensor& data,
+                               std::string name,
+                               std::string tag) {
+  auto plus_4 = make_const(DataType::Float(32), 4.f);
+  auto minus_4 = make_const(DataType::Float(32), -4.f);
+
+  // The monomial coefficients of the numerator polynomial (odd).
+  auto alpha_1 = make_const(DataType::Float(32), -1.60960333262415e-02f);
+  auto alpha_3 = make_const(DataType::Float(32), -2.95459980854025e-03f);
+  auto alpha_5 = make_const(DataType::Float(32), -7.34990630326855e-04f);
+  auto alpha_7 = make_const(DataType::Float(32), -5.69250639462346e-05f);
+  auto alpha_9 = make_const(DataType::Float(32), -2.10102402082508e-06f);
+  auto alpha_11 = make_const(DataType::Float(32), 2.77068142495902e-08f);
+  auto alpha_13 = make_const(DataType::Float(32), -2.72614225801306e-10f);
+
+  // The monomial coefficients of the denominator polynomial (even).
+  auto beta_0 = make_const(DataType::Float(32), -1.42647390514189e-02f);
+  auto beta_2 = make_const(DataType::Float(32), -7.37332916720468e-03f);
+  auto beta_4 = make_const(DataType::Float(32), -1.68282697438203e-03f);
+  auto beta_6 = make_const(DataType::Float(32), -2.13374055278905e-04f);
+  auto beta_8 = make_const(DataType::Float(32), -1.45660718464996e-05f);
+
+  return compute(data->shape, [&](const Array<Var> &i) {
+      // clamp x
 
 Review comment:
   Should this be 2 spaces instead of 4?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to