tmp_shape.RemoveDim(0);
OP_REQUIRES(c, tmp.CopyFrom(tmp, tmp_shape),
errors::Unknown("Unexpected shape error."));
- if (tmp.IsAligned() || !DataTypeCanUseMemcpy(DataTypeToEnum<T>::value)) {
- output_list.tensors.push_back(tmp);
- } else {
- Tensor aligned;
- OP_REQUIRES_OK(c, c->allocate_temp(tmp.dtype(), tmp.shape(), &aligned));
- aligned.flat<T>().device(c->eigen_device<Device>()) =
- tmp.unaligned_flat<T>();
- output_list.tensors.push_back(aligned);
- }
+ // TODO(apassos) maybe not always align; but weird compiler bugs seem to
+ // prevent this.
+ Tensor aligned;
+ OP_REQUIRES_OK(c, c->allocate_temp(tmp.dtype(), tmp.shape(), &aligned));
+ aligned.flat<T>().device(c->eigen_device<Device>()) =
+ tmp.unaligned_flat<T>();
+ output_list.tensors.push_back(aligned);
}
output_tensor->scalar<Variant>()() = std::move(output_list);
}