| 1002 | } |
| 1003 | |
| 1004 | void Tensor::AsProtoField(TensorProto* proto) const { |
| 1005 | proto->Clear(); |
| 1006 | shape_.AsProto(proto->mutable_tensor_shape()); |
| 1007 | proto->set_dtype(dtype()); |
| 1008 | if (buf_) { |
| 1009 | CASES(dtype(), ToProtoField<T>(*buf_, shape_.num_elements(), proto)); |
| 1010 | } |
| 1011 | } |
| 1012 | |
| 1013 | void Tensor::AsProtoTensorContent(TensorProto* proto) const { |
| 1014 | proto->Clear(); |