private static HandleData get_eager_safe_handle_data(Tensor handle) { if (handle == IntPtr.Zero) { var data = new HandleData(); data.ShapeAndType.Add(new HandleShapeAndType { Shape = handle.TensorShape.as_proto(), Dtype = handle.dtype.as_datatype_enum() }); return(data); } else { return(HandleData.Parser.ParseFrom(handle.BufferToArray())); } }