MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / SourceIndexOfSlice

Method SourceIndexOfSlice

tensorflow/compiler/xla/service/llvm_ir/ir_array.cc:185–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183}
184
185IrArray::Index IrArray::Index::SourceIndexOfSlice(
186 const Shape& operand_shape, absl::Span<const int64> starts,
187 absl::Span<const int64> strides, llvm::IRBuilder<>* builder) const {
188 std::vector<llvm::Value*> source_multi_index(multidim_.size());
189 for (int i = 0; i < multidim_.size(); ++i) {
190 int64 stride = strides[i];
191 auto type = multidim_[i]->getType();
192
193 if (stride != 1) {
194 source_multi_index[i] = builder->CreateAdd(
195 builder->CreateMul(multidim_[i],
196 llvm::ConstantInt::get(type, stride)),
197 llvm::ConstantInt::get(type, starts[i]));
198 } else {
199 source_multi_index[i] = builder->CreateAdd(
200 multidim_[i], llvm::ConstantInt::get(type, starts[i]));
201 }
202 }
203 return Index(source_multi_index, operand_shape, index_type_);
204}
205
206IrArray::Index IrArray::Index::SourceIndexOfTranspose(
207 const Shape& shape, const Shape& operand_shape,

Callers 2

MakeElementGeneratorMethod · 0.80
HandleSliceMethod · 0.80

Calls 4

IndexClass · 0.70
getFunction · 0.50
sizeMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected