Don't concatenate empty tensors
PiperOrigin-RevId: 310468853 Change-Id: I30c5006d172c49d1203e92eda7c040f80ca4a1ed
This commit is contained in:
parent
1a03912767
commit
cab22e9d46
@ -435,8 +435,10 @@ class TensorListConcat : public OpKernel {
|
||||
for (int i = 0; i < tensor_list->tensors().size(); i++) {
|
||||
const Tensor& element_tensor = tensor_list->tensors()[i];
|
||||
if (element_tensor.dtype() != DT_INVALID) {
|
||||
inputs_flat.emplace_back(new typename TTypes<T, 2>::ConstMatrix(
|
||||
element_tensor.shaped<T, 2>({1, element_tensor.NumElements()})));
|
||||
if (element_tensor.NumElements() > 0) {
|
||||
inputs_flat.emplace_back(new typename TTypes<T, 2>::ConstMatrix(
|
||||
element_tensor.shaped<T, 2>({1, element_tensor.NumElements()})));
|
||||
}
|
||||
} else {
|
||||
AllocatorAttributes attr;
|
||||
if (element_dtype_ == DT_VARIANT) {
|
||||
|
Loading…
Reference in New Issue
Block a user