| 157 | // Encoder of simple type T to a string. We do a copy. |
| 158 | template <typename Destination> |
| 159 | static void Encode(TensorBuffer* in, int64 n, Destination* out) { |
| 160 | DCHECK_EQ(in->size(), sizeof(T) * n); |
| 161 | port::AssignRefCounted(StringPiece(in->base<const char>(), in->size()), in, |
| 162 | out); |
| 163 | } |
| 164 | |
| 165 | // Decoder of simple type T. Copy the bytes from "in" into the |
| 166 | // tensor buffer. |