tvm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-tvm] wyc-ruiker commented on a change in pull request #5174: [Torch] Add support for split
Date Tue, 31 Mar 2020 01:24:20 GMT
wyc-ruiker commented on a change in pull request #5174: [Torch] Add support for split
URL: https://github.com/apache/incubator-tvm/pull/5174#discussion_r400588523
 
 

 ##########
 File path: python/tvm/relay/frontend/pytorch.py
 ##########
 @@ -105,6 +105,36 @@ def _impl(inputs, input_types):
         return _op.transform.strided_slice(data, begin, end, strides)
     return _impl
 
+def _split():
+    def _impl(inputs, input_types):
+        data = inputs[0]
+        split_size = int(inputs[1])
+        dim = int(inputs[2])
+
+        now_indice = split_size
+        indices = []
+        while now_indice < _infer_shape(data)[dim]:
+            indices.append(now_indice)
+            now_indice += split_size
+
+        return _op.split(data, indices, dim)
 
 Review comment:
   The split op in Relay and PyTorch have different behaviors.  In Relay, if indices_or_sections
is an integer, the input will be divided equally along the given axis.  But in Pytorch, if
split_size_or_sections is an integer type, then tensor will be split into equally sized chunks
(if possible). The last chunk will be smaller if the tensor size along the given dimension
dim is not divisible by split_size.

----------------------------------------------------------------
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

Mime
View raw message