未验证 提交 c374894d 编写于 作者: M Mountagha 提交者: GitHub

optimizing a bit tensor_array initialization (#48066)

上级 071708fa
...@@ -23,13 +23,12 @@ TensorArray::TensorArray(const std::vector<DenseTensor>& vec) { ...@@ -23,13 +23,12 @@ TensorArray::TensorArray(const std::vector<DenseTensor>& vec) {
/// \brief Test whether the tensor's storage in TensorArray is allocated. /// \brief Test whether the tensor's storage in TensorArray is allocated.
/// return Whether all tensors in TensorArray is allocated. /// return Whether all tensors in TensorArray is allocated.
bool TensorArray::initialized() const { bool TensorArray::initialized() const {
bool init = true;
for (auto tensor : tensors_) { for (auto tensor : tensors_) {
if (!tensor.IsInitialized()) { if (!tensor.IsInitialized()) {
init = false; return false;
} }
} }
return init; return true;
} }
int64_t TensorArray::numel() const { int64_t TensorArray::numel() const {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册