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:
parent
b6f0ffaef6
commit
cfc70c48df
|
|
@ -154,6 +154,12 @@ bool TensorImpl::Init() {
|
||||||
attr.is_const = static_cast<bool>(spec_.attr_ & TensorAttribute::CONSTANT);
|
attr.is_const = static_cast<bool>(spec_.attr_ & TensorAttribute::CONSTANT);
|
||||||
attr.vtl = static_cast<bool>(spec_.attr_ & TensorAttribute::TRANSIENT);
|
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++) {
|
for (ShapeType::size_type i = 0; i < spec_.shape_.size(); i++) {
|
||||||
attr.size[i] = spec_.shape_[i];
|
attr.size[i] = spec_.shape_[i];
|
||||||
}
|
}
|
||||||
|
|
@ -195,4 +201,4 @@ bool TensorImpl::IsReadable() {
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace vx
|
} // namespace vx
|
||||||
} // namespace tim
|
} // namespace tim
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue