| 27 | namespace { |
| 28 | |
| 29 | Status ValidateInput(const Tensor& parent, const Tensor& element, int64 index) { |
| 30 | DCHECK_NE(parent.dim_size(0), 0); |
| 31 | DCHECK_GE(index, 0); |
| 32 | if (element.NumElements() != (parent.NumElements() / parent.dim_size(0))) { |
| 33 | TensorShape chip_shape = parent.shape(); |
| 34 | chip_shape.RemoveDim(0); |
| 35 | return errors::Internal( |
| 36 | "ValidateInput Cannot perform copy: number of elements does not match. " |
| 37 | " Shapes are: [element]: ", |
| 38 | element.shape().DebugString(), |
| 39 | ", [parent slice]: ", chip_shape.DebugString()); |
| 40 | } |
| 41 | return Status::OK(); |
| 42 | } |
| 43 | |
| 44 | template <typename T> |
| 45 | Status HandleElementToSlice(T* src, T* dest, int64 num_values, |
no test coverage detected