PR #46723: Adjust types of loop counters
Imported from GitHub PR https://github.com/tensorflow/tensorflow/pull/46723 Reduces some warnings about comparison of integers of different signs. Copybara import of the project: -- 311f436f77b334f5462127d8cf179cce067969ca by Marius Brehler <marius.brehler@iml.fraunhofer.de>: Adjust types of loop counters Reduces some warnings about comparison of integers of different signs. PiperOrigin-RevId: 360912203
This commit is contained in:
parent
57e9941d5d
commit
29f70cb892
|
@ -226,7 +226,7 @@ struct GatherSlice : public OpRewritePattern<GatherOp> {
|
||||||
|
|
||||||
llvm::SmallVector<int64_t, 8> slice_stride(slice_end.size(), 1);
|
llvm::SmallVector<int64_t, 8> slice_stride(slice_end.size(), 1);
|
||||||
llvm::SmallVector<int64_t, 8> slice_shape(slice_end.size());
|
llvm::SmallVector<int64_t, 8> slice_shape(slice_end.size());
|
||||||
for (int64_t i = 0; i < slice_end.size(); ++i) {
|
for (size_t i = 0; i < slice_end.size(); ++i) {
|
||||||
slice_shape[i] = slice_end[i] - slice_start[i];
|
slice_shape[i] = slice_end[i] - slice_start[i];
|
||||||
}
|
}
|
||||||
Type element_type = gather.getType().cast<TensorType>().getElementType();
|
Type element_type = gather.getType().cast<TensorType>().getElementType();
|
||||||
|
@ -242,7 +242,7 @@ struct GatherSlice : public OpRewritePattern<GatherOp> {
|
||||||
dnums.collapsed_slice_dims().getIntValues(),
|
dnums.collapsed_slice_dims().getIntValues(),
|
||||||
[](const llvm::APInt& i) { return i.getSExtValue(); }));
|
[](const llvm::APInt& i) { return i.getSExtValue(); }));
|
||||||
llvm::SmallVector<int64_t, 8> reshape_shape;
|
llvm::SmallVector<int64_t, 8> reshape_shape;
|
||||||
for (int64_t i = 0; i < slice_shape.size(); ++i) {
|
for (size_t i = 0; i < slice_shape.size(); ++i) {
|
||||||
if (llvm::count(collapsed_slice_dims, i) == 0) {
|
if (llvm::count(collapsed_slice_dims, i) == 0) {
|
||||||
reshape_shape.push_back(slice_shape[i]);
|
reshape_shape.push_back(slice_shape[i]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -437,7 +437,7 @@ class BroadcastConverter
|
||||||
unsigned num_prepended_dims = llvm::size(broadcast_op.broadcast_sizes());
|
unsigned num_prepended_dims = llvm::size(broadcast_op.broadcast_sizes());
|
||||||
SmallVector<AffineExpr, 4> input_dim_exprs;
|
SmallVector<AffineExpr, 4> input_dim_exprs;
|
||||||
input_dim_exprs.reserve(input_rank);
|
input_dim_exprs.reserve(input_rank);
|
||||||
for (int i = 0; i < input_rank; ++i) {
|
for (unsigned i = 0; i < input_rank; ++i) {
|
||||||
input_dim_exprs.push_back(b->getAffineDimExpr(num_prepended_dims + i));
|
input_dim_exprs.push_back(b->getAffineDimExpr(num_prepended_dims + i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue