24#ifndef TVM_TOPI_DETAIL_STRIDED_SLICE_H_
25#define TVM_TOPI_DETAIL_STRIDED_SLICE_H_
52inline std::tuple<std::vector<int64_t>, std::vector<int64_t>, std::vector<int64_t>> ConvertToVec(
53 const ffi::Array<ffi::Optional<IntImm>>&
begin,
const ffi::Array<ffi::Optional<IntImm>>&
end,
54 const ffi::Array<IntImm>& strides, std::string
slice_mode) {
55 std::vector<int64_t>
stride_vec(strides.size(), 1);
57 for (
size_t i = 0;
i < strides.size(); ++
i) {
63 for (
size_t i = 0;
i <
begin.size(); ++
i) {
72 for (
size_t i = 0;
i <
end.size(); ++
i) {
90inline ffi::Array<PrimExpr> StridedSliceCanonicalizeBegin(
const ffi::Array<PrimExpr>&
ishape,
91 const std::vector<int64_t>&
begin,
92 const std::vector<int64_t>& strides,
93 const ffi::Array<int64_t>& axes,
97 for (
size_t i = 0;
i < axes.size(); ++
i) {
119inline ffi::Array<PrimExpr> StridedSliceOutputShape(
120 const ffi::Array<PrimExpr>&
ishape,
const std::vector<int64_t>&
begin,
121 const std::vector<int64_t>&
end,
const std::vector<int64_t>& strides,
122 const ffi::Array<int64_t>& axes, std::string
slice_mode,
131 for (
size_t i = 0;
i < axes.size(); ++
i) {
140 static_cast<int>((
interval + std::abs(strides[
i]) - 1) / std::abs(strides[
i]));
142 <<
": Input [Begin=" <<
begin[
i] <<
", End=" <<
end[
i] <<
"] is invalid for axis=" <<
i;
Typed reference/view over any Expr whose ExprNode::ty is PrimType.
Definition base_expr.h:401
Definition base_expr.h:137
RAII wrapper function to enter and exit a context object similar to python's with syntax.
Definition with_context.h:59
Checked scalar view over a VarNode.
Definition var.h:46
Utility functions for handling constants in TVM expressions.
Tensor expression language DSL.
Definition extracted_task.h:33
const Op & cast()
See pesudo code below:
PrimExpr MakeConst(PrimType dtype, ValueType value, Span span=Span())
Make a const value with certain data type.
Definition op.h:1002
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition analyzer.h:40
PrimExpr if_then_else(PrimExpr cond, PrimExpr true_value, PrimExpr false_value, Span span=Span())
Conditional expression.
PrimExpr min(PrimExpr a, PrimExpr b, Span span=Span())
take minimum of two values