提交 9e74ecd8 authored 作者: Razvan Pascanu's avatar Razvan Pascanu

make permutaiton op aware of the mintap

The mintap is an offset that should always be taken into consideration
上级 4c6c08e8
...@@ -343,8 +343,9 @@ def allocate_memory(T, y_info, y): ...@@ -343,8 +343,9 @@ def allocate_memory(T, y_info, y):
class ScanPermutation(gof.Op): class ScanPermutation(gof.Op):
def __init__(self, inplace=False): def __init__(self, mintap=0, inplace=False):
self.inplace = inplace self.inplace = inplace
self.mintap = mintap
if inplace: if inplace:
self.destroy_map = {0: [0]} self.destroy_map = {0: [0]}
...@@ -369,8 +370,9 @@ class ScanPermutation(gof.Op): ...@@ -369,8 +370,9 @@ class ScanPermutation(gof.Op):
def perform(self, node, inputs, outputs): def perform(self, node, inputs, outputs):
membuffer = inputs[0] membuffer = inputs[0]
index = inputs[0] index = inputs[1] + self.mintap
if index <= membuffer.shape[0] or index % membuffer.shape[0] == 0: out = outputs[0]
if index % membuffer.shape[0] == 0:
if self.inplace: if self.inplace:
outputs[0] = membuffer outputs[0] = membuffer
else: else:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论