Use auto shape for virtual tensors

Use auto shape for virtual tensors so that TIM-VX can
perform its internal shape inference and graph
optimizations.

Signed-off-by: Kainan Cha <kainan.cha@verisilicon.com>
This commit is contained in:
Kainan Cha 2021-03-18 14:24:10 +08:00
parent b6f0ffaef6
commit cfc70c48df
1 changed files with 7 additions and 1 deletions

View File

@ -154,6 +154,12 @@ bool TensorImpl::Init() {
attr.is_const = static_cast<bool>(spec_.attr_ & TensorAttribute::CONSTANT);
attr.vtl = static_cast<bool>(spec_.attr_ & TensorAttribute::TRANSIENT);
// Use auto shape for virtual tensors so that tim-vx can perform it's own
// shape inference
if (attr.vtl) {
attr.dim_num = VSI_NN_DIM_AUTO;
}
for (ShapeType::size_type i = 0; i < spec_.shape_.size(); i++) {
attr.size[i] = spec_.shape_[i];
}
@ -195,4 +201,4 @@ bool TensorImpl::IsReadable() {
}
} // namespace vx
} // namespace tim
} // namespace tim