You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/04/02 04:31:30 UTC

[GitHub] [incubator-tvm] Huyuwei commented on a change in pull request #5125: [KERAS]Upsample3d & ZeroPadding3d op

Huyuwei commented on a change in pull request #5125: [KERAS]Upsample3d & ZeroPadding3d op
URL: https://github.com/apache/incubator-tvm/pull/5125#discussion_r402045236
 
 

 ##########
 File path: python/tvm/relay/frontend/keras.py
 ##########
 @@ -663,6 +667,36 @@ def _convert_padding(inexpr, keras_layer, etab):
         return _op.nn.pad(data=inexpr, pad_width=((0, 0), (0, 0), (top, bottom), (left, right)))
     return _op.nn.pad(data=inexpr, pad_width=((0, 0), (top, bottom), (left, right), (0, 0)))
 
+def _convert_padding3d(inexpr, keras_layer, etab):
+    _check_data_format(keras_layer)
+    padding = keras_layer.padding
+
+    d_pad = h_pad = w_pad = {0, 0}
+    if isinstance(padding, tuple):
+        if isinstance(padding[0], tuple):
+            d_pad = padding[0]
+            h_pad = padding[1]
+            w_pad = padding[2]
+        else:
+            msg = 'Value {} in attribute "padding" of operator ZeroPadding3D ' \
+                  'is not valid.'
+            raise tvm.error.OpAttributeInvalid(msg.format(str(padding)))
+    else:
+        msg = 'Value {} in attribute "padding" of operator ZeroPadding3D is ' \
+              'not valid.'
+        raise tvm.error.OpAttributeInvalid(msg.format(str(padding)))
+
+    if etab.data_layout == 'NCDHW':
+        out = _op.nn.pad(data=inexpr, pad_width=((0, 0), (0, 0),
 
 Review comment:
   should out be returned?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services