Hi!
I want to use the tensor.extract_slice
operation to slice a tensor. According to the documentation here, although this operation supports dynamic and static offsets, sizes and strides, someone could create a tensor.extract_slice
operation with only static offsets, sizes and strides, just like the following example:
%1 = tensor.extract_slice %0[0, 0, 0][1, 16, 4][1, 1, 1] :
tensor<8x16x4xf32> to tensor<16x4xf32>
However, the python binding of this operation specify that offsets
, sizes
, strides
, static_offsets
, static_sizes
and static_strides
are all positional argument. It means that some one need to fill all these arguments even if there are only static offsets, sizes and strides. To make things clearer, here is part of the __init__
@_ods_cext.register_operation(_Dialect)
@_ods_extend_opview_class(_ods_ext_module)
class ExtractSliceOp(_ods_ir. OpView):
OPERATION_NAME = "tensor.extract_slice"
_ODS_OPERAND_SEGMENTS = [1,-1,-1,-1,]
_ODS_REGIONS = (0, True)
def __init__(self, result, source, offsets, sizes, strides, static_offsets, static_sizes, static_strides, *, loc=None, ip=None):
...
Could anyone provide me some guidance on how to use the python binding to create a tensor.extract_slice
operation with only static offsets, sizes and strides? Any insight would be greatly appreciated