vvchernov commented on code in PR #14065:
URL: https://github.com/apache/tvm/pull/14065#discussion_r1116533971


##########
python/tvm/topi/cuda/diagonal_scatter.py:
##########
@@ -0,0 +1,207 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# pylint: disable=invalid-name, unused-argument
+"""Diagonal scatter operator """
+import tvm
+from tvm import te, tir
+from ..utils import ceil_div, get_const_int
+
+
+def diagonal_scatter(data, src, offset=0, dim1=0, dim2=1):

Review Comment:
   Some note: initially I planned to implement pytorch diagonal_scatter on 
front-end side by scatter_elements or scatter_nd which I've refactored last 
weeks. But I refused this idea due to the following: 1. In both cases it 
requires to construct indices which is not easy task especially for lateral 
diagonal in asymmetric slice of multidimensional input 2. It does not work for 
dynamic shape at least it should be done on back-end side 3. It did not look 
like the solution with good performance for this op if utilize way with reusing 
scatter-like ops. Therefore I've decided to implement front-end and back-end



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to