diff options
| author | Geoffrey Martin-Noble <gcmn@google.com> | 2019-05-16 00:12:45 -0700 |
|---|---|---|
| committer | Mehdi Amini <joker.eph@gmail.com> | 2019-05-20 13:43:58 -0700 |
| commit | 090662c5f3572c573cf249844748ecbf11d10dbe (patch) | |
| tree | c3b040c726fb56de37f6fa80fcd40ff0ef16f2e3 /mlir/lib/Quantizer | |
| parent | b3888fa9cc46dc3607af2dc5cf840ef33d0fcd8d (diff) | |
| download | bcm5719-llvm-090662c5f3572c573cf249844748ecbf11d10dbe.tar.gz bcm5719-llvm-090662c5f3572c573cf249844748ecbf11d10dbe.zip | |
Rename VectorOrTensorType to ShapedType
This is in preparation for making it also support/be a parent class of MemRefType. MemRefs have similar shape/rank/element semantics and it would be useful to be able to use these same utilities for them.
This CL should not change any semantics and only change variables, types, string literals, and comments. In follow-up CLs I will prepare all callers to handle MemRef types or remove their dependence on ShapedType.
Discussion/Rationale in https://groups.google.com/a/tensorflow.org/forum/#!topic/mlir/cHLoyfGu8y8
--
PiperOrigin-RevId: 248476449
Diffstat (limited to 'mlir/lib/Quantizer')
| -rw-r--r-- | mlir/lib/Quantizer/Support/Statistics.cpp | 12 | ||||
| -rw-r--r-- | mlir/lib/Quantizer/Support/TypeUtils.cpp | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/mlir/lib/Quantizer/Support/Statistics.cpp b/mlir/lib/Quantizer/Support/Statistics.cpp index ce3913ae34f..3ec07e40f2b 100644 --- a/mlir/lib/Quantizer/Support/Statistics.cpp +++ b/mlir/lib/Quantizer/Support/Statistics.cpp @@ -66,18 +66,18 @@ static bool getElementsStatistics(ElementsAttr attr, statistics.minValue = std::numeric_limits<double>::infinity(); statistics.maxValue = -std::numeric_limits<double>::infinity(); - VectorOrTensorType vtType = attr.getType(); - if (!vtType.hasStaticShape()) + ShapedType sType = attr.getType(); + if (!sType.hasStaticShape()) return false; - Type elementTy = vtType.getElementType(); + Type elementTy = sType.getElementType(); if (!elementTy.isa<FloatType>()) return false; llvm::SmallVector<uint64_t, 4> indices; - indices.resize(vtType.getRank()); - ArrayRef<int64_t> shape = vtType.getShape(); + indices.resize(sType.getRank()); + ArrayRef<int64_t> shape = sType.getShape(); - auto numElements = vtType.getNumElements(); + auto numElements = sType.getNumElements(); collectElementsStatisticsDim(attr, numElements, shape, indices, 0, statistics); statistics.sampleSize = numElements; diff --git a/mlir/lib/Quantizer/Support/TypeUtils.cpp b/mlir/lib/Quantizer/Support/TypeUtils.cpp index 444322e31e3..fab4e565308 100644 --- a/mlir/lib/Quantizer/Support/TypeUtils.cpp +++ b/mlir/lib/Quantizer/Support/TypeUtils.cpp @@ -23,8 +23,8 @@ using namespace mlir; using namespace mlir::quantizer; Type mlir::quantizer::getElementOrPrimitiveType(Type t) { - if (auto vtType = t.dyn_cast<VectorOrTensorType>()) { - return vtType.getElementType(); + if (auto sType = t.dyn_cast<ShapedType>()) { + return sType.getElementType(); } else { return t; } |

