!17745 Dataset kernel support scalar

From: @wilfchen
Reviewed-by: @cristoval,@limingqi107
Signed-off-by: @limingqi107
This commit is contained in:
mindspore-ci-bot 2021-06-05 09:25:05 +08:00 committed by Gitee
commit e6c16a185d
1 changed files with 4 additions and 0 deletions

View File

@ -77,6 +77,10 @@ void GetShapeAndType(const CNodePtr &kernel_node, std::vector<std::vector<int>>
std::vector<int> shape;
(void)std::transform(values.begin(), values.end(), std::back_inserter(shape),
[](const int64_t &value) { return static_cast<int>(value); });
// Empty means scalar. Push one elements for bytes calculation.
if (shape.empty()) {
shape.push_back(1);
}
return shape;
});