From 1e65e183bb5433868a8d1326955d12b8f40591a5 Mon Sep 17 00:00:00 2001 From: Dun Liang Date: Fri, 30 Apr 2021 19:22:39 +0800 Subject: [PATCH] optimize getitem --- python/jittor/__init__.py | 2 +- src/ops/getitem_op.cc | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/python/jittor/__init__.py b/python/jittor/__init__.py index 4096a419..4c9f678d 100644 --- a/python/jittor/__init__.py +++ b/python/jittor/__init__.py @@ -8,7 +8,7 @@ # This file is subject to the terms and conditions defined in # file 'LICENSE.txt', which is part of this source code package. # *************************************************************** -__version__ = '1.2.2.63' +__version__ = '1.2.2.64' from . import lock with lock.lock_scope(): ori_int = int diff --git a/src/ops/getitem_op.cc b/src/ops/getitem_op.cc index 54116775..941c7f3e 100644 --- a/src/ops/getitem_op.cc +++ b/src/ops/getitem_op.cc @@ -462,6 +462,9 @@ void GetitemOp::jit_run() { auto in = inputs().front(); auto out = outputs().front(); if (out->num == 0) return; + if (in->allocator == out->allocator && + in->allocation == out->allocation) + return; @for(i, 0, ODIM, index_t oshape@i = o_shape[@i];) @if(ODIM>0,