aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/util/padding.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/core/util/padding.cc')
-rw-r--r--tensorflow/core/util/padding.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/tensorflow/core/util/padding.cc b/tensorflow/core/util/padding.cc
new file mode 100644
index 0000000000..24273e5ca4
--- /dev/null
+++ b/tensorflow/core/util/padding.cc
@@ -0,0 +1,24 @@
+#include "tensorflow/core/util/padding.h"
+
+#include "tensorflow/core/framework/node_def_util.h"
+#include "tensorflow/core/lib/core/errors.h"
+
+namespace tensorflow {
+
+Status GetNodeAttr(const NodeDef& node_def, const string& attr_name,
+ Padding* value) {
+ string str_value;
+ TF_RETURN_IF_ERROR(GetNodeAttr(node_def, attr_name, &str_value));
+ if (str_value == "SAME") {
+ *value = SAME;
+ } else if (str_value == "VALID") {
+ *value = VALID;
+ } else {
+ return errors::NotFound(str_value, " is not an allowed padding type");
+ }
+ return Status::OK();
+}
+
+string GetPaddingAttrString() { return "padding: {'SAME', 'VALID'}"; }
+
+} // end namespace tensorflow