能否支持LoD Tensor的遍历呢
Created by: yangjingyuan
import numpy as np import paddle.fluid as fluid
x = fluid.layers.data("x", shape=[2, 3, 3], dtype='float32') output = fluid.layers.im2sequence( input=x, stride=[1, 1], filter_size=[1, 1])
counter = fluid.layers.zeros(shape=[1], dtype='int64', force_cpu=True) array_len = fluid.layers.fill_constant( shape=[1], dtype='int64', value = 4096)
cond = fluid.layers.less_than(x=counter, y=array_len) while_op = fluid.layers.While(cond=cond) with while_op.block(): temp = fluid.layers.array_read(array = output, i = counter) fluid.layers.Print(temp)
很多时候会需要遍历im2sequence后的值,并做些运算操作,希望能提供下支持