动态图中索引的问题
Created by: LLChocolate
_, idx = fluid.layers.topk, idx是一个索引类型 idx_base = fluid.layers.range(0,batch_size,1,dtype='int64') idx_base = fluid.layers.reshape(idx_base,[-1,1,1]) * num_points idx = idx + idx_base idx = fluid.layers.reshape(idx,[-1],inplace=True) idx.stop_gradient = True
feature = feature[idx, :] 这个索引操作报错了
TypeError: slice(): incompatible function arguments. The following argument types are supported: 1. (ins: Dict[str, List[paddle::imperative::VarBase]], attrs: Dict[str, Variant]={}, outs: Dict[str, List[paddle::imperative::VarBase]]={}, out_nums: Dict[str, int]={}) -> Dict[str, List[paddle::imperative::VarBase]]
Invoked with: {'Input': [<paddle.fluid.core_avx.VarBase object at 0x7fbad2bd10b0>]}, {'axes': [0], 'starts': [<paddle.fluid.core_avx.VarBase object at 0x7fbad2bd10f0>], 'ends': [<paddle.fluid.core_avx.VarBase object at 0x7fbad2bd1230>], 'decrease_axis': [0]}
请问正确的索引应该怎么操作