aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lite/kernels/elementwise.cc
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-09-11 21:18:05 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-09-11 21:22:09 -0700
commit6a21e1386e3e68cf752af861b9b1b950bda8a130 (patch)
tree0ccc9df1c589ffb059b707c58d8c7c094f6f9de0 /tensorflow/contrib/lite/kernels/elementwise.cc
parentcadd6b42bf6b01c2668420463b0986acd7fd9009 (diff)
Implementation of square.
PiperOrigin-RevId: 212577288
Diffstat (limited to 'tensorflow/contrib/lite/kernels/elementwise.cc')
-rw-r--r--tensorflow/contrib/lite/kernels/elementwise.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/tensorflow/contrib/lite/kernels/elementwise.cc b/tensorflow/contrib/lite/kernels/elementwise.cc
index 04995d70dd..8c624b3208 100644
--- a/tensorflow/contrib/lite/kernels/elementwise.cc
+++ b/tensorflow/contrib/lite/kernels/elementwise.cc
@@ -90,6 +90,10 @@ TfLiteStatus RsqrtEval(TfLiteContext* context, TfLiteNode* node) {
return EvalNumeric(context, node, [](float f) { return 1.f / std::sqrt(f); });
}
+TfLiteStatus SquareEval(TfLiteContext* context, TfLiteNode* node) {
+ return EvalNumeric(context, node, [](float f) { return f * f; });
+}
+
TfLiteStatus LogicalNotEval(TfLiteContext* context, TfLiteNode* node) {
return EvalLogical(context, node, [](bool v) { return !v; });
}
@@ -129,6 +133,14 @@ TfLiteRegistration* Register_RSQRT() {
return &r;
}
+TfLiteRegistration* Register_SQUARE() {
+ static TfLiteRegistration r = {
+ /*init=*/nullptr, /*free=*/nullptr,
+ elementwise::GenericPrepare<elementwise::IsNumericSupportedType>,
+ elementwise::SquareEval};
+ return &r;
+}
+
TfLiteRegistration* Register_LOGICAL_NOT() {
static TfLiteRegistration r = {
/*init=*/nullptr, /*free=*/nullptr,