ZTWHHH commited on
Commit
1c6ab0e
·
verified ·
1 Parent(s): f6be1ed

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. videochat2/lib/python3.10/site-packages/tensorflow/include/external/png/LICENSE +134 -0
  2. videochat2/lib/python3.10/site-packages/tensorflow/include/external/png/pngdebug.h +153 -0
  3. videochat2/lib/python3.10/site-packages/tensorflow/include/external/png/pnginfo.h +267 -0
  4. videochat2/lib/python3.10/site-packages/tensorflow/include/external/png/pngpriv.h +2143 -0
  5. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/c/tsl_status.h +92 -0
  6. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/c/tsl_status_helper.h +32 -0
  7. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/c/tsl_status_internal.h +28 -0
  8. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/concurrency/async_value.h +998 -0
  9. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/concurrency/chain.h +25 -0
  10. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/concurrency/concurrent_vector.h +177 -0
  11. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/concurrency/ref_count.h +260 -0
  12. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/cuda/cublas.inc +736 -0
  13. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/cuda/cublasLt.inc +291 -0
  14. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/cuda/cufft.inc +55 -0
  15. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/cuda/cupti.inc +148 -0
  16. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/cuda/cusolver.inc +926 -0
  17. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/cuda/cusparse.inc +421 -0
  18. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/core/bitmap.h +107 -0
  19. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/core/bits.h +120 -0
  20. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/core/status_test_util.h +33 -0
  21. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/gtl/flatmap.h +396 -0
  22. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/gtl/flatrep.h +352 -0
  23. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/gtl/flatset.h +296 -0
  24. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/gtl/inlined_vector.h +33 -0
  25. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/gtl/int_type.h +364 -0
  26. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/gtl/iterator_range.h +68 -0
  27. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/gtl/map_util.h +215 -0
  28. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/gtl/subtle/map_traits.h +65 -0
  29. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/hash/crc32c.h +69 -0
  30. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/histogram/histogram.h +143 -0
  31. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/block.h +57 -0
  32. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/block_builder.h +70 -0
  33. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/buffered_file.h +115 -0
  34. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/buffered_inputstream.h +127 -0
  35. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/cache.h +127 -0
  36. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/compression.h +32 -0
  37. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/format.h +113 -0
  38. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/inputbuffer.h +151 -0
  39. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/inputstream_interface.h +70 -0
  40. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/iterator.h +104 -0
  41. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/proto_encode_helper.h +99 -0
  42. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/random_inputstream.h +62 -0
  43. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/record_reader.h +180 -0
  44. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/record_writer.h +156 -0
  45. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/snappy/snappy_compression_options.h +36 -0
  46. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/snappy/snappy_inputbuffer.h +134 -0
  47. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/snappy/snappy_inputstream.h +92 -0
  48. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/snappy/snappy_outputbuffer.h +158 -0
  49. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/table.h +86 -0
  50. videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/table_builder.h +101 -0
videochat2/lib/python3.10/site-packages/tensorflow/include/external/png/LICENSE ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
2
+ =========================================
3
+
4
+ PNG Reference Library License version 2
5
+ ---------------------------------------
6
+
7
+ * Copyright (c) 1995-2022 The PNG Reference Library Authors.
8
+ * Copyright (c) 2018-2022 Cosmin Truta.
9
+ * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
10
+ * Copyright (c) 1996-1997 Andreas Dilger.
11
+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
12
+
13
+ The software is supplied "as is", without warranty of any kind,
14
+ express or implied, including, without limitation, the warranties
15
+ of merchantability, fitness for a particular purpose, title, and
16
+ non-infringement. In no event shall the Copyright owners, or
17
+ anyone distributing the software, be liable for any damages or
18
+ other liability, whether in contract, tort or otherwise, arising
19
+ from, out of, or in connection with the software, or the use or
20
+ other dealings in the software, even if advised of the possibility
21
+ of such damage.
22
+
23
+ Permission is hereby granted to use, copy, modify, and distribute
24
+ this software, or portions hereof, for any purpose, without fee,
25
+ subject to the following restrictions:
26
+
27
+ 1. The origin of this software must not be misrepresented; you
28
+ must not claim that you wrote the original software. If you
29
+ use this software in a product, an acknowledgment in the product
30
+ documentation would be appreciated, but is not required.
31
+
32
+ 2. Altered source versions must be plainly marked as such, and must
33
+ not be misrepresented as being the original software.
34
+
35
+ 3. This Copyright notice may not be removed or altered from any
36
+ source or altered source distribution.
37
+
38
+
39
+ PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35)
40
+ -----------------------------------------------------------------------
41
+
42
+ libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are
43
+ Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
44
+ derived from libpng-1.0.6, and are distributed according to the same
45
+ disclaimer and license as libpng-1.0.6 with the following individuals
46
+ added to the list of Contributing Authors:
47
+
48
+ Simon-Pierre Cadieux
49
+ Eric S. Raymond
50
+ Mans Rullgard
51
+ Cosmin Truta
52
+ Gilles Vollant
53
+ James Yu
54
+ Mandar Sahastrabuddhe
55
+ Google Inc.
56
+ Vadim Barkov
57
+
58
+ and with the following additions to the disclaimer:
59
+
60
+ There is no warranty against interference with your enjoyment of
61
+ the library or against infringement. There is no warranty that our
62
+ efforts or the library will fulfill any of your particular purposes
63
+ or needs. This library is provided with all faults, and the entire
64
+ risk of satisfactory quality, performance, accuracy, and effort is
65
+ with the user.
66
+
67
+ Some files in the "contrib" directory and some configure-generated
68
+ files that are distributed with libpng have other copyright owners, and
69
+ are released under other open source licenses.
70
+
71
+ libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
72
+ Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
73
+ libpng-0.96, and are distributed according to the same disclaimer and
74
+ license as libpng-0.96, with the following individuals added to the
75
+ list of Contributing Authors:
76
+
77
+ Tom Lane
78
+ Glenn Randers-Pehrson
79
+ Willem van Schaik
80
+
81
+ libpng versions 0.89, June 1996, through 0.96, May 1997, are
82
+ Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
83
+ and are distributed according to the same disclaimer and license as
84
+ libpng-0.88, with the following individuals added to the list of
85
+ Contributing Authors:
86
+
87
+ John Bowler
88
+ Kevin Bracey
89
+ Sam Bushell
90
+ Magnus Holmgren
91
+ Greg Roelofs
92
+ Tom Tanner
93
+
94
+ Some files in the "scripts" directory have other copyright owners,
95
+ but are released under this license.
96
+
97
+ libpng versions 0.5, May 1995, through 0.88, January 1996, are
98
+ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
99
+
100
+ For the purposes of this copyright and license, "Contributing Authors"
101
+ is defined as the following set of individuals:
102
+
103
+ Andreas Dilger
104
+ Dave Martindale
105
+ Guy Eric Schalnat
106
+ Paul Schmidt
107
+ Tim Wegner
108
+
109
+ The PNG Reference Library is supplied "AS IS". The Contributing
110
+ Authors and Group 42, Inc. disclaim all warranties, expressed or
111
+ implied, including, without limitation, the warranties of
112
+ merchantability and of fitness for any purpose. The Contributing
113
+ Authors and Group 42, Inc. assume no liability for direct, indirect,
114
+ incidental, special, exemplary, or consequential damages, which may
115
+ result from the use of the PNG Reference Library, even if advised of
116
+ the possibility of such damage.
117
+
118
+ Permission is hereby granted to use, copy, modify, and distribute this
119
+ source code, or portions hereof, for any purpose, without fee, subject
120
+ to the following restrictions:
121
+
122
+ 1. The origin of this source code must not be misrepresented.
123
+
124
+ 2. Altered versions must be plainly marked as such and must not
125
+ be misrepresented as being the original source.
126
+
127
+ 3. This Copyright notice may not be removed or altered from any
128
+ source or altered source distribution.
129
+
130
+ The Contributing Authors and Group 42, Inc. specifically permit,
131
+ without fee, and encourage the use of this source code as a component
132
+ to supporting the PNG file format in commercial products. If you use
133
+ this source code in a product, acknowledgment is not required but would
134
+ be appreciated.
videochat2/lib/python3.10/site-packages/tensorflow/include/external/png/pngdebug.h ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c
3
+ *
4
+ * Copyright (c) 2018 Cosmin Truta
5
+ * Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson
6
+ * Copyright (c) 1996-1997 Andreas Dilger
7
+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
8
+ *
9
+ * This code is released under the libpng license.
10
+ * For conditions of distribution and use, see the disclaimer
11
+ * and license in png.h
12
+ */
13
+
14
+ /* Define PNG_DEBUG at compile time for debugging information. Higher
15
+ * numbers for PNG_DEBUG mean more debugging information. This has
16
+ * only been added since version 0.95 so it is not implemented throughout
17
+ * libpng yet, but more support will be added as needed.
18
+ *
19
+ * png_debug[1-2]?(level, message ,arg{0-2})
20
+ * Expands to a statement (either a simple expression or a compound
21
+ * do..while(0) statement) that outputs a message with parameter
22
+ * substitution if PNG_DEBUG is defined to 2 or more. If PNG_DEBUG
23
+ * is undefined, 0 or 1 every png_debug expands to a simple expression
24
+ * (actually ((void)0)).
25
+ *
26
+ * level: level of detail of message, starting at 0. A level 'n'
27
+ * message is preceded by 'n' 3-space indentations (not implemented
28
+ * on Microsoft compilers unless PNG_DEBUG_FILE is also
29
+ * defined, to allow debug DLL compilation with no standard IO).
30
+ * message: a printf(3) style text string. A trailing '\n' is added
31
+ * to the message.
32
+ * arg: 0 to 2 arguments for printf(3) style substitution in message.
33
+ */
34
+ #ifndef PNGDEBUG_H
35
+ #define PNGDEBUG_H
36
+ /* These settings control the formatting of messages in png.c and pngerror.c */
37
+ /* Moved to pngdebug.h at 1.5.0 */
38
+ # ifndef PNG_LITERAL_SHARP
39
+ # define PNG_LITERAL_SHARP 0x23
40
+ # endif
41
+ # ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET
42
+ # define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b
43
+ # endif
44
+ # ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET
45
+ # define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d
46
+ # endif
47
+ # ifndef PNG_STRING_NEWLINE
48
+ # define PNG_STRING_NEWLINE "\n"
49
+ # endif
50
+
51
+ #ifdef PNG_DEBUG
52
+ # if (PNG_DEBUG > 0)
53
+ # if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
54
+ # include <crtdbg.h>
55
+ # if (PNG_DEBUG > 1)
56
+ # ifndef _DEBUG
57
+ # define _DEBUG
58
+ # endif
59
+ # ifndef png_debug
60
+ # define png_debug(l,m) _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE)
61
+ # endif
62
+ # ifndef png_debug1
63
+ # define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1)
64
+ # endif
65
+ # ifndef png_debug2
66
+ # define png_debug2(l,m,p1,p2) \
67
+ _RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2)
68
+ # endif
69
+ # endif
70
+ # else /* PNG_DEBUG_FILE || !_MSC_VER */
71
+ # ifndef PNG_STDIO_SUPPORTED
72
+ # include <stdio.h> /* not included yet */
73
+ # endif
74
+ # ifndef PNG_DEBUG_FILE
75
+ # define PNG_DEBUG_FILE stderr
76
+ # endif /* PNG_DEBUG_FILE */
77
+
78
+ # if (PNG_DEBUG > 1)
79
+ # ifdef __STDC__
80
+ # ifndef png_debug
81
+ # define png_debug(l,m) \
82
+ do { \
83
+ int num_tabs=l; \
84
+ fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
85
+ (num_tabs==2 ? " " : (num_tabs>2 ? " " : "")))); \
86
+ } while (0)
87
+ # endif
88
+ # ifndef png_debug1
89
+ # define png_debug1(l,m,p1) \
90
+ do { \
91
+ int num_tabs=l; \
92
+ fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
93
+ (num_tabs==2 ? " " : (num_tabs>2 ? " " : ""))),p1); \
94
+ } while (0)
95
+ # endif
96
+ # ifndef png_debug2
97
+ # define png_debug2(l,m,p1,p2) \
98
+ do { \
99
+ int num_tabs=l; \
100
+ fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
101
+ (num_tabs==2 ? " " : (num_tabs>2 ? " " : ""))),p1,p2);\
102
+ } while (0)
103
+ # endif
104
+ # else /* __STDC __ */
105
+ # ifndef png_debug
106
+ # define png_debug(l,m) \
107
+ do { \
108
+ int num_tabs=l; \
109
+ char format[256]; \
110
+ snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
111
+ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
112
+ m,PNG_STRING_NEWLINE); \
113
+ fprintf(PNG_DEBUG_FILE,format); \
114
+ } while (0)
115
+ # endif
116
+ # ifndef png_debug1
117
+ # define png_debug1(l,m,p1) \
118
+ do { \
119
+ int num_tabs=l; \
120
+ char format[256]; \
121
+ snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
122
+ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
123
+ m,PNG_STRING_NEWLINE); \
124
+ fprintf(PNG_DEBUG_FILE,format,p1); \
125
+ } while (0)
126
+ # endif
127
+ # ifndef png_debug2
128
+ # define png_debug2(l,m,p1,p2) \
129
+ do { \
130
+ int num_tabs=l; \
131
+ char format[256]; \
132
+ snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
133
+ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
134
+ m,PNG_STRING_NEWLINE); \
135
+ fprintf(PNG_DEBUG_FILE,format,p1,p2); \
136
+ } while (0)
137
+ # endif
138
+ # endif /* __STDC __ */
139
+ # endif /* (PNG_DEBUG > 1) */
140
+
141
+ # endif /* _MSC_VER */
142
+ # endif /* (PNG_DEBUG > 0) */
143
+ #endif /* PNG_DEBUG */
144
+ #ifndef png_debug
145
+ # define png_debug(l, m) ((void)0)
146
+ #endif
147
+ #ifndef png_debug1
148
+ # define png_debug1(l, m, p1) ((void)0)
149
+ #endif
150
+ #ifndef png_debug2
151
+ # define png_debug2(l, m, p1, p2) ((void)0)
152
+ #endif
153
+ #endif /* PNGDEBUG_H */
videochat2/lib/python3.10/site-packages/tensorflow/include/external/png/pnginfo.h ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ /* pnginfo.h - header file for PNG reference library
3
+ *
4
+ * Copyright (c) 2018 Cosmin Truta
5
+ * Copyright (c) 1998-2002,2004,2006-2013,2018 Glenn Randers-Pehrson
6
+ * Copyright (c) 1996-1997 Andreas Dilger
7
+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
8
+ *
9
+ * This code is released under the libpng license.
10
+ * For conditions of distribution and use, see the disclaimer
11
+ * and license in png.h
12
+ */
13
+
14
+ /* png_info is a structure that holds the information in a PNG file so
15
+ * that the application can find out the characteristics of the image.
16
+ * If you are reading the file, this structure will tell you what is
17
+ * in the PNG file. If you are writing the file, fill in the information
18
+ * you want to put into the PNG file, using png_set_*() functions, then
19
+ * call png_write_info().
20
+ *
21
+ * The names chosen should be very close to the PNG specification, so
22
+ * consult that document for information about the meaning of each field.
23
+ *
24
+ * With libpng < 0.95, it was only possible to directly set and read the
25
+ * the values in the png_info_struct, which meant that the contents and
26
+ * order of the values had to remain fixed. With libpng 0.95 and later,
27
+ * however, there are now functions that abstract the contents of
28
+ * png_info_struct from the application, so this makes it easier to use
29
+ * libpng with dynamic libraries, and even makes it possible to use
30
+ * libraries that don't have all of the libpng ancillary chunk-handing
31
+ * functionality. In libpng-1.5.0 this was moved into a separate private
32
+ * file that is not visible to applications.
33
+ *
34
+ * The following members may have allocated storage attached that should be
35
+ * cleaned up before the structure is discarded: palette, trans, text,
36
+ * pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,
37
+ * splt_palettes, scal_unit, row_pointers, and unknowns. By default, these
38
+ * are automatically freed when the info structure is deallocated, if they were
39
+ * allocated internally by libpng. This behavior can be changed by means
40
+ * of the png_data_freer() function.
41
+ *
42
+ * More allocation details: all the chunk-reading functions that
43
+ * change these members go through the corresponding png_set_*
44
+ * functions. A function to clear these members is available: see
45
+ * png_free_data(). The png_set_* functions do not depend on being
46
+ * able to point info structure members to any of the storage they are
47
+ * passed (they make their own copies), EXCEPT that the png_set_text
48
+ * functions use the same storage passed to them in the text_ptr or
49
+ * itxt_ptr structure argument, and the png_set_rows and png_set_unknowns
50
+ * functions do not make their own copies.
51
+ */
52
+ #ifndef PNGINFO_H
53
+ #define PNGINFO_H
54
+
55
+ struct png_info_def
56
+ {
57
+ /* The following are necessary for every PNG file */
58
+ png_uint_32 width; /* width of image in pixels (from IHDR) */
59
+ png_uint_32 height; /* height of image in pixels (from IHDR) */
60
+ png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */
61
+ size_t rowbytes; /* bytes needed to hold an untransformed row */
62
+ png_colorp palette; /* array of color values (valid & PNG_INFO_PLTE) */
63
+ png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */
64
+ png_uint_16 num_trans; /* number of transparent palette color (tRNS) */
65
+ png_byte bit_depth; /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
66
+ png_byte color_type; /* see PNG_COLOR_TYPE_ below (from IHDR) */
67
+ /* The following three should have been named *_method not *_type */
68
+ png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
69
+ png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
70
+ png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
71
+
72
+ /* The following are set by png_set_IHDR, called from the application on
73
+ * write, but the are never actually used by the write code.
74
+ */
75
+ png_byte channels; /* number of data channels per pixel (1, 2, 3, 4) */
76
+ png_byte pixel_depth; /* number of bits per pixel */
77
+ png_byte spare_byte; /* to align the data, and for future use */
78
+
79
+ #ifdef PNG_READ_SUPPORTED
80
+ /* This is never set during write */
81
+ png_byte signature[8]; /* magic bytes read by libpng from start of file */
82
+ #endif
83
+
84
+ /* The rest of the data is optional. If you are reading, check the
85
+ * valid field to see if the information in these are valid. If you
86
+ * are writing, set the valid field to those chunks you want written,
87
+ * and initialize the appropriate fields below.
88
+ */
89
+
90
+ #if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
91
+ /* png_colorspace only contains 'flags' if neither GAMMA or COLORSPACE are
92
+ * defined. When COLORSPACE is switched on all the colorspace-defining
93
+ * chunks should be enabled, when GAMMA is switched on all the gamma-defining
94
+ * chunks should be enabled. If this is not done it becomes possible to read
95
+ * inconsistent PNG files and assign a probably incorrect interpretation to
96
+ * the information. (In other words, by carefully choosing which chunks to
97
+ * recognize the system configuration can select an interpretation for PNG
98
+ * files containing ambiguous data and this will result in inconsistent
99
+ * behavior between different libpng builds!)
100
+ */
101
+ png_colorspace colorspace;
102
+ #endif
103
+
104
+ #ifdef PNG_iCCP_SUPPORTED
105
+ /* iCCP chunk data. */
106
+ png_charp iccp_name; /* profile name */
107
+ png_bytep iccp_profile; /* International Color Consortium profile data */
108
+ png_uint_32 iccp_proflen; /* ICC profile data length */
109
+ #endif
110
+
111
+ #ifdef PNG_TEXT_SUPPORTED
112
+ /* The tEXt, and zTXt chunks contain human-readable textual data in
113
+ * uncompressed, compressed, and optionally compressed forms, respectively.
114
+ * The data in "text" is an array of pointers to uncompressed,
115
+ * null-terminated C strings. Each chunk has a keyword that describes the
116
+ * textual data contained in that chunk. Keywords are not required to be
117
+ * unique, and the text string may be empty. Any number of text chunks may
118
+ * be in an image.
119
+ */
120
+ int num_text; /* number of comments read or comments to write */
121
+ int max_text; /* current size of text array */
122
+ png_textp text; /* array of comments read or comments to write */
123
+ #endif /* TEXT */
124
+
125
+ #ifdef PNG_tIME_SUPPORTED
126
+ /* The tIME chunk holds the last time the displayed image data was
127
+ * modified. See the png_time struct for the contents of this struct.
128
+ */
129
+ png_time mod_time;
130
+ #endif
131
+
132
+ #ifdef PNG_sBIT_SUPPORTED
133
+ /* The sBIT chunk specifies the number of significant high-order bits
134
+ * in the pixel data. Values are in the range [1, bit_depth], and are
135
+ * only specified for the channels in the pixel data. The contents of
136
+ * the low-order bits is not specified. Data is valid if
137
+ * (valid & PNG_INFO_sBIT) is non-zero.
138
+ */
139
+ png_color_8 sig_bit; /* significant bits in color channels */
140
+ #endif
141
+
142
+ #if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \
143
+ defined(PNG_READ_BACKGROUND_SUPPORTED)
144
+ /* The tRNS chunk supplies transparency data for paletted images and
145
+ * other image types that don't need a full alpha channel. There are
146
+ * "num_trans" transparency values for a paletted image, stored in the
147
+ * same order as the palette colors, starting from index 0. Values
148
+ * for the data are in the range [0, 255], ranging from fully transparent
149
+ * to fully opaque, respectively. For non-paletted images, there is a
150
+ * single color specified that should be treated as fully transparent.
151
+ * Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
152
+ */
153
+ png_bytep trans_alpha; /* alpha values for paletted image */
154
+ png_color_16 trans_color; /* transparent color for non-palette image */
155
+ #endif
156
+
157
+ #if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
158
+ /* The bKGD chunk gives the suggested image background color if the
159
+ * display program does not have its own background color and the image
160
+ * is needs to composited onto a background before display. The colors
161
+ * in "background" are normally in the same color space/depth as the
162
+ * pixel data. Data is valid if (valid & PNG_INFO_bKGD) is non-zero.
163
+ */
164
+ png_color_16 background;
165
+ #endif
166
+
167
+ #ifdef PNG_oFFs_SUPPORTED
168
+ /* The oFFs chunk gives the offset in "offset_unit_type" units rightwards
169
+ * and downwards from the top-left corner of the display, page, or other
170
+ * application-specific co-ordinate space. See the PNG_OFFSET_ defines
171
+ * below for the unit types. Valid if (valid & PNG_INFO_oFFs) non-zero.
172
+ */
173
+ png_int_32 x_offset; /* x offset on page */
174
+ png_int_32 y_offset; /* y offset on page */
175
+ png_byte offset_unit_type; /* offset units type */
176
+ #endif
177
+
178
+ #ifdef PNG_pHYs_SUPPORTED
179
+ /* The pHYs chunk gives the physical pixel density of the image for
180
+ * display or printing in "phys_unit_type" units (see PNG_RESOLUTION_
181
+ * defines below). Data is valid if (valid & PNG_INFO_pHYs) is non-zero.
182
+ */
183
+ png_uint_32 x_pixels_per_unit; /* horizontal pixel density */
184
+ png_uint_32 y_pixels_per_unit; /* vertical pixel density */
185
+ png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */
186
+ #endif
187
+
188
+ #ifdef PNG_eXIf_SUPPORTED
189
+ int num_exif; /* Added at libpng-1.6.31 */
190
+ png_bytep exif;
191
+ # ifdef PNG_READ_eXIf_SUPPORTED
192
+ png_bytep eXIf_buf; /* Added at libpng-1.6.32 */
193
+ # endif
194
+ #endif
195
+
196
+ #ifdef PNG_hIST_SUPPORTED
197
+ /* The hIST chunk contains the relative frequency or importance of the
198
+ * various palette entries, so that a viewer can intelligently select a
199
+ * reduced-color palette, if required. Data is an array of "num_palette"
200
+ * values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)
201
+ * is non-zero.
202
+ */
203
+ png_uint_16p hist;
204
+ #endif
205
+
206
+ #ifdef PNG_pCAL_SUPPORTED
207
+ /* The pCAL chunk describes a transformation between the stored pixel
208
+ * values and original physical data values used to create the image.
209
+ * The integer range [0, 2^bit_depth - 1] maps to the floating-point
210
+ * range given by [pcal_X0, pcal_X1], and are further transformed by a
211
+ * (possibly non-linear) transformation function given by "pcal_type"
212
+ * and "pcal_params" into "pcal_units". Please see the PNG_EQUATION_
213
+ * defines below, and the PNG-Group's PNG extensions document for a
214
+ * complete description of the transformations and how they should be
215
+ * implemented, and for a description of the ASCII parameter strings.
216
+ * Data values are valid if (valid & PNG_INFO_pCAL) non-zero.
217
+ */
218
+ png_charp pcal_purpose; /* pCAL chunk description string */
219
+ png_int_32 pcal_X0; /* minimum value */
220
+ png_int_32 pcal_X1; /* maximum value */
221
+ png_charp pcal_units; /* Latin-1 string giving physical units */
222
+ png_charpp pcal_params; /* ASCII strings containing parameter values */
223
+ png_byte pcal_type; /* equation type (see PNG_EQUATION_ below) */
224
+ png_byte pcal_nparams; /* number of parameters given in pcal_params */
225
+ #endif
226
+
227
+ /* New members added in libpng-1.0.6 */
228
+ png_uint_32 free_me; /* flags items libpng is responsible for freeing */
229
+
230
+ #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
231
+ /* Storage for unknown chunks that the library doesn't recognize. */
232
+ png_unknown_chunkp unknown_chunks;
233
+
234
+ /* The type of this field is limited by the type of
235
+ * png_struct::user_chunk_cache_max, else overflow can occur.
236
+ */
237
+ int unknown_chunks_num;
238
+ #endif
239
+
240
+ #ifdef PNG_sPLT_SUPPORTED
241
+ /* Data on sPLT chunks (there may be more than one). */
242
+ png_sPLT_tp splt_palettes;
243
+ int splt_palettes_num; /* Match type returned by png_get API */
244
+ #endif
245
+
246
+ #ifdef PNG_sCAL_SUPPORTED
247
+ /* The sCAL chunk describes the actual physical dimensions of the
248
+ * subject matter of the graphic. The chunk contains a unit specification
249
+ * a byte value, and two ASCII strings representing floating-point
250
+ * values. The values are width and height corresponding to one pixel
251
+ * in the image. Data values are valid if (valid & PNG_INFO_sCAL) is
252
+ * non-zero.
253
+ */
254
+ png_byte scal_unit; /* unit of physical scale */
255
+ png_charp scal_s_width; /* string containing height */
256
+ png_charp scal_s_height; /* string containing width */
257
+ #endif
258
+
259
+ #ifdef PNG_INFO_IMAGE_SUPPORTED
260
+ /* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS)
261
+ non-zero */
262
+ /* Data valid if (valid & PNG_INFO_IDAT) non-zero */
263
+ png_bytepp row_pointers; /* the image bits */
264
+ #endif
265
+
266
+ };
267
+ #endif /* PNGINFO_H */
videochat2/lib/python3.10/site-packages/tensorflow/include/external/png/pngpriv.h ADDED
@@ -0,0 +1,2143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ /* pngpriv.h - private declarations for use inside libpng
3
+ *
4
+ * Copyright (c) 2018-2022 Cosmin Truta
5
+ * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
6
+ * Copyright (c) 1996-1997 Andreas Dilger
7
+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
8
+ *
9
+ * This code is released under the libpng license.
10
+ * For conditions of distribution and use, see the disclaimer
11
+ * and license in png.h
12
+ */
13
+
14
+ /* The symbols declared in this file (including the functions declared
15
+ * as extern) are PRIVATE. They are not part of the libpng public
16
+ * interface, and are not recommended for use by regular applications.
17
+ * Some of them may become public in the future; others may stay private,
18
+ * change in an incompatible way, or even disappear.
19
+ * Although the libpng users are not forbidden to include this header,
20
+ * they should be well aware of the issues that may arise from doing so.
21
+ */
22
+
23
+ #ifndef PNGPRIV_H
24
+ #define PNGPRIV_H
25
+
26
+ /* Feature Test Macros. The following are defined here to ensure that correctly
27
+ * implemented libraries reveal the APIs libpng needs to build and hide those
28
+ * that are not needed and potentially damaging to the compilation.
29
+ *
30
+ * Feature Test Macros must be defined before any system header is included (see
31
+ * POSIX 1003.1 2.8.2 "POSIX Symbols."
32
+ *
33
+ * These macros only have an effect if the operating system supports either
34
+ * POSIX 1003.1 or C99, or both. On other operating systems (particularly
35
+ * Windows/Visual Studio) there is no effect; the OS specific tests below are
36
+ * still required (as of 2011-05-02.)
37
+ */
38
+ #ifndef _POSIX_SOURCE
39
+ # define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
40
+ #endif
41
+
42
+ #ifndef PNG_VERSION_INFO_ONLY
43
+ /* Standard library headers not required by png.h: */
44
+ # include <stdlib.h>
45
+ # include <string.h>
46
+ #endif
47
+
48
+ #define PNGLIB_BUILD /*libpng is being built, not used*/
49
+
50
+ /* If HAVE_CONFIG_H is defined during the build then the build system must
51
+ * provide an appropriate "config.h" file on the include path. The header file
52
+ * must provide definitions as required below (search for "HAVE_CONFIG_H");
53
+ * see configure.ac for more details of the requirements. The macro
54
+ * "PNG_NO_CONFIG_H" is provided for maintainers to test for dependencies on
55
+ * 'configure'; define this macro to prevent the configure build including the
56
+ * configure generated config.h. Libpng is expected to compile without *any*
57
+ * special build system support on a reasonably ANSI-C compliant system.
58
+ */
59
+ #if defined(HAVE_CONFIG_H) && !defined(PNG_NO_CONFIG_H)
60
+ # include <config.h>
61
+
62
+ /* Pick up the definition of 'restrict' from config.h if it was read: */
63
+ # define PNG_RESTRICT restrict
64
+ #endif
65
+
66
+ /* To support symbol prefixing it is necessary to know *before* including png.h
67
+ * whether the fixed point (and maybe other) APIs are exported, because if they
68
+ * are not internal definitions may be required. This is handled below just
69
+ * before png.h is included, but load the configuration now if it is available.
70
+ */
71
+ #ifndef PNGLCONF_H
72
+ # include "pnglibconf.h"
73
+ #endif
74
+
75
+ /* Local renames may change non-exported API functions from png.h */
76
+ #if defined(PNG_PREFIX) && !defined(PNGPREFIX_H)
77
+ # include "pngprefix.h"
78
+ #endif
79
+
80
+ #ifdef PNG_USER_CONFIG
81
+ # include "pngusr.h"
82
+ /* These should have been defined in pngusr.h */
83
+ # ifndef PNG_USER_PRIVATEBUILD
84
+ # define PNG_USER_PRIVATEBUILD "Custom libpng build"
85
+ # endif
86
+ # ifndef PNG_USER_DLLFNAME_POSTFIX
87
+ # define PNG_USER_DLLFNAME_POSTFIX "Cb"
88
+ # endif
89
+ #endif
90
+
91
+ /* Compile time options.
92
+ * =====================
93
+ * In a multi-arch build the compiler may compile the code several times for the
94
+ * same object module, producing different binaries for different architectures.
95
+ * When this happens configure-time setting of the target host options cannot be
96
+ * done and this interferes with the handling of the ARM NEON optimizations, and
97
+ * possibly other similar optimizations. Put additional tests here; in general
98
+ * this is needed when the same option can be changed at both compile time and
99
+ * run time depending on the target OS (i.e. iOS vs Android.)
100
+ *
101
+ * NOTE: symbol prefixing does not pass $(CFLAGS) to the preprocessor, because
102
+ * this is not possible with certain compilers (Oracle SUN OS CC), as a result
103
+ * it is necessary to ensure that all extern functions that *might* be used
104
+ * regardless of $(CFLAGS) get declared in this file. The test on __ARM_NEON__
105
+ * below is one example of this behavior because it is controlled by the
106
+ * presence or not of -mfpu=neon on the GCC command line, it is possible to do
107
+ * this in $(CC), e.g. "CC=gcc -mfpu=neon", but people who build libpng rarely
108
+ * do this.
109
+ */
110
+ #ifndef PNG_ARM_NEON_OPT
111
+ /* ARM NEON optimizations are being controlled by the compiler settings,
112
+ * typically the target FPU. If the FPU has been set to NEON (-mfpu=neon
113
+ * with GCC) then the compiler will define __ARM_NEON__ and we can rely
114
+ * unconditionally on NEON instructions not crashing, otherwise we must
115
+ * disable use of NEON instructions.
116
+ *
117
+ * NOTE: at present these optimizations depend on 'ALIGNED_MEMORY', so they
118
+ * can only be turned on automatically if that is supported too. If
119
+ * PNG_ARM_NEON_OPT is set in CPPFLAGS (to >0) then arm/arm_init.c will fail
120
+ * to compile with an appropriate #error if ALIGNED_MEMORY has been turned
121
+ * off.
122
+ *
123
+ * Note that gcc-4.9 defines __ARM_NEON instead of the deprecated
124
+ * __ARM_NEON__, so we check both variants.
125
+ *
126
+ * To disable ARM_NEON optimizations entirely, and skip compiling the
127
+ * associated assembler code, pass --enable-arm-neon=no to configure
128
+ * or put -DPNG_ARM_NEON_OPT=0 in CPPFLAGS.
129
+ */
130
+ # if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && \
131
+ defined(PNG_ALIGNED_MEMORY_SUPPORTED)
132
+ # define PNG_ARM_NEON_OPT 2
133
+ # else
134
+ # define PNG_ARM_NEON_OPT 0
135
+ # endif
136
+ #endif
137
+
138
+ #if PNG_ARM_NEON_OPT > 0
139
+ /* NEON optimizations are to be at least considered by libpng, so enable the
140
+ * callbacks to do this.
141
+ */
142
+ # define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_neon
143
+
144
+ /* By default the 'intrinsics' code in arm/filter_neon_intrinsics.c is used
145
+ * if possible - if __ARM_NEON__ is set and the compiler version is not known
146
+ * to be broken. This is controlled by PNG_ARM_NEON_IMPLEMENTATION which can
147
+ * be:
148
+ *
149
+ * 1 The intrinsics code (the default with __ARM_NEON__)
150
+ * 2 The hand coded assembler (the default without __ARM_NEON__)
151
+ *
152
+ * It is possible to set PNG_ARM_NEON_IMPLEMENTATION in CPPFLAGS, however
153
+ * this is *NOT* supported and may cease to work even after a minor revision
154
+ * to libpng. It *is* valid to do this for testing purposes, e.g. speed
155
+ * testing or a new compiler, but the results should be communicated to the
156
+ * libpng implementation list for incorporation in the next minor release.
157
+ */
158
+ # ifndef PNG_ARM_NEON_IMPLEMENTATION
159
+ # if defined(__ARM_NEON__) || defined(__ARM_NEON)
160
+ # if defined(__clang__)
161
+ /* At present it is unknown by the libpng developers which versions
162
+ * of clang support the intrinsics, however some or perhaps all
163
+ * versions do not work with the assembler so this may be
164
+ * irrelevant, so just use the default (do nothing here.)
165
+ */
166
+ # elif defined(__GNUC__)
167
+ /* GCC 4.5.4 NEON support is known to be broken. 4.6.3 is known to
168
+ * work, so if this *is* GCC, or G++, look for a version >4.5
169
+ */
170
+ # if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
171
+ # define PNG_ARM_NEON_IMPLEMENTATION 2
172
+ # endif /* no GNUC support */
173
+ # endif /* __GNUC__ */
174
+ # else /* !defined __ARM_NEON__ */
175
+ /* The 'intrinsics' code simply won't compile without this -mfpu=neon:
176
+ */
177
+ # if !defined(__aarch64__) && !defined(_M_ARM64)
178
+ /* The assembler code currently does not work on ARM64 */
179
+ # define PNG_ARM_NEON_IMPLEMENTATION 2
180
+ # endif /* __aarch64__ */
181
+ # endif /* __ARM_NEON__ */
182
+ # endif /* !PNG_ARM_NEON_IMPLEMENTATION */
183
+
184
+ # ifndef PNG_ARM_NEON_IMPLEMENTATION
185
+ /* Use the intrinsics code by default. */
186
+ # define PNG_ARM_NEON_IMPLEMENTATION 1
187
+ # endif
188
+ #else /* PNG_ARM_NEON_OPT == 0 */
189
+ # define PNG_ARM_NEON_IMPLEMENTATION 0
190
+ #endif /* PNG_ARM_NEON_OPT > 0 */
191
+
192
+ #ifndef PNG_MIPS_MSA_OPT
193
+ # if defined(__mips_msa) && (__mips_isa_rev >= 5) && defined(PNG_ALIGNED_MEMORY_SUPPORTED)
194
+ # define PNG_MIPS_MSA_OPT 2
195
+ # else
196
+ # define PNG_MIPS_MSA_OPT 0
197
+ # endif
198
+ #endif
199
+
200
+ #ifndef PNG_POWERPC_VSX_OPT
201
+ # if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__)
202
+ # define PNG_POWERPC_VSX_OPT 2
203
+ # else
204
+ # define PNG_POWERPC_VSX_OPT 0
205
+ # endif
206
+ #endif
207
+
208
+ #ifndef PNG_INTEL_SSE_OPT
209
+ # ifdef PNG_INTEL_SSE
210
+ /* Only check for SSE if the build configuration has been modified to
211
+ * enable SSE optimizations. This means that these optimizations will
212
+ * be off by default. See contrib/intel for more details.
213
+ */
214
+ # if defined(__SSE4_1__) || defined(__AVX__) || defined(__SSSE3__) || \
215
+ defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
216
+ (defined(_M_IX86_FP) && _M_IX86_FP >= 2)
217
+ # define PNG_INTEL_SSE_OPT 1
218
+ # else
219
+ # define PNG_INTEL_SSE_OPT 0
220
+ # endif
221
+ # else
222
+ # define PNG_INTEL_SSE_OPT 0
223
+ # endif
224
+ #endif
225
+
226
+ #if PNG_INTEL_SSE_OPT > 0
227
+ # ifndef PNG_INTEL_SSE_IMPLEMENTATION
228
+ # if defined(__SSE4_1__) || defined(__AVX__)
229
+ /* We are not actually using AVX, but checking for AVX is the best
230
+ way we can detect SSE4.1 and SSSE3 on MSVC.
231
+ */
232
+ # define PNG_INTEL_SSE_IMPLEMENTATION 3
233
+ # elif defined(__SSSE3__)
234
+ # define PNG_INTEL_SSE_IMPLEMENTATION 2
235
+ # elif defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
236
+ (defined(_M_IX86_FP) && _M_IX86_FP >= 2)
237
+ # define PNG_INTEL_SSE_IMPLEMENTATION 1
238
+ # else
239
+ # define PNG_INTEL_SSE_IMPLEMENTATION 0
240
+ # endif
241
+ # endif
242
+
243
+ # if PNG_INTEL_SSE_IMPLEMENTATION > 0
244
+ # define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_sse2
245
+ # endif
246
+ #else
247
+ # define PNG_INTEL_SSE_IMPLEMENTATION 0
248
+ #endif
249
+
250
+ #if PNG_MIPS_MSA_OPT > 0
251
+ # define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_msa
252
+ # ifndef PNG_MIPS_MSA_IMPLEMENTATION
253
+ # if defined(__mips_msa)
254
+ # if defined(__clang__)
255
+ # elif defined(__GNUC__)
256
+ # if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)
257
+ # define PNG_MIPS_MSA_IMPLEMENTATION 2
258
+ # endif /* no GNUC support */
259
+ # endif /* __GNUC__ */
260
+ # else /* !defined __mips_msa */
261
+ # define PNG_MIPS_MSA_IMPLEMENTATION 2
262
+ # endif /* __mips_msa */
263
+ # endif /* !PNG_MIPS_MSA_IMPLEMENTATION */
264
+
265
+ # ifndef PNG_MIPS_MSA_IMPLEMENTATION
266
+ # define PNG_MIPS_MSA_IMPLEMENTATION 1
267
+ # endif
268
+ #else
269
+ # define PNG_MIPS_MSA_IMPLEMENTATION 0
270
+ #endif /* PNG_MIPS_MSA_OPT > 0 */
271
+
272
+ #if PNG_POWERPC_VSX_OPT > 0
273
+ # define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_vsx
274
+ # define PNG_POWERPC_VSX_IMPLEMENTATION 1
275
+ #else
276
+ # define PNG_POWERPC_VSX_IMPLEMENTATION 0
277
+ #endif
278
+
279
+
280
+ /* Is this a build of a DLL where compilation of the object modules requires
281
+ * different preprocessor settings to those required for a simple library? If
282
+ * so PNG_BUILD_DLL must be set.
283
+ *
284
+ * If libpng is used inside a DLL but that DLL does not export the libpng APIs
285
+ * PNG_BUILD_DLL must not be set. To avoid the code below kicking in build a
286
+ * static library of libpng then link the DLL against that.
287
+ */
288
+ #ifndef PNG_BUILD_DLL
289
+ # ifdef DLL_EXPORT
290
+ /* This is set by libtool when files are compiled for a DLL; libtool
291
+ * always compiles twice, even on systems where it isn't necessary. Set
292
+ * PNG_BUILD_DLL in case it is necessary:
293
+ */
294
+ # define PNG_BUILD_DLL
295
+ # else
296
+ # ifdef _WINDLL
297
+ /* This is set by the Microsoft Visual Studio IDE in projects that
298
+ * build a DLL. It can't easily be removed from those projects (it
299
+ * isn't visible in the Visual Studio UI) so it is a fairly reliable
300
+ * indication that PNG_IMPEXP needs to be set to the DLL export
301
+ * attributes.
302
+ */
303
+ # define PNG_BUILD_DLL
304
+ # else
305
+ # ifdef __DLL__
306
+ /* This is set by the Borland C system when compiling for a DLL
307
+ * (as above.)
308
+ */
309
+ # define PNG_BUILD_DLL
310
+ # else
311
+ /* Add additional compiler cases here. */
312
+ # endif
313
+ # endif
314
+ # endif
315
+ #endif /* Setting PNG_BUILD_DLL if required */
316
+
317
+ /* See pngconf.h for more details: the builder of the library may set this on
318
+ * the command line to the right thing for the specific compilation system or it
319
+ * may be automagically set above (at present we know of no system where it does
320
+ * need to be set on the command line.)
321
+ *
322
+ * PNG_IMPEXP must be set here when building the library to prevent pngconf.h
323
+ * setting it to the "import" setting for a DLL build.
324
+ */
325
+ #ifndef PNG_IMPEXP
326
+ # ifdef PNG_BUILD_DLL
327
+ # define PNG_IMPEXP PNG_DLL_EXPORT
328
+ # else
329
+ /* Not building a DLL, or the DLL doesn't require specific export
330
+ * definitions.
331
+ */
332
+ # define PNG_IMPEXP
333
+ # endif
334
+ #endif
335
+
336
+ /* No warnings for private or deprecated functions in the build: */
337
+ #ifndef PNG_DEPRECATED
338
+ # define PNG_DEPRECATED
339
+ #endif
340
+ #ifndef PNG_PRIVATE
341
+ # define PNG_PRIVATE
342
+ #endif
343
+
344
+ /* Symbol preprocessing support.
345
+ *
346
+ * To enable listing global, but internal, symbols the following macros should
347
+ * always be used to declare an extern data or function object in this file.
348
+ */
349
+ #ifndef PNG_INTERNAL_DATA
350
+ # define PNG_INTERNAL_DATA(type, name, array) PNG_LINKAGE_DATA type name array
351
+ #endif
352
+
353
+ #ifndef PNG_INTERNAL_FUNCTION
354
+ # define PNG_INTERNAL_FUNCTION(type, name, args, attributes)\
355
+ PNG_LINKAGE_FUNCTION PNG_FUNCTION(type, name, args, PNG_EMPTY attributes)
356
+ #endif
357
+
358
+ #ifndef PNG_INTERNAL_CALLBACK
359
+ # define PNG_INTERNAL_CALLBACK(type, name, args, attributes)\
360
+ PNG_LINKAGE_CALLBACK PNG_FUNCTION(type, (PNGCBAPI name), args,\
361
+ PNG_EMPTY attributes)
362
+ #endif
363
+
364
+ /* If floating or fixed point APIs are disabled they may still be compiled
365
+ * internally. To handle this make sure they are declared as the appropriate
366
+ * internal extern function (otherwise the symbol prefixing stuff won't work and
367
+ * the functions will be used without definitions.)
368
+ *
369
+ * NOTE: although all the API functions are declared here they are not all
370
+ * actually built! Because the declarations are still made it is necessary to
371
+ * fake out types that they depend on.
372
+ */
373
+ #ifndef PNG_FP_EXPORT
374
+ # ifndef PNG_FLOATING_POINT_SUPPORTED
375
+ # define PNG_FP_EXPORT(ordinal, type, name, args)\
376
+ PNG_INTERNAL_FUNCTION(type, name, args, PNG_EMPTY);
377
+ # ifndef PNG_VERSION_INFO_ONLY
378
+ typedef struct png_incomplete png_double;
379
+ typedef png_double* png_doublep;
380
+ typedef const png_double* png_const_doublep;
381
+ typedef png_double** png_doublepp;
382
+ # endif
383
+ # endif
384
+ #endif
385
+ #ifndef PNG_FIXED_EXPORT
386
+ # ifndef PNG_FIXED_POINT_SUPPORTED
387
+ # define PNG_FIXED_EXPORT(ordinal, type, name, args)\
388
+ PNG_INTERNAL_FUNCTION(type, name, args, PNG_EMPTY);
389
+ # endif
390
+ #endif
391
+
392
+ #include "png.h"
393
+
394
+ /* pngconf.h does not set PNG_DLL_EXPORT unless it is required, so: */
395
+ #ifndef PNG_DLL_EXPORT
396
+ # define PNG_DLL_EXPORT
397
+ #endif
398
+
399
+ /* This is a global switch to set the compilation for an installed system
400
+ * (a release build). It can be set for testing debug builds to ensure that
401
+ * they will compile when the build type is switched to RC or STABLE, the
402
+ * default is just to use PNG_LIBPNG_BUILD_BASE_TYPE. Set this in CPPFLAGS
403
+ * with either:
404
+ *
405
+ * -DPNG_RELEASE_BUILD Turns on the release compile path
406
+ * -DPNG_RELEASE_BUILD=0 Turns it off
407
+ * or in your pngusr.h with
408
+ * #define PNG_RELEASE_BUILD=1 Turns on the release compile path
409
+ * #define PNG_RELEASE_BUILD=0 Turns it off
410
+ */
411
+ #ifndef PNG_RELEASE_BUILD
412
+ # define PNG_RELEASE_BUILD (PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC)
413
+ #endif
414
+
415
+ /* SECURITY and SAFETY:
416
+ *
417
+ * libpng is built with support for internal limits on image dimensions and
418
+ * memory usage. These are documented in scripts/pnglibconf.dfa of the
419
+ * source and recorded in the machine generated header file pnglibconf.h.
420
+ */
421
+
422
+ /* If you are running on a machine where you cannot allocate more
423
+ * than 64K of memory at once, uncomment this. While libpng will not
424
+ * normally need that much memory in a chunk (unless you load up a very
425
+ * large file), zlib needs to know how big of a chunk it can use, and
426
+ * libpng thus makes sure to check any memory allocation to verify it
427
+ * will fit into memory.
428
+ *
429
+ * zlib provides 'MAXSEG_64K' which, if defined, indicates the
430
+ * same limit and pngconf.h (already included) sets the limit
431
+ * if certain operating systems are detected.
432
+ */
433
+ #if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
434
+ # define PNG_MAX_MALLOC_64K
435
+ #endif
436
+
437
+ #ifndef PNG_UNUSED
438
+ /* Unused formal parameter warnings are silenced using the following macro
439
+ * which is expected to have no bad effects on performance (optimizing
440
+ * compilers will probably remove it entirely). Note that if you replace
441
+ * it with something other than whitespace, you must include the terminating
442
+ * semicolon.
443
+ */
444
+ # define PNG_UNUSED(param) (void)param;
445
+ #endif
446
+
447
+ /* Just a little check that someone hasn't tried to define something
448
+ * contradictory.
449
+ */
450
+ #if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K)
451
+ # undef PNG_ZBUF_SIZE
452
+ # define PNG_ZBUF_SIZE 65536L
453
+ #endif
454
+
455
+ /* If warnings or errors are turned off the code is disabled or redirected here.
456
+ * From 1.5.4 functions have been added to allow very limited formatting of
457
+ * error and warning messages - this code will also be disabled here.
458
+ */
459
+ #ifdef PNG_WARNINGS_SUPPORTED
460
+ # define PNG_WARNING_PARAMETERS(p) png_warning_parameters p;
461
+ #else
462
+ # define png_warning_parameter(p,number,string) ((void)0)
463
+ # define png_warning_parameter_unsigned(p,number,format,value) ((void)0)
464
+ # define png_warning_parameter_signed(p,number,format,value) ((void)0)
465
+ # define png_formatted_warning(pp,p,message) ((void)(pp))
466
+ # define PNG_WARNING_PARAMETERS(p)
467
+ #endif
468
+ #ifndef PNG_ERROR_TEXT_SUPPORTED
469
+ # define png_fixed_error(s1,s2) png_err(s1)
470
+ #endif
471
+
472
+ /* Some fixed point APIs are still required even if not exported because
473
+ * they get used by the corresponding floating point APIs. This magic
474
+ * deals with this:
475
+ */
476
+ #ifdef PNG_FIXED_POINT_SUPPORTED
477
+ # define PNGFAPI PNGAPI
478
+ #else
479
+ # define PNGFAPI /* PRIVATE */
480
+ #endif
481
+
482
+ #ifndef PNG_VERSION_INFO_ONLY
483
+ /* Other defines specific to compilers can go here. Try to keep
484
+ * them inside an appropriate ifdef/endif pair for portability.
485
+ */
486
+
487
+ /* C allows up-casts from (void*) to any pointer and (const void*) to any
488
+ * pointer to a const object. C++ regards this as a type error and requires an
489
+ * explicit, static, cast and provides the static_cast<> rune to ensure that
490
+ * const is not cast away.
491
+ */
492
+ #ifdef __cplusplus
493
+ # define png_voidcast(type, value) static_cast<type>(value)
494
+ # define png_constcast(type, value) const_cast<type>(value)
495
+ # define png_aligncast(type, value) \
496
+ static_cast<type>(static_cast<void*>(value))
497
+ # define png_aligncastconst(type, value) \
498
+ static_cast<type>(static_cast<const void*>(value))
499
+ #else
500
+ # define png_voidcast(type, value) (value)
501
+ # define png_constcast(type, value) ((type)(void*)(const void*)(value))
502
+ # define png_aligncast(type, value) ((void*)(value))
503
+ # define png_aligncastconst(type, value) ((const void*)(value))
504
+ #endif /* __cplusplus */
505
+
506
+ #if defined(PNG_FLOATING_POINT_SUPPORTED) ||\
507
+ defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
508
+ /* png.c requires the following ANSI-C constants if the conversion of
509
+ * floating point to ASCII is implemented therein:
510
+ *
511
+ * DBL_DIG Maximum number of decimal digits (can be set to any constant)
512
+ * DBL_MIN Smallest normalized fp number (can be set to an arbitrary value)
513
+ * DBL_MAX Maximum floating point number (can be set to an arbitrary value)
514
+ */
515
+ # include <float.h>
516
+
517
+ # if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
518
+ defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
519
+ /* We need to check that <math.h> hasn't already been included earlier
520
+ * as it seems it doesn't agree with <fp.h>, yet we should really use
521
+ * <fp.h> if possible.
522
+ */
523
+ # if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
524
+ # include <fp.h>
525
+ # endif
526
+ # else
527
+ # include <math.h>
528
+ # endif
529
+ # if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
530
+ /* Amiga SAS/C: We must include builtin FPU functions when compiling using
531
+ * MATH=68881
532
+ */
533
+ # include <m68881.h>
534
+ # endif
535
+ #endif
536
+
537
+ /* This provides the non-ANSI (far) memory allocation routines. */
538
+ #if defined(__TURBOC__) && defined(__MSDOS__)
539
+ # include <mem.h>
540
+ # include <alloc.h>
541
+ #endif
542
+
543
+ #if defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
544
+ # include <windows.h>
545
+ #endif
546
+ #endif /* PNG_VERSION_INFO_ONLY */
547
+
548
+ /* Moved here around 1.5.0beta36 from pngconf.h */
549
+ /* Users may want to use these so they are not private. Any library
550
+ * functions that are passed far data must be model-independent.
551
+ */
552
+
553
+ /* Platform-independent functions */
554
+ #ifndef PNG_ABORT
555
+ # define PNG_ABORT() abort()
556
+ #endif
557
+
558
+ /* These macros may need to be architecture dependent. */
559
+ #define PNG_ALIGN_NONE 0 /* do not use data alignment */
560
+ #define PNG_ALIGN_ALWAYS 1 /* assume unaligned accesses are OK */
561
+ #ifdef offsetof
562
+ # define PNG_ALIGN_OFFSET 2 /* use offsetof to determine alignment */
563
+ #else
564
+ # define PNG_ALIGN_OFFSET -1 /* prevent the use of this */
565
+ #endif
566
+ #define PNG_ALIGN_SIZE 3 /* use sizeof to determine alignment */
567
+
568
+ #ifndef PNG_ALIGN_TYPE
569
+ /* Default to using aligned access optimizations and requiring alignment to a
570
+ * multiple of the data type size. Override in a compiler specific fashion
571
+ * if necessary by inserting tests here:
572
+ */
573
+ # define PNG_ALIGN_TYPE PNG_ALIGN_SIZE
574
+ #endif
575
+
576
+ #if PNG_ALIGN_TYPE == PNG_ALIGN_SIZE
577
+ /* This is used because in some compiler implementations non-aligned
578
+ * structure members are supported, so the offsetof approach below fails.
579
+ * Set PNG_ALIGN_SIZE=0 for compiler combinations where unaligned access
580
+ * is good for performance. Do not do this unless you have tested the
581
+ * result and understand it.
582
+ */
583
+ # define png_alignof(type) (sizeof(type))
584
+ #else
585
+ # if PNG_ALIGN_TYPE == PNG_ALIGN_OFFSET
586
+ # define png_alignof(type) offsetof(struct{char c; type t;}, t)
587
+ # else
588
+ # if PNG_ALIGN_TYPE == PNG_ALIGN_ALWAYS
589
+ # define png_alignof(type) 1
590
+ # endif
591
+ /* Else leave png_alignof undefined to prevent use thereof */
592
+ # endif
593
+ #endif
594
+
595
+ /* This implicitly assumes alignment is always a multiple of 2. */
596
+ #ifdef png_alignof
597
+ # define png_isaligned(ptr, type) \
598
+ (((type)(size_t)((const void*)(ptr)) & (type)(png_alignof(type)-1)) == 0)
599
+ #else
600
+ # define png_isaligned(ptr, type) 0
601
+ #endif
602
+
603
+ /* End of memory model/platform independent support */
604
+ /* End of 1.5.0beta36 move from pngconf.h */
605
+
606
+ /* CONSTANTS and UTILITY MACROS
607
+ * These are used internally by libpng and not exposed in the API
608
+ */
609
+
610
+ /* Various modes of operation. Note that after an init, mode is set to
611
+ * zero automatically when the structure is created. Three of these
612
+ * are defined in png.h because they need to be visible to applications
613
+ * that call png_set_unknown_chunk().
614
+ */
615
+ /* #define PNG_HAVE_IHDR 0x01U (defined in png.h) */
616
+ /* #define PNG_HAVE_PLTE 0x02U (defined in png.h) */
617
+ #define PNG_HAVE_IDAT 0x04U
618
+ /* #define PNG_AFTER_IDAT 0x08U (defined in png.h) */
619
+ #define PNG_HAVE_IEND 0x10U
620
+ /* 0x20U (unused) */
621
+ /* 0x40U (unused) */
622
+ /* 0x80U (unused) */
623
+ #define PNG_HAVE_CHUNK_HEADER 0x100U
624
+ #define PNG_WROTE_tIME 0x200U
625
+ #define PNG_WROTE_INFO_BEFORE_PLTE 0x400U
626
+ #define PNG_BACKGROUND_IS_GRAY 0x800U
627
+ #define PNG_HAVE_PNG_SIGNATURE 0x1000U
628
+ #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U /* Have another chunk after IDAT */
629
+ /* 0x4000U (unused) */
630
+ #define PNG_IS_READ_STRUCT 0x8000U /* Else is a write struct */
631
+
632
+ /* Flags for the transformations the PNG library does on the image data */
633
+ #define PNG_BGR 0x0001U
634
+ #define PNG_INTERLACE 0x0002U
635
+ #define PNG_PACK 0x0004U
636
+ #define PNG_SHIFT 0x0008U
637
+ #define PNG_SWAP_BYTES 0x0010U
638
+ #define PNG_INVERT_MONO 0x0020U
639
+ #define PNG_QUANTIZE 0x0040U
640
+ #define PNG_COMPOSE 0x0080U /* Was PNG_BACKGROUND */
641
+ #define PNG_BACKGROUND_EXPAND 0x0100U
642
+ #define PNG_EXPAND_16 0x0200U /* Added to libpng 1.5.2 */
643
+ #define PNG_16_TO_8 0x0400U /* Becomes 'chop' in 1.5.4 */
644
+ #define PNG_RGBA 0x0800U
645
+ #define PNG_EXPAND 0x1000U
646
+ #define PNG_GAMMA 0x2000U
647
+ #define PNG_GRAY_TO_RGB 0x4000U
648
+ #define PNG_FILLER 0x8000U
649
+ #define PNG_PACKSWAP 0x10000U
650
+ #define PNG_SWAP_ALPHA 0x20000U
651
+ #define PNG_STRIP_ALPHA 0x40000U
652
+ #define PNG_INVERT_ALPHA 0x80000U
653
+ #define PNG_USER_TRANSFORM 0x100000U
654
+ #define PNG_RGB_TO_GRAY_ERR 0x200000U
655
+ #define PNG_RGB_TO_GRAY_WARN 0x400000U
656
+ #define PNG_RGB_TO_GRAY 0x600000U /* two bits, RGB_TO_GRAY_ERR|WARN */
657
+ #define PNG_ENCODE_ALPHA 0x800000U /* Added to libpng-1.5.4 */
658
+ #define PNG_ADD_ALPHA 0x1000000U /* Added to libpng-1.2.7 */
659
+ #define PNG_EXPAND_tRNS 0x2000000U /* Added to libpng-1.2.9 */
660
+ #define PNG_SCALE_16_TO_8 0x4000000U /* Added to libpng-1.5.4 */
661
+ /* 0x8000000U unused */
662
+ /* 0x10000000U unused */
663
+ /* 0x20000000U unused */
664
+ /* 0x40000000U unused */
665
+ /* Flags for png_create_struct */
666
+ #define PNG_STRUCT_PNG 0x0001U
667
+ #define PNG_STRUCT_INFO 0x0002U
668
+
669
+ /* Flags for the png_ptr->flags rather than declaring a byte for each one */
670
+ #define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001U
671
+ #define PNG_FLAG_ZSTREAM_INITIALIZED 0x0002U /* Added to libpng-1.6.0 */
672
+ /* 0x0004U unused */
673
+ #define PNG_FLAG_ZSTREAM_ENDED 0x0008U /* Added to libpng-1.6.0 */
674
+ /* 0x0010U unused */
675
+ /* 0x0020U unused */
676
+ #define PNG_FLAG_ROW_INIT 0x0040U
677
+ #define PNG_FLAG_FILLER_AFTER 0x0080U
678
+ #define PNG_FLAG_CRC_ANCILLARY_USE 0x0100U
679
+ #define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200U
680
+ #define PNG_FLAG_CRC_CRITICAL_USE 0x0400U
681
+ #define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800U
682
+ #define PNG_FLAG_ASSUME_sRGB 0x1000U /* Added to libpng-1.5.4 */
683
+ #define PNG_FLAG_OPTIMIZE_ALPHA 0x2000U /* Added to libpng-1.5.4 */
684
+ #define PNG_FLAG_DETECT_UNINITIALIZED 0x4000U /* Added to libpng-1.5.4 */
685
+ /* #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000U */
686
+ /* #define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000U */
687
+ #define PNG_FLAG_LIBRARY_MISMATCH 0x20000U
688
+ #define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000U
689
+ #define PNG_FLAG_STRIP_ERROR_TEXT 0x80000U
690
+ #define PNG_FLAG_BENIGN_ERRORS_WARN 0x100000U /* Added to libpng-1.4.0 */
691
+ #define PNG_FLAG_APP_WARNINGS_WARN 0x200000U /* Added to libpng-1.6.0 */
692
+ #define PNG_FLAG_APP_ERRORS_WARN 0x400000U /* Added to libpng-1.6.0 */
693
+ /* 0x800000U unused */
694
+ /* 0x1000000U unused */
695
+ /* 0x2000000U unused */
696
+ /* 0x4000000U unused */
697
+ /* 0x8000000U unused */
698
+ /* 0x10000000U unused */
699
+ /* 0x20000000U unused */
700
+ /* 0x40000000U unused */
701
+
702
+ #define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
703
+ PNG_FLAG_CRC_ANCILLARY_NOWARN)
704
+
705
+ #define PNG_FLAG_CRC_CRITICAL_MASK (PNG_FLAG_CRC_CRITICAL_USE | \
706
+ PNG_FLAG_CRC_CRITICAL_IGNORE)
707
+
708
+ #define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \
709
+ PNG_FLAG_CRC_CRITICAL_MASK)
710
+
711
+ /* Save typing and make code easier to understand */
712
+
713
+ #define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \
714
+ abs((int)((c1).green) - (int)((c2).green)) + \
715
+ abs((int)((c1).blue) - (int)((c2).blue)))
716
+
717
+ /* Added to libpng-1.6.0: scale a 16-bit value in the range 0..65535 to 0..255
718
+ * by dividing by 257 *with rounding*. This macro is exact for the given range.
719
+ * See the discourse in pngrtran.c png_do_scale_16_to_8. The values in the
720
+ * macro were established by experiment (modifying the added value). The macro
721
+ * has a second variant that takes a value already scaled by 255 and divides by
722
+ * 65535 - this has a maximum error of .502. Over the range 0..65535*65535 it
723
+ * only gives off-by-one errors and only for 0.5% (1 in 200) of the values.
724
+ */
725
+ #define PNG_DIV65535(v24) (((v24) + 32895) >> 16)
726
+ #define PNG_DIV257(v16) PNG_DIV65535((png_uint_32)(v16) * 255)
727
+
728
+ /* Added to libpng-1.2.6 JB */
729
+ #define PNG_ROWBYTES(pixel_bits, width) \
730
+ ((pixel_bits) >= 8 ? \
731
+ ((size_t)(width) * (((size_t)(pixel_bits)) >> 3)) : \
732
+ (( ((size_t)(width) * ((size_t)(pixel_bits))) + 7) >> 3) )
733
+
734
+ /* This returns the number of trailing bits in the last byte of a row, 0 if the
735
+ * last byte is completely full of pixels. It is, in principle, (pixel_bits x
736
+ * width) % 8, but that would overflow for large 'width'. The second macro is
737
+ * the same except that it returns the number of unused bits in the last byte;
738
+ * (8-TRAILBITS), but 0 when TRAILBITS is 0.
739
+ *
740
+ * NOTE: these macros are intended to be self-evidently correct and never
741
+ * overflow on the assumption that pixel_bits is in the range 0..255. The
742
+ * arguments are evaluated only once and they can be signed (e.g. as a result of
743
+ * the integral promotions). The result of the expression always has type
744
+ * (png_uint_32), however the compiler always knows it is in the range 0..7.
745
+ */
746
+ #define PNG_TRAILBITS(pixel_bits, width) \
747
+ (((pixel_bits) * ((width) % (png_uint_32)8)) % 8)
748
+
749
+ #define PNG_PADBITS(pixel_bits, width) \
750
+ ((8 - PNG_TRAILBITS(pixel_bits, width)) % 8)
751
+
752
+ /* PNG_OUT_OF_RANGE returns true if value is outside the range
753
+ * ideal-delta..ideal+delta. Each argument is evaluated twice.
754
+ * "ideal" and "delta" should be constants, normally simple
755
+ * integers, "value" a variable. Added to libpng-1.2.6 JB
756
+ */
757
+ #define PNG_OUT_OF_RANGE(value, ideal, delta) \
758
+ ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
759
+
760
+ /* Conversions between fixed and floating point, only defined if
761
+ * required (to make sure the code doesn't accidentally use float
762
+ * when it is supposedly disabled.)
763
+ */
764
+ #ifdef PNG_FLOATING_POINT_SUPPORTED
765
+ /* The floating point conversion can't overflow, though it can and
766
+ * does lose accuracy relative to the original fixed point value.
767
+ * In practice this doesn't matter because png_fixed_point only
768
+ * stores numbers with very low precision. The png_ptr and s
769
+ * arguments are unused by default but are there in case error
770
+ * checking becomes a requirement.
771
+ */
772
+ #define png_float(png_ptr, fixed, s) (.00001 * (fixed))
773
+
774
+ /* The fixed point conversion performs range checking and evaluates
775
+ * its argument multiple times, so must be used with care. The
776
+ * range checking uses the PNG specification values for a signed
777
+ * 32-bit fixed point value except that the values are deliberately
778
+ * rounded-to-zero to an integral value - 21474 (21474.83 is roughly
779
+ * (2^31-1) * 100000). 's' is a string that describes the value being
780
+ * converted.
781
+ *
782
+ * NOTE: this macro will raise a png_error if the range check fails,
783
+ * therefore it is normally only appropriate to use this on values
784
+ * that come from API calls or other sources where an out of range
785
+ * error indicates a programming error, not a data error!
786
+ *
787
+ * NOTE: by default this is off - the macro is not used - because the
788
+ * function call saves a lot of code.
789
+ */
790
+ #ifdef PNG_FIXED_POINT_MACRO_SUPPORTED
791
+ #define png_fixed(png_ptr, fp, s) ((fp) <= 21474 && (fp) >= -21474 ?\
792
+ ((png_fixed_point)(100000 * (fp))) : (png_fixed_error(png_ptr, s),0))
793
+ #endif
794
+ /* else the corresponding function is defined below, inside the scope of the
795
+ * cplusplus test.
796
+ */
797
+ #endif
798
+
799
+ /* Constants for known chunk types. If you need to add a chunk, define the name
800
+ * here. For historical reasons these constants have the form png_<name>; i.e.
801
+ * the prefix is lower case. Please use decimal values as the parameters to
802
+ * match the ISO PNG specification and to avoid relying on the C locale
803
+ * interpretation of character values.
804
+ *
805
+ * Prior to 1.5.6 these constants were strings, as of 1.5.6 png_uint_32 values
806
+ * are computed and a new macro (PNG_STRING_FROM_CHUNK) added to allow a string
807
+ * to be generated if required.
808
+ *
809
+ * PNG_32b correctly produces a value shifted by up to 24 bits, even on
810
+ * architectures where (int) is only 16 bits.
811
+ */
812
+ #define PNG_32b(b,s) ((png_uint_32)(b) << (s))
813
+ #define PNG_U32(b1,b2,b3,b4) \
814
+ (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
815
+
816
+ /* Constants for known chunk types.
817
+ *
818
+ * MAINTAINERS: If you need to add a chunk, define the name here.
819
+ * For historical reasons these constants have the form png_<name>; i.e.
820
+ * the prefix is lower case. Please use decimal values as the parameters to
821
+ * match the ISO PNG specification and to avoid relying on the C locale
822
+ * interpretation of character values. Please keep the list sorted.
823
+ *
824
+ * Notice that PNG_U32 is used to define a 32-bit value for the 4 byte chunk
825
+ * type. In fact the specification does not express chunk types this way,
826
+ * however using a 32-bit value means that the chunk type can be read from the
827
+ * stream using exactly the same code as used for a 32-bit unsigned value and
828
+ * can be examined far more efficiently (using one arithmetic compare).
829
+ *
830
+ * Prior to 1.5.6 the chunk type constants were expressed as C strings. The
831
+ * libpng API still uses strings for 'unknown' chunks and a macro,
832
+ * PNG_STRING_FROM_CHUNK, allows a string to be generated if required. Notice
833
+ * that for portable code numeric values must still be used; the string "IHDR"
834
+ * is not portable and neither is PNG_U32('I', 'H', 'D', 'R').
835
+ *
836
+ * In 1.7.0 the definitions will be made public in png.h to avoid having to
837
+ * duplicate the same definitions in application code.
838
+ */
839
+ #define png_IDAT PNG_U32( 73, 68, 65, 84)
840
+ #define png_IEND PNG_U32( 73, 69, 78, 68)
841
+ #define png_IHDR PNG_U32( 73, 72, 68, 82)
842
+ #define png_PLTE PNG_U32( 80, 76, 84, 69)
843
+ #define png_bKGD PNG_U32( 98, 75, 71, 68)
844
+ #define png_cHRM PNG_U32( 99, 72, 82, 77)
845
+ #define png_eXIf PNG_U32(101, 88, 73, 102) /* registered July 2017 */
846
+ #define png_fRAc PNG_U32(102, 82, 65, 99) /* registered, not defined */
847
+ #define png_gAMA PNG_U32(103, 65, 77, 65)
848
+ #define png_gIFg PNG_U32(103, 73, 70, 103)
849
+ #define png_gIFt PNG_U32(103, 73, 70, 116) /* deprecated */
850
+ #define png_gIFx PNG_U32(103, 73, 70, 120)
851
+ #define png_hIST PNG_U32(104, 73, 83, 84)
852
+ #define png_iCCP PNG_U32(105, 67, 67, 80)
853
+ #define png_iTXt PNG_U32(105, 84, 88, 116)
854
+ #define png_oFFs PNG_U32(111, 70, 70, 115)
855
+ #define png_pCAL PNG_U32(112, 67, 65, 76)
856
+ #define png_pHYs PNG_U32(112, 72, 89, 115)
857
+ #define png_sBIT PNG_U32(115, 66, 73, 84)
858
+ #define png_sCAL PNG_U32(115, 67, 65, 76)
859
+ #define png_sPLT PNG_U32(115, 80, 76, 84)
860
+ #define png_sRGB PNG_U32(115, 82, 71, 66)
861
+ #define png_sTER PNG_U32(115, 84, 69, 82)
862
+ #define png_tEXt PNG_U32(116, 69, 88, 116)
863
+ #define png_tIME PNG_U32(116, 73, 77, 69)
864
+ #define png_tRNS PNG_U32(116, 82, 78, 83)
865
+ #define png_zTXt PNG_U32(122, 84, 88, 116)
866
+
867
+ /* The following will work on (signed char*) strings, whereas the get_uint_32
868
+ * macro will fail on top-bit-set values because of the sign extension.
869
+ */
870
+ #define PNG_CHUNK_FROM_STRING(s)\
871
+ PNG_U32(0xff & (s)[0], 0xff & (s)[1], 0xff & (s)[2], 0xff & (s)[3])
872
+
873
+ /* This uses (char), not (png_byte) to avoid warnings on systems where (char) is
874
+ * signed and the argument is a (char[]) This macro will fail miserably on
875
+ * systems where (char) is more than 8 bits.
876
+ */
877
+ #define PNG_STRING_FROM_CHUNK(s,c)\
878
+ (void)(((char*)(s))[0]=(char)(((c)>>24) & 0xff), \
879
+ ((char*)(s))[1]=(char)(((c)>>16) & 0xff),\
880
+ ((char*)(s))[2]=(char)(((c)>>8) & 0xff), \
881
+ ((char*)(s))[3]=(char)((c & 0xff)))
882
+
883
+ /* Do the same but terminate with a null character. */
884
+ #define PNG_CSTRING_FROM_CHUNK(s,c)\
885
+ (void)(PNG_STRING_FROM_CHUNK(s,c), ((char*)(s))[4] = 0)
886
+
887
+ /* Test on flag values as defined in the spec (section 5.4): */
888
+ #define PNG_CHUNK_ANCILLARY(c) (1 & ((c) >> 29))
889
+ #define PNG_CHUNK_CRITICAL(c) (!PNG_CHUNK_ANCILLARY(c))
890
+ #define PNG_CHUNK_PRIVATE(c) (1 & ((c) >> 21))
891
+ #define PNG_CHUNK_RESERVED(c) (1 & ((c) >> 13))
892
+ #define PNG_CHUNK_SAFE_TO_COPY(c) (1 & ((c) >> 5))
893
+
894
+ /* Gamma values (new at libpng-1.5.4): */
895
+ #define PNG_GAMMA_MAC_OLD 151724 /* Assume '1.8' is really 2.2/1.45! */
896
+ #define PNG_GAMMA_MAC_INVERSE 65909
897
+ #define PNG_GAMMA_sRGB_INVERSE 45455
898
+
899
+ /* Almost everything below is C specific; the #defines above can be used in
900
+ * non-C code (so long as it is C-preprocessed) the rest of this stuff cannot.
901
+ */
902
+ #ifndef PNG_VERSION_INFO_ONLY
903
+
904
+ #include "pngstruct.h"
905
+ #include "pnginfo.h"
906
+
907
+ /* Validate the include paths - the include path used to generate pnglibconf.h
908
+ * must match that used in the build, or we must be using pnglibconf.h.prebuilt:
909
+ */
910
+ #if PNG_ZLIB_VERNUM != 0 && PNG_ZLIB_VERNUM != ZLIB_VERNUM
911
+ # error ZLIB_VERNUM != PNG_ZLIB_VERNUM \
912
+ "-I (include path) error: see the notes in pngpriv.h"
913
+ /* This means that when pnglibconf.h was built the copy of zlib.h that it
914
+ * used is not the same as the one being used here. Because the build of
915
+ * libpng makes decisions to use inflateInit2 and inflateReset2 based on the
916
+ * zlib version number and because this affects handling of certain broken
917
+ * PNG files the -I directives must match.
918
+ *
919
+ * The most likely explanation is that you passed a -I in CFLAGS. This will
920
+ * not work; all the preprocessor directives and in particular all the -I
921
+ * directives must be in CPPFLAGS.
922
+ */
923
+ #endif
924
+
925
+ /* This is used for 16-bit gamma tables -- only the top level pointers are
926
+ * const; this could be changed:
927
+ */
928
+ typedef const png_uint_16p * png_const_uint_16pp;
929
+
930
+ /* Added to libpng-1.5.7: sRGB conversion tables */
931
+ #if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
932
+ defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
933
+ #ifdef PNG_SIMPLIFIED_READ_SUPPORTED
934
+ PNG_INTERNAL_DATA(const png_uint_16, png_sRGB_table, [256]);
935
+ /* Convert from an sRGB encoded value 0..255 to a 16-bit linear value,
936
+ * 0..65535. This table gives the closest 16-bit answers (no errors).
937
+ */
938
+ #endif
939
+
940
+ PNG_INTERNAL_DATA(const png_uint_16, png_sRGB_base, [512]);
941
+ PNG_INTERNAL_DATA(const png_byte, png_sRGB_delta, [512]);
942
+
943
+ #define PNG_sRGB_FROM_LINEAR(linear) \
944
+ ((png_byte)(0xff & ((png_sRGB_base[(linear)>>15] \
945
+ + ((((linear) & 0x7fff)*png_sRGB_delta[(linear)>>15])>>12)) >> 8)))
946
+ /* Given a value 'linear' in the range 0..255*65535 calculate the 8-bit sRGB
947
+ * encoded value with maximum error 0.646365. Note that the input is not a
948
+ * 16-bit value; it has been multiplied by 255! */
949
+ #endif /* SIMPLIFIED_READ/WRITE */
950
+
951
+
952
+ /* Inhibit C++ name-mangling for libpng functions but not for system calls. */
953
+ #ifdef __cplusplus
954
+ extern "C" {
955
+ #endif /* __cplusplus */
956
+
957
+ /* Internal functions; these are not exported from a DLL however because they
958
+ * are used within several of the C source files they have to be C extern.
959
+ *
960
+ * All of these functions must be declared with PNG_INTERNAL_FUNCTION.
961
+ */
962
+
963
+ /* Zlib support */
964
+ #define PNG_UNEXPECTED_ZLIB_RETURN (-7)
965
+ PNG_INTERNAL_FUNCTION(void, png_zstream_error,(png_structrp png_ptr, int ret),
966
+ PNG_EMPTY);
967
+ /* Used by the zlib handling functions to ensure that z_stream::msg is always
968
+ * set before they return.
969
+ */
970
+
971
+ #ifdef PNG_WRITE_SUPPORTED
972
+ PNG_INTERNAL_FUNCTION(void,png_free_buffer_list,(png_structrp png_ptr,
973
+ png_compression_bufferp *list),PNG_EMPTY);
974
+ /* Free the buffer list used by the compressed write code. */
975
+ #endif
976
+
977
+ #if defined(PNG_FLOATING_POINT_SUPPORTED) && \
978
+ !defined(PNG_FIXED_POINT_MACRO_SUPPORTED) && \
979
+ (defined(PNG_gAMA_SUPPORTED) || defined(PNG_cHRM_SUPPORTED) || \
980
+ defined(PNG_sCAL_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) || \
981
+ defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)) || \
982
+ (defined(PNG_sCAL_SUPPORTED) && \
983
+ defined(PNG_FLOATING_ARITHMETIC_SUPPORTED))
984
+ PNG_INTERNAL_FUNCTION(png_fixed_point,png_fixed,(png_const_structrp png_ptr,
985
+ double fp, png_const_charp text),PNG_EMPTY);
986
+ #endif
987
+
988
+ /* Check the user version string for compatibility, returns false if the version
989
+ * numbers aren't compatible.
990
+ */
991
+ PNG_INTERNAL_FUNCTION(int,png_user_version_check,(png_structrp png_ptr,
992
+ png_const_charp user_png_ver),PNG_EMPTY);
993
+
994
+ /* Internal base allocator - no messages, NULL on failure to allocate. This
995
+ * does, however, call the application provided allocator and that could call
996
+ * png_error (although that would be a bug in the application implementation.)
997
+ */
998
+ PNG_INTERNAL_FUNCTION(png_voidp,png_malloc_base,(png_const_structrp png_ptr,
999
+ png_alloc_size_t size),PNG_ALLOCATED);
1000
+
1001
+ #if defined(PNG_TEXT_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) ||\
1002
+ defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED)
1003
+ /* Internal array allocator, outputs no error or warning messages on failure,
1004
+ * just returns NULL.
1005
+ */
1006
+ PNG_INTERNAL_FUNCTION(png_voidp,png_malloc_array,(png_const_structrp png_ptr,
1007
+ int nelements, size_t element_size),PNG_ALLOCATED);
1008
+
1009
+ /* The same but an existing array is extended by add_elements. This function
1010
+ * also memsets the new elements to 0 and copies the old elements. The old
1011
+ * array is not freed or altered.
1012
+ */
1013
+ PNG_INTERNAL_FUNCTION(png_voidp,png_realloc_array,(png_const_structrp png_ptr,
1014
+ png_const_voidp array, int old_elements, int add_elements,
1015
+ size_t element_size),PNG_ALLOCATED);
1016
+ #endif /* text, sPLT or unknown chunks */
1017
+
1018
+ /* Magic to create a struct when there is no struct to call the user supplied
1019
+ * memory allocators. Because error handling has not been set up the memory
1020
+ * handlers can't safely call png_error, but this is an obscure and undocumented
1021
+ * restriction so libpng has to assume that the 'free' handler, at least, might
1022
+ * call png_error.
1023
+ */
1024
+ PNG_INTERNAL_FUNCTION(png_structp,png_create_png_struct,
1025
+ (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn,
1026
+ png_error_ptr warn_fn, png_voidp mem_ptr, png_malloc_ptr malloc_fn,
1027
+ png_free_ptr free_fn),PNG_ALLOCATED);
1028
+
1029
+ /* Free memory from internal libpng struct */
1030
+ PNG_INTERNAL_FUNCTION(void,png_destroy_png_struct,(png_structrp png_ptr),
1031
+ PNG_EMPTY);
1032
+
1033
+ /* Free an allocated jmp_buf (always succeeds) */
1034
+ PNG_INTERNAL_FUNCTION(void,png_free_jmpbuf,(png_structrp png_ptr),PNG_EMPTY);
1035
+
1036
+ /* Function to allocate memory for zlib. PNGAPI is disallowed. */
1037
+ PNG_INTERNAL_FUNCTION(voidpf,png_zalloc,(voidpf png_ptr, uInt items, uInt size),
1038
+ PNG_ALLOCATED);
1039
+
1040
+ /* Function to free memory for zlib. PNGAPI is disallowed. */
1041
+ PNG_INTERNAL_FUNCTION(void,png_zfree,(voidpf png_ptr, voidpf ptr),PNG_EMPTY);
1042
+
1043
+ /* Next four functions are used internally as callbacks. PNGCBAPI is required
1044
+ * but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3, changed to
1045
+ * PNGCBAPI at 1.5.0
1046
+ */
1047
+
1048
+ PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_default_read_data,(png_structp png_ptr,
1049
+ png_bytep data, size_t length),PNG_EMPTY);
1050
+
1051
+ #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
1052
+ PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_push_fill_buffer,(png_structp png_ptr,
1053
+ png_bytep buffer, size_t length),PNG_EMPTY);
1054
+ #endif
1055
+
1056
+ PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_default_write_data,(png_structp png_ptr,
1057
+ png_bytep data, size_t length),PNG_EMPTY);
1058
+
1059
+ #ifdef PNG_WRITE_FLUSH_SUPPORTED
1060
+ # ifdef PNG_STDIO_SUPPORTED
1061
+ PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_default_flush,(png_structp png_ptr),
1062
+ PNG_EMPTY);
1063
+ # endif
1064
+ #endif
1065
+
1066
+ /* Reset the CRC variable */
1067
+ PNG_INTERNAL_FUNCTION(void,png_reset_crc,(png_structrp png_ptr),PNG_EMPTY);
1068
+
1069
+ /* Write the "data" buffer to whatever output you are using */
1070
+ PNG_INTERNAL_FUNCTION(void,png_write_data,(png_structrp png_ptr,
1071
+ png_const_bytep data, size_t length),PNG_EMPTY);
1072
+
1073
+ /* Read and check the PNG file signature */
1074
+ PNG_INTERNAL_FUNCTION(void,png_read_sig,(png_structrp png_ptr,
1075
+ png_inforp info_ptr),PNG_EMPTY);
1076
+
1077
+ /* Read the chunk header (length + type name) */
1078
+ PNG_INTERNAL_FUNCTION(png_uint_32,png_read_chunk_header,(png_structrp png_ptr),
1079
+ PNG_EMPTY);
1080
+
1081
+ /* Read data from whatever input you are using into the "data" buffer */
1082
+ PNG_INTERNAL_FUNCTION(void,png_read_data,(png_structrp png_ptr, png_bytep data,
1083
+ size_t length),PNG_EMPTY);
1084
+
1085
+ /* Read bytes into buf, and update png_ptr->crc */
1086
+ PNG_INTERNAL_FUNCTION(void,png_crc_read,(png_structrp png_ptr, png_bytep buf,
1087
+ png_uint_32 length),PNG_EMPTY);
1088
+
1089
+ /* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
1090
+ PNG_INTERNAL_FUNCTION(int,png_crc_finish,(png_structrp png_ptr,
1091
+ png_uint_32 skip),PNG_EMPTY);
1092
+
1093
+ /* Read the CRC from the file and compare it to the libpng calculated CRC */
1094
+ PNG_INTERNAL_FUNCTION(int,png_crc_error,(png_structrp png_ptr),PNG_EMPTY);
1095
+
1096
+ /* Calculate the CRC over a section of data. Note that we are only
1097
+ * passing a maximum of 64K on systems that have this as a memory limit,
1098
+ * since this is the maximum buffer size we can specify.
1099
+ */
1100
+ PNG_INTERNAL_FUNCTION(void,png_calculate_crc,(png_structrp png_ptr,
1101
+ png_const_bytep ptr, size_t length),PNG_EMPTY);
1102
+
1103
+ #ifdef PNG_WRITE_FLUSH_SUPPORTED
1104
+ PNG_INTERNAL_FUNCTION(void,png_flush,(png_structrp png_ptr),PNG_EMPTY);
1105
+ #endif
1106
+
1107
+ /* Write various chunks */
1108
+
1109
+ /* Write the IHDR chunk, and update the png_struct with the necessary
1110
+ * information.
1111
+ */
1112
+ PNG_INTERNAL_FUNCTION(void,png_write_IHDR,(png_structrp png_ptr,
1113
+ png_uint_32 width, png_uint_32 height, int bit_depth, int color_type,
1114
+ int compression_method, int filter_method, int interlace_method),PNG_EMPTY);
1115
+
1116
+ PNG_INTERNAL_FUNCTION(void,png_write_PLTE,(png_structrp png_ptr,
1117
+ png_const_colorp palette, png_uint_32 num_pal),PNG_EMPTY);
1118
+
1119
+ PNG_INTERNAL_FUNCTION(void,png_compress_IDAT,(png_structrp png_ptr,
1120
+ png_const_bytep row_data, png_alloc_size_t row_data_length, int flush),
1121
+ PNG_EMPTY);
1122
+
1123
+ PNG_INTERNAL_FUNCTION(void,png_write_IEND,(png_structrp png_ptr),PNG_EMPTY);
1124
+
1125
+ #ifdef PNG_WRITE_gAMA_SUPPORTED
1126
+ PNG_INTERNAL_FUNCTION(void,png_write_gAMA_fixed,(png_structrp png_ptr,
1127
+ png_fixed_point file_gamma),PNG_EMPTY);
1128
+ #endif
1129
+
1130
+ #ifdef PNG_WRITE_sBIT_SUPPORTED
1131
+ PNG_INTERNAL_FUNCTION(void,png_write_sBIT,(png_structrp png_ptr,
1132
+ png_const_color_8p sbit, int color_type),PNG_EMPTY);
1133
+ #endif
1134
+
1135
+ #ifdef PNG_WRITE_cHRM_SUPPORTED
1136
+ PNG_INTERNAL_FUNCTION(void,png_write_cHRM_fixed,(png_structrp png_ptr,
1137
+ const png_xy *xy), PNG_EMPTY);
1138
+ /* The xy value must have been previously validated */
1139
+ #endif
1140
+
1141
+ #ifdef PNG_WRITE_sRGB_SUPPORTED
1142
+ PNG_INTERNAL_FUNCTION(void,png_write_sRGB,(png_structrp png_ptr,
1143
+ int intent),PNG_EMPTY);
1144
+ #endif
1145
+
1146
+ #ifdef PNG_WRITE_eXIf_SUPPORTED
1147
+ PNG_INTERNAL_FUNCTION(void,png_write_eXIf,(png_structrp png_ptr,
1148
+ png_bytep exif, int num_exif),PNG_EMPTY);
1149
+ #endif
1150
+
1151
+ #ifdef PNG_WRITE_iCCP_SUPPORTED
1152
+ PNG_INTERNAL_FUNCTION(void,png_write_iCCP,(png_structrp png_ptr,
1153
+ png_const_charp name, png_const_bytep profile), PNG_EMPTY);
1154
+ /* The profile must have been previously validated for correctness, the
1155
+ * length comes from the first four bytes. Only the base, deflate,
1156
+ * compression is supported.
1157
+ */
1158
+ #endif
1159
+
1160
+ #ifdef PNG_WRITE_sPLT_SUPPORTED
1161
+ PNG_INTERNAL_FUNCTION(void,png_write_sPLT,(png_structrp png_ptr,
1162
+ png_const_sPLT_tp palette),PNG_EMPTY);
1163
+ #endif
1164
+
1165
+ #ifdef PNG_WRITE_tRNS_SUPPORTED
1166
+ PNG_INTERNAL_FUNCTION(void,png_write_tRNS,(png_structrp png_ptr,
1167
+ png_const_bytep trans, png_const_color_16p values, int number,
1168
+ int color_type),PNG_EMPTY);
1169
+ #endif
1170
+
1171
+ #ifdef PNG_WRITE_bKGD_SUPPORTED
1172
+ PNG_INTERNAL_FUNCTION(void,png_write_bKGD,(png_structrp png_ptr,
1173
+ png_const_color_16p values, int color_type),PNG_EMPTY);
1174
+ #endif
1175
+
1176
+ #ifdef PNG_WRITE_hIST_SUPPORTED
1177
+ PNG_INTERNAL_FUNCTION(void,png_write_hIST,(png_structrp png_ptr,
1178
+ png_const_uint_16p hist, int num_hist),PNG_EMPTY);
1179
+ #endif
1180
+
1181
+ /* Chunks that have keywords */
1182
+ #ifdef PNG_WRITE_tEXt_SUPPORTED
1183
+ PNG_INTERNAL_FUNCTION(void,png_write_tEXt,(png_structrp png_ptr,
1184
+ png_const_charp key, png_const_charp text, size_t text_len),PNG_EMPTY);
1185
+ #endif
1186
+
1187
+ #ifdef PNG_WRITE_zTXt_SUPPORTED
1188
+ PNG_INTERNAL_FUNCTION(void,png_write_zTXt,(png_structrp png_ptr, png_const_charp
1189
+ key, png_const_charp text, int compression),PNG_EMPTY);
1190
+ #endif
1191
+
1192
+ #ifdef PNG_WRITE_iTXt_SUPPORTED
1193
+ PNG_INTERNAL_FUNCTION(void,png_write_iTXt,(png_structrp png_ptr,
1194
+ int compression, png_const_charp key, png_const_charp lang,
1195
+ png_const_charp lang_key, png_const_charp text),PNG_EMPTY);
1196
+ #endif
1197
+
1198
+ #ifdef PNG_TEXT_SUPPORTED /* Added at version 1.0.14 and 1.2.4 */
1199
+ PNG_INTERNAL_FUNCTION(int,png_set_text_2,(png_const_structrp png_ptr,
1200
+ png_inforp info_ptr, png_const_textp text_ptr, int num_text),PNG_EMPTY);
1201
+ #endif
1202
+
1203
+ #ifdef PNG_WRITE_oFFs_SUPPORTED
1204
+ PNG_INTERNAL_FUNCTION(void,png_write_oFFs,(png_structrp png_ptr,
1205
+ png_int_32 x_offset, png_int_32 y_offset, int unit_type),PNG_EMPTY);
1206
+ #endif
1207
+
1208
+ #ifdef PNG_WRITE_pCAL_SUPPORTED
1209
+ PNG_INTERNAL_FUNCTION(void,png_write_pCAL,(png_structrp png_ptr,
1210
+ png_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams,
1211
+ png_const_charp units, png_charpp params),PNG_EMPTY);
1212
+ #endif
1213
+
1214
+ #ifdef PNG_WRITE_pHYs_SUPPORTED
1215
+ PNG_INTERNAL_FUNCTION(void,png_write_pHYs,(png_structrp png_ptr,
1216
+ png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit,
1217
+ int unit_type),PNG_EMPTY);
1218
+ #endif
1219
+
1220
+ #ifdef PNG_WRITE_tIME_SUPPORTED
1221
+ PNG_INTERNAL_FUNCTION(void,png_write_tIME,(png_structrp png_ptr,
1222
+ png_const_timep mod_time),PNG_EMPTY);
1223
+ #endif
1224
+
1225
+ #ifdef PNG_WRITE_sCAL_SUPPORTED
1226
+ PNG_INTERNAL_FUNCTION(void,png_write_sCAL_s,(png_structrp png_ptr,
1227
+ int unit, png_const_charp width, png_const_charp height),PNG_EMPTY);
1228
+ #endif
1229
+
1230
+ /* Called when finished processing a row of data */
1231
+ PNG_INTERNAL_FUNCTION(void,png_write_finish_row,(png_structrp png_ptr),
1232
+ PNG_EMPTY);
1233
+
1234
+ /* Internal use only. Called before first row of data */
1235
+ PNG_INTERNAL_FUNCTION(void,png_write_start_row,(png_structrp png_ptr),
1236
+ PNG_EMPTY);
1237
+
1238
+ /* Combine a row of data, dealing with alpha, etc. if requested. 'row' is an
1239
+ * array of png_ptr->width pixels. If the image is not interlaced or this
1240
+ * is the final pass this just does a memcpy, otherwise the "display" flag
1241
+ * is used to determine whether to copy pixels that are not in the current pass.
1242
+ *
1243
+ * Because 'png_do_read_interlace' (below) replicates pixels this allows this
1244
+ * function to achieve the documented 'blocky' appearance during interlaced read
1245
+ * if display is 1 and the 'sparkle' appearance, where existing pixels in 'row'
1246
+ * are not changed if they are not in the current pass, when display is 0.
1247
+ *
1248
+ * 'display' must be 0 or 1, otherwise the memcpy will be done regardless.
1249
+ *
1250
+ * The API always reads from the png_struct row buffer and always assumes that
1251
+ * it is full width (png_do_read_interlace has already been called.)
1252
+ *
1253
+ * This function is only ever used to write to row buffers provided by the
1254
+ * caller of the relevant libpng API and the row must have already been
1255
+ * transformed by the read transformations.
1256
+ *
1257
+ * The PNG_USE_COMPILE_TIME_MASKS option causes generation of pre-computed
1258
+ * bitmasks for use within the code, otherwise runtime generated masks are used.
1259
+ * The default is compile time masks.
1260
+ */
1261
+ #ifndef PNG_USE_COMPILE_TIME_MASKS
1262
+ # define PNG_USE_COMPILE_TIME_MASKS 1
1263
+ #endif
1264
+ PNG_INTERNAL_FUNCTION(void,png_combine_row,(png_const_structrp png_ptr,
1265
+ png_bytep row, int display),PNG_EMPTY);
1266
+
1267
+ #ifdef PNG_READ_INTERLACING_SUPPORTED
1268
+ /* Expand an interlaced row: the 'row_info' describes the pass data that has
1269
+ * been read in and must correspond to the pixels in 'row', the pixels are
1270
+ * expanded (moved apart) in 'row' to match the final layout, when doing this
1271
+ * the pixels are *replicated* to the intervening space. This is essential for
1272
+ * the correct operation of png_combine_row, above.
1273
+ */
1274
+ PNG_INTERNAL_FUNCTION(void,png_do_read_interlace,(png_row_infop row_info,
1275
+ png_bytep row, int pass, png_uint_32 transformations),PNG_EMPTY);
1276
+ #endif
1277
+
1278
+ /* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */
1279
+
1280
+ #ifdef PNG_WRITE_INTERLACING_SUPPORTED
1281
+ /* Grab pixels out of a row for an interlaced pass */
1282
+ PNG_INTERNAL_FUNCTION(void,png_do_write_interlace,(png_row_infop row_info,
1283
+ png_bytep row, int pass),PNG_EMPTY);
1284
+ #endif
1285
+
1286
+ /* Unfilter a row: check the filter value before calling this, there is no point
1287
+ * calling it for PNG_FILTER_VALUE_NONE.
1288
+ */
1289
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row,(png_structrp pp, png_row_infop
1290
+ row_info, png_bytep row, png_const_bytep prev_row, int filter),PNG_EMPTY);
1291
+
1292
+ #if PNG_ARM_NEON_OPT > 0
1293
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_neon,(png_row_infop row_info,
1294
+ png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1295
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_neon,(png_row_infop
1296
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1297
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_neon,(png_row_infop
1298
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1299
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_neon,(png_row_infop
1300
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1301
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_neon,(png_row_infop
1302
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1303
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_neon,(png_row_infop
1304
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1305
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_neon,(png_row_infop
1306
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1307
+ #endif
1308
+
1309
+ #if PNG_MIPS_MSA_OPT > 0
1310
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_msa,(png_row_infop row_info,
1311
+ png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1312
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_msa,(png_row_infop
1313
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1314
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_msa,(png_row_infop
1315
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1316
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_msa,(png_row_infop
1317
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1318
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_msa,(png_row_infop
1319
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1320
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_msa,(png_row_infop
1321
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1322
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_msa,(png_row_infop
1323
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1324
+ #endif
1325
+
1326
+ #if PNG_POWERPC_VSX_OPT > 0
1327
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_vsx,(png_row_infop row_info,
1328
+ png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1329
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_vsx,(png_row_infop
1330
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1331
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_vsx,(png_row_infop
1332
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1333
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_vsx,(png_row_infop
1334
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1335
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_vsx,(png_row_infop
1336
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1337
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_vsx,(png_row_infop
1338
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1339
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_vsx,(png_row_infop
1340
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1341
+ #endif
1342
+
1343
+ #if PNG_INTEL_SSE_IMPLEMENTATION > 0
1344
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_sse2,(png_row_infop
1345
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1346
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_sse2,(png_row_infop
1347
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1348
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_sse2,(png_row_infop
1349
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1350
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_sse2,(png_row_infop
1351
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1352
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_sse2,(png_row_infop
1353
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1354
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_sse2,(png_row_infop
1355
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1356
+ #endif
1357
+
1358
+ /* Choose the best filter to use and filter the row data */
1359
+ PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr,
1360
+ png_row_infop row_info),PNG_EMPTY);
1361
+
1362
+ #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
1363
+ PNG_INTERNAL_FUNCTION(void,png_read_IDAT_data,(png_structrp png_ptr,
1364
+ png_bytep output, png_alloc_size_t avail_out),PNG_EMPTY);
1365
+ /* Read 'avail_out' bytes of data from the IDAT stream. If the output buffer
1366
+ * is NULL the function checks, instead, for the end of the stream. In this
1367
+ * case a benign error will be issued if the stream end is not found or if
1368
+ * extra data has to be consumed.
1369
+ */
1370
+ PNG_INTERNAL_FUNCTION(void,png_read_finish_IDAT,(png_structrp png_ptr),
1371
+ PNG_EMPTY);
1372
+ /* This cleans up when the IDAT LZ stream does not end when the last image
1373
+ * byte is read; there is still some pending input.
1374
+ */
1375
+
1376
+ PNG_INTERNAL_FUNCTION(void,png_read_finish_row,(png_structrp png_ptr),
1377
+ PNG_EMPTY);
1378
+ /* Finish a row while reading, dealing with interlacing passes, etc. */
1379
+ #endif /* SEQUENTIAL_READ */
1380
+
1381
+ /* Initialize the row buffers, etc. */
1382
+ PNG_INTERNAL_FUNCTION(void,png_read_start_row,(png_structrp png_ptr),PNG_EMPTY);
1383
+
1384
+ #if ZLIB_VERNUM >= 0x1240
1385
+ PNG_INTERNAL_FUNCTION(int,png_zlib_inflate,(png_structrp png_ptr, int flush),
1386
+ PNG_EMPTY);
1387
+ # define PNG_INFLATE(pp, flush) png_zlib_inflate(pp, flush)
1388
+ #else /* Zlib < 1.2.4 */
1389
+ # define PNG_INFLATE(pp, flush) inflate(&(pp)->zstream, flush)
1390
+ #endif /* Zlib < 1.2.4 */
1391
+
1392
+ #ifdef PNG_READ_TRANSFORMS_SUPPORTED
1393
+ /* Optional call to update the users info structure */
1394
+ PNG_INTERNAL_FUNCTION(void,png_read_transform_info,(png_structrp png_ptr,
1395
+ png_inforp info_ptr),PNG_EMPTY);
1396
+ #endif
1397
+
1398
+ /* Shared transform functions, defined in pngtran.c */
1399
+ #if defined(PNG_WRITE_FILLER_SUPPORTED) || \
1400
+ defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
1401
+ PNG_INTERNAL_FUNCTION(void,png_do_strip_channel,(png_row_infop row_info,
1402
+ png_bytep row, int at_start),PNG_EMPTY);
1403
+ #endif
1404
+
1405
+ #ifdef PNG_16BIT_SUPPORTED
1406
+ #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
1407
+ PNG_INTERNAL_FUNCTION(void,png_do_swap,(png_row_infop row_info,
1408
+ png_bytep row),PNG_EMPTY);
1409
+ #endif
1410
+ #endif
1411
+
1412
+ #if defined(PNG_READ_PACKSWAP_SUPPORTED) || \
1413
+ defined(PNG_WRITE_PACKSWAP_SUPPORTED)
1414
+ PNG_INTERNAL_FUNCTION(void,png_do_packswap,(png_row_infop row_info,
1415
+ png_bytep row),PNG_EMPTY);
1416
+ #endif
1417
+
1418
+ #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
1419
+ PNG_INTERNAL_FUNCTION(void,png_do_invert,(png_row_infop row_info,
1420
+ png_bytep row),PNG_EMPTY);
1421
+ #endif
1422
+
1423
+ #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
1424
+ PNG_INTERNAL_FUNCTION(void,png_do_bgr,(png_row_infop row_info,
1425
+ png_bytep row),PNG_EMPTY);
1426
+ #endif
1427
+
1428
+ /* The following decodes the appropriate chunks, and does error correction,
1429
+ * then calls the appropriate callback for the chunk if it is valid.
1430
+ */
1431
+
1432
+ /* Decode the IHDR chunk */
1433
+ PNG_INTERNAL_FUNCTION(void,png_handle_IHDR,(png_structrp png_ptr,
1434
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1435
+ PNG_INTERNAL_FUNCTION(void,png_handle_PLTE,(png_structrp png_ptr,
1436
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1437
+ PNG_INTERNAL_FUNCTION(void,png_handle_IEND,(png_structrp png_ptr,
1438
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1439
+
1440
+ #ifdef PNG_READ_bKGD_SUPPORTED
1441
+ PNG_INTERNAL_FUNCTION(void,png_handle_bKGD,(png_structrp png_ptr,
1442
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1443
+ #endif
1444
+
1445
+ #ifdef PNG_READ_cHRM_SUPPORTED
1446
+ PNG_INTERNAL_FUNCTION(void,png_handle_cHRM,(png_structrp png_ptr,
1447
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1448
+ #endif
1449
+
1450
+ #ifdef PNG_READ_eXIf_SUPPORTED
1451
+ PNG_INTERNAL_FUNCTION(void,png_handle_eXIf,(png_structrp png_ptr,
1452
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1453
+ #endif
1454
+
1455
+ #ifdef PNG_READ_gAMA_SUPPORTED
1456
+ PNG_INTERNAL_FUNCTION(void,png_handle_gAMA,(png_structrp png_ptr,
1457
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1458
+ #endif
1459
+
1460
+ #ifdef PNG_READ_hIST_SUPPORTED
1461
+ PNG_INTERNAL_FUNCTION(void,png_handle_hIST,(png_structrp png_ptr,
1462
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1463
+ #endif
1464
+
1465
+ #ifdef PNG_READ_iCCP_SUPPORTED
1466
+ PNG_INTERNAL_FUNCTION(void,png_handle_iCCP,(png_structrp png_ptr,
1467
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1468
+ #endif /* READ_iCCP */
1469
+
1470
+ #ifdef PNG_READ_iTXt_SUPPORTED
1471
+ PNG_INTERNAL_FUNCTION(void,png_handle_iTXt,(png_structrp png_ptr,
1472
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1473
+ #endif
1474
+
1475
+ #ifdef PNG_READ_oFFs_SUPPORTED
1476
+ PNG_INTERNAL_FUNCTION(void,png_handle_oFFs,(png_structrp png_ptr,
1477
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1478
+ #endif
1479
+
1480
+ #ifdef PNG_READ_pCAL_SUPPORTED
1481
+ PNG_INTERNAL_FUNCTION(void,png_handle_pCAL,(png_structrp png_ptr,
1482
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1483
+ #endif
1484
+
1485
+ #ifdef PNG_READ_pHYs_SUPPORTED
1486
+ PNG_INTERNAL_FUNCTION(void,png_handle_pHYs,(png_structrp png_ptr,
1487
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1488
+ #endif
1489
+
1490
+ #ifdef PNG_READ_sBIT_SUPPORTED
1491
+ PNG_INTERNAL_FUNCTION(void,png_handle_sBIT,(png_structrp png_ptr,
1492
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1493
+ #endif
1494
+
1495
+ #ifdef PNG_READ_sCAL_SUPPORTED
1496
+ PNG_INTERNAL_FUNCTION(void,png_handle_sCAL,(png_structrp png_ptr,
1497
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1498
+ #endif
1499
+
1500
+ #ifdef PNG_READ_sPLT_SUPPORTED
1501
+ PNG_INTERNAL_FUNCTION(void,png_handle_sPLT,(png_structrp png_ptr,
1502
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1503
+ #endif /* READ_sPLT */
1504
+
1505
+ #ifdef PNG_READ_sRGB_SUPPORTED
1506
+ PNG_INTERNAL_FUNCTION(void,png_handle_sRGB,(png_structrp png_ptr,
1507
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1508
+ #endif
1509
+
1510
+ #ifdef PNG_READ_tEXt_SUPPORTED
1511
+ PNG_INTERNAL_FUNCTION(void,png_handle_tEXt,(png_structrp png_ptr,
1512
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1513
+ #endif
1514
+
1515
+ #ifdef PNG_READ_tIME_SUPPORTED
1516
+ PNG_INTERNAL_FUNCTION(void,png_handle_tIME,(png_structrp png_ptr,
1517
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1518
+ #endif
1519
+
1520
+ #ifdef PNG_READ_tRNS_SUPPORTED
1521
+ PNG_INTERNAL_FUNCTION(void,png_handle_tRNS,(png_structrp png_ptr,
1522
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1523
+ #endif
1524
+
1525
+ #ifdef PNG_READ_zTXt_SUPPORTED
1526
+ PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr,
1527
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1528
+ #endif
1529
+
1530
+ PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_const_structrp png_ptr,
1531
+ png_uint_32 chunk_name),PNG_EMPTY);
1532
+
1533
+ PNG_INTERNAL_FUNCTION(void,png_check_chunk_length,(png_const_structrp png_ptr,
1534
+ png_uint_32 chunk_length),PNG_EMPTY);
1535
+
1536
+ PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr,
1537
+ png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY);
1538
+ /* This is the function that gets called for unknown chunks. The 'keep'
1539
+ * argument is either non-zero for a known chunk that has been set to be
1540
+ * handled as unknown or zero for an unknown chunk. By default the function
1541
+ * just skips the chunk or errors out if it is critical.
1542
+ */
1543
+
1544
+ #if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) ||\
1545
+ defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
1546
+ PNG_INTERNAL_FUNCTION(int,png_chunk_unknown_handling,
1547
+ (png_const_structrp png_ptr, png_uint_32 chunk_name),PNG_EMPTY);
1548
+ /* Exactly as the API png_handle_as_unknown() except that the argument is a
1549
+ * 32-bit chunk name, not a string.
1550
+ */
1551
+ #endif /* READ_UNKNOWN_CHUNKS || HANDLE_AS_UNKNOWN */
1552
+
1553
+ /* Handle the transformations for reading and writing */
1554
+ #ifdef PNG_READ_TRANSFORMS_SUPPORTED
1555
+ PNG_INTERNAL_FUNCTION(void,png_do_read_transformations,(png_structrp png_ptr,
1556
+ png_row_infop row_info),PNG_EMPTY);
1557
+ #endif
1558
+ #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
1559
+ PNG_INTERNAL_FUNCTION(void,png_do_write_transformations,(png_structrp png_ptr,
1560
+ png_row_infop row_info),PNG_EMPTY);
1561
+ #endif
1562
+
1563
+ #ifdef PNG_READ_TRANSFORMS_SUPPORTED
1564
+ PNG_INTERNAL_FUNCTION(void,png_init_read_transformations,(png_structrp png_ptr),
1565
+ PNG_EMPTY);
1566
+ #endif
1567
+
1568
+ #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
1569
+ PNG_INTERNAL_FUNCTION(void,png_push_read_chunk,(png_structrp png_ptr,
1570
+ png_inforp info_ptr),PNG_EMPTY);
1571
+ PNG_INTERNAL_FUNCTION(void,png_push_read_sig,(png_structrp png_ptr,
1572
+ png_inforp info_ptr),PNG_EMPTY);
1573
+ PNG_INTERNAL_FUNCTION(void,png_push_check_crc,(png_structrp png_ptr),PNG_EMPTY);
1574
+ PNG_INTERNAL_FUNCTION(void,png_push_save_buffer,(png_structrp png_ptr),
1575
+ PNG_EMPTY);
1576
+ PNG_INTERNAL_FUNCTION(void,png_push_restore_buffer,(png_structrp png_ptr,
1577
+ png_bytep buffer, size_t buffer_length),PNG_EMPTY);
1578
+ PNG_INTERNAL_FUNCTION(void,png_push_read_IDAT,(png_structrp png_ptr),PNG_EMPTY);
1579
+ PNG_INTERNAL_FUNCTION(void,png_process_IDAT_data,(png_structrp png_ptr,
1580
+ png_bytep buffer, size_t buffer_length),PNG_EMPTY);
1581
+ PNG_INTERNAL_FUNCTION(void,png_push_process_row,(png_structrp png_ptr),
1582
+ PNG_EMPTY);
1583
+ PNG_INTERNAL_FUNCTION(void,png_push_handle_unknown,(png_structrp png_ptr,
1584
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1585
+ PNG_INTERNAL_FUNCTION(void,png_push_have_info,(png_structrp png_ptr,
1586
+ png_inforp info_ptr),PNG_EMPTY);
1587
+ PNG_INTERNAL_FUNCTION(void,png_push_have_end,(png_structrp png_ptr,
1588
+ png_inforp info_ptr),PNG_EMPTY);
1589
+ PNG_INTERNAL_FUNCTION(void,png_push_have_row,(png_structrp png_ptr,
1590
+ png_bytep row),PNG_EMPTY);
1591
+ PNG_INTERNAL_FUNCTION(void,png_push_read_end,(png_structrp png_ptr,
1592
+ png_inforp info_ptr),PNG_EMPTY);
1593
+ PNG_INTERNAL_FUNCTION(void,png_process_some_data,(png_structrp png_ptr,
1594
+ png_inforp info_ptr),PNG_EMPTY);
1595
+ PNG_INTERNAL_FUNCTION(void,png_read_push_finish_row,(png_structrp png_ptr),
1596
+ PNG_EMPTY);
1597
+ # ifdef PNG_READ_tEXt_SUPPORTED
1598
+ PNG_INTERNAL_FUNCTION(void,png_push_handle_tEXt,(png_structrp png_ptr,
1599
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1600
+ PNG_INTERNAL_FUNCTION(void,png_push_read_tEXt,(png_structrp png_ptr,
1601
+ png_inforp info_ptr),PNG_EMPTY);
1602
+ # endif
1603
+ # ifdef PNG_READ_zTXt_SUPPORTED
1604
+ PNG_INTERNAL_FUNCTION(void,png_push_handle_zTXt,(png_structrp png_ptr,
1605
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1606
+ PNG_INTERNAL_FUNCTION(void,png_push_read_zTXt,(png_structrp png_ptr,
1607
+ png_inforp info_ptr),PNG_EMPTY);
1608
+ # endif
1609
+ # ifdef PNG_READ_iTXt_SUPPORTED
1610
+ PNG_INTERNAL_FUNCTION(void,png_push_handle_iTXt,(png_structrp png_ptr,
1611
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1612
+ PNG_INTERNAL_FUNCTION(void,png_push_read_iTXt,(png_structrp png_ptr,
1613
+ png_inforp info_ptr),PNG_EMPTY);
1614
+ # endif
1615
+
1616
+ #endif /* PROGRESSIVE_READ */
1617
+
1618
+ /* Added at libpng version 1.6.0 */
1619
+ #ifdef PNG_GAMMA_SUPPORTED
1620
+ PNG_INTERNAL_FUNCTION(void,png_colorspace_set_gamma,(png_const_structrp png_ptr,
1621
+ png_colorspacerp colorspace, png_fixed_point gAMA), PNG_EMPTY);
1622
+ /* Set the colorspace gamma with a value provided by the application or by
1623
+ * the gAMA chunk on read. The value will override anything set by an ICC
1624
+ * profile.
1625
+ */
1626
+
1627
+ PNG_INTERNAL_FUNCTION(void,png_colorspace_sync_info,(png_const_structrp png_ptr,
1628
+ png_inforp info_ptr), PNG_EMPTY);
1629
+ /* Synchronize the info 'valid' flags with the colorspace */
1630
+
1631
+ PNG_INTERNAL_FUNCTION(void,png_colorspace_sync,(png_const_structrp png_ptr,
1632
+ png_inforp info_ptr), PNG_EMPTY);
1633
+ /* Copy the png_struct colorspace to the info_struct and call the above to
1634
+ * synchronize the flags. Checks for NULL info_ptr and does nothing.
1635
+ */
1636
+ #endif
1637
+
1638
+ /* Added at libpng version 1.4.0 */
1639
+ #ifdef PNG_COLORSPACE_SUPPORTED
1640
+ /* These internal functions are for maintaining the colorspace structure within
1641
+ * a png_info or png_struct (or, indeed, both).
1642
+ */
1643
+ PNG_INTERNAL_FUNCTION(int,png_colorspace_set_chromaticities,
1644
+ (png_const_structrp png_ptr, png_colorspacerp colorspace, const png_xy *xy,
1645
+ int preferred), PNG_EMPTY);
1646
+
1647
+ PNG_INTERNAL_FUNCTION(int,png_colorspace_set_endpoints,
1648
+ (png_const_structrp png_ptr, png_colorspacerp colorspace, const png_XYZ *XYZ,
1649
+ int preferred), PNG_EMPTY);
1650
+
1651
+ #ifdef PNG_sRGB_SUPPORTED
1652
+ PNG_INTERNAL_FUNCTION(int,png_colorspace_set_sRGB,(png_const_structrp png_ptr,
1653
+ png_colorspacerp colorspace, int intent), PNG_EMPTY);
1654
+ /* This does set the colorspace gAMA and cHRM values too, but doesn't set the
1655
+ * flags to write them, if it returns false there was a problem and an error
1656
+ * message has already been output (but the colorspace may still need to be
1657
+ * synced to record the invalid flag).
1658
+ */
1659
+ #endif /* sRGB */
1660
+
1661
+ #ifdef PNG_iCCP_SUPPORTED
1662
+ PNG_INTERNAL_FUNCTION(int,png_colorspace_set_ICC,(png_const_structrp png_ptr,
1663
+ png_colorspacerp colorspace, png_const_charp name,
1664
+ png_uint_32 profile_length, png_const_bytep profile, int color_type),
1665
+ PNG_EMPTY);
1666
+ /* The 'name' is used for information only */
1667
+
1668
+ /* Routines for checking parts of an ICC profile. */
1669
+ #ifdef PNG_READ_iCCP_SUPPORTED
1670
+ PNG_INTERNAL_FUNCTION(int,png_icc_check_length,(png_const_structrp png_ptr,
1671
+ png_colorspacerp colorspace, png_const_charp name,
1672
+ png_uint_32 profile_length), PNG_EMPTY);
1673
+ #endif /* READ_iCCP */
1674
+ PNG_INTERNAL_FUNCTION(int,png_icc_check_header,(png_const_structrp png_ptr,
1675
+ png_colorspacerp colorspace, png_const_charp name,
1676
+ png_uint_32 profile_length,
1677
+ png_const_bytep profile /* first 132 bytes only */, int color_type),
1678
+ PNG_EMPTY);
1679
+ PNG_INTERNAL_FUNCTION(int,png_icc_check_tag_table,(png_const_structrp png_ptr,
1680
+ png_colorspacerp colorspace, png_const_charp name,
1681
+ png_uint_32 profile_length,
1682
+ png_const_bytep profile /* header plus whole tag table */), PNG_EMPTY);
1683
+ #ifdef PNG_sRGB_SUPPORTED
1684
+ PNG_INTERNAL_FUNCTION(void,png_icc_set_sRGB,(
1685
+ png_const_structrp png_ptr, png_colorspacerp colorspace,
1686
+ png_const_bytep profile, uLong adler), PNG_EMPTY);
1687
+ /* 'adler' is the Adler32 checksum of the uncompressed profile data. It may
1688
+ * be zero to indicate that it is not available. It is used, if provided,
1689
+ * as a fast check on the profile when checking to see if it is sRGB.
1690
+ */
1691
+ #endif
1692
+ #endif /* iCCP */
1693
+
1694
+ #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
1695
+ PNG_INTERNAL_FUNCTION(void,png_colorspace_set_rgb_coefficients,
1696
+ (png_structrp png_ptr), PNG_EMPTY);
1697
+ /* Set the rgb_to_gray coefficients from the colorspace Y values */
1698
+ #endif /* READ_RGB_TO_GRAY */
1699
+ #endif /* COLORSPACE */
1700
+
1701
+ /* Added at libpng version 1.4.0 */
1702
+ PNG_INTERNAL_FUNCTION(void,png_check_IHDR,(png_const_structrp png_ptr,
1703
+ png_uint_32 width, png_uint_32 height, int bit_depth,
1704
+ int color_type, int interlace_type, int compression_type,
1705
+ int filter_type),PNG_EMPTY);
1706
+
1707
+ /* Added at libpng version 1.5.10 */
1708
+ #if defined(PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED) || \
1709
+ defined(PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED)
1710
+ PNG_INTERNAL_FUNCTION(void,png_do_check_palette_indexes,
1711
+ (png_structrp png_ptr, png_row_infop row_info),PNG_EMPTY);
1712
+ #endif
1713
+
1714
+ #if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
1715
+ PNG_INTERNAL_FUNCTION(void,png_fixed_error,(png_const_structrp png_ptr,
1716
+ png_const_charp name),PNG_NORETURN);
1717
+ #endif
1718
+
1719
+ /* Puts 'string' into 'buffer' at buffer[pos], taking care never to overwrite
1720
+ * the end. Always leaves the buffer nul terminated. Never errors out (and
1721
+ * there is no error code.)
1722
+ */
1723
+ PNG_INTERNAL_FUNCTION(size_t,png_safecat,(png_charp buffer, size_t bufsize,
1724
+ size_t pos, png_const_charp string),PNG_EMPTY);
1725
+
1726
+ /* Various internal functions to handle formatted warning messages, currently
1727
+ * only implemented for warnings.
1728
+ */
1729
+ #if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_TIME_RFC1123_SUPPORTED)
1730
+ /* Utility to dump an unsigned value into a buffer, given a start pointer and
1731
+ * and end pointer (which should point just *beyond* the end of the buffer!)
1732
+ * Returns the pointer to the start of the formatted string. This utility only
1733
+ * does unsigned values.
1734
+ */
1735
+ PNG_INTERNAL_FUNCTION(png_charp,png_format_number,(png_const_charp start,
1736
+ png_charp end, int format, png_alloc_size_t number),PNG_EMPTY);
1737
+
1738
+ /* Convenience macro that takes an array: */
1739
+ #define PNG_FORMAT_NUMBER(buffer,format,number) \
1740
+ png_format_number(buffer, buffer + (sizeof buffer), format, number)
1741
+
1742
+ /* Suggested size for a number buffer (enough for 64 bits and a sign!) */
1743
+ #define PNG_NUMBER_BUFFER_SIZE 24
1744
+
1745
+ /* These are the integer formats currently supported, the name is formed from
1746
+ * the standard printf(3) format string.
1747
+ */
1748
+ #define PNG_NUMBER_FORMAT_u 1 /* chose unsigned API! */
1749
+ #define PNG_NUMBER_FORMAT_02u 2
1750
+ #define PNG_NUMBER_FORMAT_d 1 /* chose signed API! */
1751
+ #define PNG_NUMBER_FORMAT_02d 2
1752
+ #define PNG_NUMBER_FORMAT_x 3
1753
+ #define PNG_NUMBER_FORMAT_02x 4
1754
+ #define PNG_NUMBER_FORMAT_fixed 5 /* choose the signed API */
1755
+ #endif
1756
+
1757
+ #ifdef PNG_WARNINGS_SUPPORTED
1758
+ /* New defines and members adding in libpng-1.5.4 */
1759
+ # define PNG_WARNING_PARAMETER_SIZE 32
1760
+ # define PNG_WARNING_PARAMETER_COUNT 8 /* Maximum 9; see pngerror.c */
1761
+
1762
+ /* An l-value of this type has to be passed to the APIs below to cache the
1763
+ * values of the parameters to a formatted warning message.
1764
+ */
1765
+ typedef char png_warning_parameters[PNG_WARNING_PARAMETER_COUNT][
1766
+ PNG_WARNING_PARAMETER_SIZE];
1767
+
1768
+ PNG_INTERNAL_FUNCTION(void,png_warning_parameter,(png_warning_parameters p,
1769
+ int number, png_const_charp string),PNG_EMPTY);
1770
+ /* Parameters are limited in size to PNG_WARNING_PARAMETER_SIZE characters,
1771
+ * including the trailing '\0'.
1772
+ */
1773
+ PNG_INTERNAL_FUNCTION(void,png_warning_parameter_unsigned,
1774
+ (png_warning_parameters p, int number, int format, png_alloc_size_t value),
1775
+ PNG_EMPTY);
1776
+ /* Use png_alloc_size_t because it is an unsigned type as big as any we
1777
+ * need to output. Use the following for a signed value.
1778
+ */
1779
+ PNG_INTERNAL_FUNCTION(void,png_warning_parameter_signed,
1780
+ (png_warning_parameters p, int number, int format, png_int_32 value),
1781
+ PNG_EMPTY);
1782
+
1783
+ PNG_INTERNAL_FUNCTION(void,png_formatted_warning,(png_const_structrp png_ptr,
1784
+ png_warning_parameters p, png_const_charp message),PNG_EMPTY);
1785
+ /* 'message' follows the X/Open approach of using @1, @2 to insert
1786
+ * parameters previously supplied using the above functions. Errors in
1787
+ * specifying the parameters will simply result in garbage substitutions.
1788
+ */
1789
+ #endif
1790
+
1791
+ #ifdef PNG_BENIGN_ERRORS_SUPPORTED
1792
+ /* Application errors (new in 1.6); use these functions (declared below) for
1793
+ * errors in the parameters or order of API function calls on read. The
1794
+ * 'warning' should be used for an error that can be handled completely; the
1795
+ * 'error' for one which can be handled safely but which may lose application
1796
+ * information or settings.
1797
+ *
1798
+ * By default these both result in a png_error call prior to release, while in a
1799
+ * released version the 'warning' is just a warning. However if the application
1800
+ * explicitly disables benign errors (explicitly permitting the code to lose
1801
+ * information) they both turn into warnings.
1802
+ *
1803
+ * If benign errors aren't supported they end up as the corresponding base call
1804
+ * (png_warning or png_error.)
1805
+ */
1806
+ PNG_INTERNAL_FUNCTION(void,png_app_warning,(png_const_structrp png_ptr,
1807
+ png_const_charp message),PNG_EMPTY);
1808
+ /* The application provided invalid parameters to an API function or called
1809
+ * an API function at the wrong time, libpng can completely recover.
1810
+ */
1811
+
1812
+ PNG_INTERNAL_FUNCTION(void,png_app_error,(png_const_structrp png_ptr,
1813
+ png_const_charp message),PNG_EMPTY);
1814
+ /* As above but libpng will ignore the call, or attempt some other partial
1815
+ * recovery from the error.
1816
+ */
1817
+ #else
1818
+ # define png_app_warning(pp,s) png_warning(pp,s)
1819
+ # define png_app_error(pp,s) png_error(pp,s)
1820
+ #endif
1821
+
1822
+ PNG_INTERNAL_FUNCTION(void,png_chunk_report,(png_const_structrp png_ptr,
1823
+ png_const_charp message, int error),PNG_EMPTY);
1824
+ /* Report a recoverable issue in chunk data. On read this is used to report
1825
+ * a problem found while reading a particular chunk and the
1826
+ * png_chunk_benign_error or png_chunk_warning function is used as
1827
+ * appropriate. On write this is used to report an error that comes from
1828
+ * data set via an application call to a png_set_ API and png_app_error or
1829
+ * png_app_warning is used as appropriate.
1830
+ *
1831
+ * The 'error' parameter must have one of the following values:
1832
+ */
1833
+ #define PNG_CHUNK_WARNING 0 /* never an error */
1834
+ #define PNG_CHUNK_WRITE_ERROR 1 /* an error only on write */
1835
+ #define PNG_CHUNK_ERROR 2 /* always an error */
1836
+
1837
+ /* ASCII to FP interfaces, currently only implemented if sCAL
1838
+ * support is required.
1839
+ */
1840
+ #if defined(PNG_sCAL_SUPPORTED)
1841
+ /* MAX_DIGITS is actually the maximum number of characters in an sCAL
1842
+ * width or height, derived from the precision (number of significant
1843
+ * digits - a build time settable option) and assumptions about the
1844
+ * maximum ridiculous exponent.
1845
+ */
1846
+ #define PNG_sCAL_MAX_DIGITS (PNG_sCAL_PRECISION+1/*.*/+1/*E*/+10/*exponent*/)
1847
+
1848
+ #ifdef PNG_FLOATING_POINT_SUPPORTED
1849
+ PNG_INTERNAL_FUNCTION(void,png_ascii_from_fp,(png_const_structrp png_ptr,
1850
+ png_charp ascii, size_t size, double fp, unsigned int precision),
1851
+ PNG_EMPTY);
1852
+ #endif /* FLOATING_POINT */
1853
+
1854
+ #ifdef PNG_FIXED_POINT_SUPPORTED
1855
+ PNG_INTERNAL_FUNCTION(void,png_ascii_from_fixed,(png_const_structrp png_ptr,
1856
+ png_charp ascii, size_t size, png_fixed_point fp),PNG_EMPTY);
1857
+ #endif /* FIXED_POINT */
1858
+ #endif /* sCAL */
1859
+
1860
+ #if defined(PNG_sCAL_SUPPORTED) || defined(PNG_pCAL_SUPPORTED)
1861
+ /* An internal API to validate the format of a floating point number.
1862
+ * The result is the index of the next character. If the number is
1863
+ * not valid it will be the index of a character in the supposed number.
1864
+ *
1865
+ * The format of a number is defined in the PNG extensions specification
1866
+ * and this API is strictly conformant to that spec, not anyone elses!
1867
+ *
1868
+ * The format as a regular expression is:
1869
+ *
1870
+ * [+-]?[0-9]+.?([Ee][+-]?[0-9]+)?
1871
+ *
1872
+ * or:
1873
+ *
1874
+ * [+-]?.[0-9]+(.[0-9]+)?([Ee][+-]?[0-9]+)?
1875
+ *
1876
+ * The complexity is that either integer or fraction must be present and the
1877
+ * fraction is permitted to have no digits only if the integer is present.
1878
+ *
1879
+ * NOTE: The dangling E problem.
1880
+ * There is a PNG valid floating point number in the following:
1881
+ *
1882
+ * PNG floating point numbers are not greedy.
1883
+ *
1884
+ * Working this out requires *TWO* character lookahead (because of the
1885
+ * sign), the parser does not do this - it will fail at the 'r' - this
1886
+ * doesn't matter for PNG sCAL chunk values, but it requires more care
1887
+ * if the value were ever to be embedded in something more complex. Use
1888
+ * ANSI-C strtod if you need the lookahead.
1889
+ */
1890
+ /* State table for the parser. */
1891
+ #define PNG_FP_INTEGER 0 /* before or in integer */
1892
+ #define PNG_FP_FRACTION 1 /* before or in fraction */
1893
+ #define PNG_FP_EXPONENT 2 /* before or in exponent */
1894
+ #define PNG_FP_STATE 3 /* mask for the above */
1895
+ #define PNG_FP_SAW_SIGN 4 /* Saw +/- in current state */
1896
+ #define PNG_FP_SAW_DIGIT 8 /* Saw a digit in current state */
1897
+ #define PNG_FP_SAW_DOT 16 /* Saw a dot in current state */
1898
+ #define PNG_FP_SAW_E 32 /* Saw an E (or e) in current state */
1899
+ #define PNG_FP_SAW_ANY 60 /* Saw any of the above 4 */
1900
+
1901
+ /* These three values don't affect the parser. They are set but not used.
1902
+ */
1903
+ #define PNG_FP_WAS_VALID 64 /* Preceding substring is a valid fp number */
1904
+ #define PNG_FP_NEGATIVE 128 /* A negative number, including "-0" */
1905
+ #define PNG_FP_NONZERO 256 /* A non-zero value */
1906
+ #define PNG_FP_STICKY 448 /* The above three flags */
1907
+
1908
+ /* This is available for the caller to store in 'state' if required. Do not
1909
+ * call the parser after setting it (the parser sometimes clears it.)
1910
+ */
1911
+ #define PNG_FP_INVALID 512 /* Available for callers as a distinct value */
1912
+
1913
+ /* Result codes for the parser (boolean - true meants ok, false means
1914
+ * not ok yet.)
1915
+ */
1916
+ #define PNG_FP_MAYBE 0 /* The number may be valid in the future */
1917
+ #define PNG_FP_OK 1 /* The number is valid */
1918
+
1919
+ /* Tests on the sticky non-zero and negative flags. To pass these checks
1920
+ * the state must also indicate that the whole number is valid - this is
1921
+ * achieved by testing PNG_FP_SAW_DIGIT (see the implementation for why this
1922
+ * is equivalent to PNG_FP_OK above.)
1923
+ */
1924
+ #define PNG_FP_NZ_MASK (PNG_FP_SAW_DIGIT | PNG_FP_NEGATIVE | PNG_FP_NONZERO)
1925
+ /* NZ_MASK: the string is valid and a non-zero negative value */
1926
+ #define PNG_FP_Z_MASK (PNG_FP_SAW_DIGIT | PNG_FP_NONZERO)
1927
+ /* Z MASK: the string is valid and a non-zero value. */
1928
+ /* PNG_FP_SAW_DIGIT: the string is valid. */
1929
+ #define PNG_FP_IS_ZERO(state) (((state) & PNG_FP_Z_MASK) == PNG_FP_SAW_DIGIT)
1930
+ #define PNG_FP_IS_POSITIVE(state) (((state) & PNG_FP_NZ_MASK) == PNG_FP_Z_MASK)
1931
+ #define PNG_FP_IS_NEGATIVE(state) (((state) & PNG_FP_NZ_MASK) == PNG_FP_NZ_MASK)
1932
+
1933
+ /* The actual parser. This can be called repeatedly. It updates
1934
+ * the index into the string and the state variable (which must
1935
+ * be initialized to 0). It returns a result code, as above. There
1936
+ * is no point calling the parser any more if it fails to advance to
1937
+ * the end of the string - it is stuck on an invalid character (or
1938
+ * terminated by '\0').
1939
+ *
1940
+ * Note that the pointer will consume an E or even an E+ and then leave
1941
+ * a 'maybe' state even though a preceding integer.fraction is valid.
1942
+ * The PNG_FP_WAS_VALID flag indicates that a preceding substring was
1943
+ * a valid number. It's possible to recover from this by calling
1944
+ * the parser again (from the start, with state 0) but with a string
1945
+ * that omits the last character (i.e. set the size to the index of
1946
+ * the problem character.) This has not been tested within libpng.
1947
+ */
1948
+ PNG_INTERNAL_FUNCTION(int,png_check_fp_number,(png_const_charp string,
1949
+ size_t size, int *statep, size_t *whereami),PNG_EMPTY);
1950
+
1951
+ /* This is the same but it checks a complete string and returns true
1952
+ * only if it just contains a floating point number. As of 1.5.4 this
1953
+ * function also returns the state at the end of parsing the number if
1954
+ * it was valid (otherwise it returns 0.) This can be used for testing
1955
+ * for negative or zero values using the sticky flag.
1956
+ */
1957
+ PNG_INTERNAL_FUNCTION(int,png_check_fp_string,(png_const_charp string,
1958
+ size_t size),PNG_EMPTY);
1959
+ #endif /* pCAL || sCAL */
1960
+
1961
+ #if defined(PNG_GAMMA_SUPPORTED) ||\
1962
+ defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG_READ_pHYs_SUPPORTED)
1963
+ /* Added at libpng version 1.5.0 */
1964
+ /* This is a utility to provide a*times/div (rounded) and indicate
1965
+ * if there is an overflow. The result is a boolean - false (0)
1966
+ * for overflow, true (1) if no overflow, in which case *res
1967
+ * holds the result.
1968
+ */
1969
+ PNG_INTERNAL_FUNCTION(int,png_muldiv,(png_fixed_point_p res, png_fixed_point a,
1970
+ png_int_32 multiplied_by, png_int_32 divided_by),PNG_EMPTY);
1971
+ #endif
1972
+
1973
+ #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
1974
+ /* Same deal, but issue a warning on overflow and return 0. */
1975
+ PNG_INTERNAL_FUNCTION(png_fixed_point,png_muldiv_warn,
1976
+ (png_const_structrp png_ptr, png_fixed_point a, png_int_32 multiplied_by,
1977
+ png_int_32 divided_by),PNG_EMPTY);
1978
+ #endif
1979
+
1980
+ #ifdef PNG_GAMMA_SUPPORTED
1981
+ /* Calculate a reciprocal - used for gamma values. This returns
1982
+ * 0 if the argument is 0 in order to maintain an undefined value;
1983
+ * there are no warnings.
1984
+ */
1985
+ PNG_INTERNAL_FUNCTION(png_fixed_point,png_reciprocal,(png_fixed_point a),
1986
+ PNG_EMPTY);
1987
+
1988
+ #ifdef PNG_READ_GAMMA_SUPPORTED
1989
+ /* The same but gives a reciprocal of the product of two fixed point
1990
+ * values. Accuracy is suitable for gamma calculations but this is
1991
+ * not exact - use png_muldiv for that. Only required at present on read.
1992
+ */
1993
+ PNG_INTERNAL_FUNCTION(png_fixed_point,png_reciprocal2,(png_fixed_point a,
1994
+ png_fixed_point b),PNG_EMPTY);
1995
+ #endif
1996
+
1997
+ /* Return true if the gamma value is significantly different from 1.0 */
1998
+ PNG_INTERNAL_FUNCTION(int,png_gamma_significant,(png_fixed_point gamma_value),
1999
+ PNG_EMPTY);
2000
+ #endif
2001
+
2002
+ #ifdef PNG_READ_GAMMA_SUPPORTED
2003
+ /* Internal fixed point gamma correction. These APIs are called as
2004
+ * required to convert single values - they don't need to be fast,
2005
+ * they are not used when processing image pixel values.
2006
+ *
2007
+ * While the input is an 'unsigned' value it must actually be the
2008
+ * correct bit value - 0..255 or 0..65535 as required.
2009
+ */
2010
+ PNG_INTERNAL_FUNCTION(png_uint_16,png_gamma_correct,(png_structrp png_ptr,
2011
+ unsigned int value, png_fixed_point gamma_value),PNG_EMPTY);
2012
+ PNG_INTERNAL_FUNCTION(png_uint_16,png_gamma_16bit_correct,(unsigned int value,
2013
+ png_fixed_point gamma_value),PNG_EMPTY);
2014
+ PNG_INTERNAL_FUNCTION(png_byte,png_gamma_8bit_correct,(unsigned int value,
2015
+ png_fixed_point gamma_value),PNG_EMPTY);
2016
+ PNG_INTERNAL_FUNCTION(void,png_destroy_gamma_table,(png_structrp png_ptr),
2017
+ PNG_EMPTY);
2018
+ PNG_INTERNAL_FUNCTION(void,png_build_gamma_table,(png_structrp png_ptr,
2019
+ int bit_depth),PNG_EMPTY);
2020
+ #endif
2021
+
2022
+ /* SIMPLIFIED READ/WRITE SUPPORT */
2023
+ #if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
2024
+ defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
2025
+ /* The internal structure that png_image::opaque points to. */
2026
+ typedef struct png_control
2027
+ {
2028
+ png_structp png_ptr;
2029
+ png_infop info_ptr;
2030
+ png_voidp error_buf; /* Always a jmp_buf at present. */
2031
+
2032
+ png_const_bytep memory; /* Memory buffer. */
2033
+ size_t size; /* Size of the memory buffer. */
2034
+
2035
+ unsigned int for_write :1; /* Otherwise it is a read structure */
2036
+ unsigned int owned_file :1; /* We own the file in io_ptr */
2037
+ } png_control;
2038
+
2039
+ /* Return the pointer to the jmp_buf from a png_control: necessary because C
2040
+ * does not reveal the type of the elements of jmp_buf.
2041
+ */
2042
+ #ifdef __cplusplus
2043
+ # define png_control_jmp_buf(pc) (((jmp_buf*)((pc)->error_buf))[0])
2044
+ #else
2045
+ # define png_control_jmp_buf(pc) ((pc)->error_buf)
2046
+ #endif
2047
+
2048
+ /* Utility to safely execute a piece of libpng code catching and logging any
2049
+ * errors that might occur. Returns true on success, false on failure (either
2050
+ * of the function or as a result of a png_error.)
2051
+ */
2052
+ PNG_INTERNAL_CALLBACK(void,png_safe_error,(png_structp png_ptr,
2053
+ png_const_charp error_message),PNG_NORETURN);
2054
+
2055
+ #ifdef PNG_WARNINGS_SUPPORTED
2056
+ PNG_INTERNAL_CALLBACK(void,png_safe_warning,(png_structp png_ptr,
2057
+ png_const_charp warning_message),PNG_EMPTY);
2058
+ #else
2059
+ # define png_safe_warning 0/*dummy argument*/
2060
+ #endif
2061
+
2062
+ PNG_INTERNAL_FUNCTION(int,png_safe_execute,(png_imagep image,
2063
+ int (*function)(png_voidp), png_voidp arg),PNG_EMPTY);
2064
+
2065
+ /* Utility to log an error; this also cleans up the png_image; the function
2066
+ * always returns 0 (false).
2067
+ */
2068
+ PNG_INTERNAL_FUNCTION(int,png_image_error,(png_imagep image,
2069
+ png_const_charp error_message),PNG_EMPTY);
2070
+
2071
+ #ifndef PNG_SIMPLIFIED_READ_SUPPORTED
2072
+ /* png_image_free is used by the write code but not exported */
2073
+ PNG_INTERNAL_FUNCTION(void, png_image_free, (png_imagep image), PNG_EMPTY);
2074
+ #endif /* !SIMPLIFIED_READ */
2075
+
2076
+ #endif /* SIMPLIFIED READ/WRITE */
2077
+
2078
+ /* These are initialization functions for hardware specific PNG filter
2079
+ * optimizations; list these here then select the appropriate one at compile
2080
+ * time using the macro PNG_FILTER_OPTIMIZATIONS. If the macro is not defined
2081
+ * the generic code is used.
2082
+ */
2083
+ #ifdef PNG_FILTER_OPTIMIZATIONS
2084
+ PNG_INTERNAL_FUNCTION(void, PNG_FILTER_OPTIMIZATIONS, (png_structp png_ptr,
2085
+ unsigned int bpp), PNG_EMPTY);
2086
+ /* Just declare the optimization that will be used */
2087
+ #else
2088
+ /* List *all* the possible optimizations here - this branch is required if
2089
+ * the builder of libpng passes the definition of PNG_FILTER_OPTIMIZATIONS in
2090
+ * CFLAGS in place of CPPFLAGS *and* uses symbol prefixing.
2091
+ */
2092
+ # if PNG_ARM_NEON_OPT > 0
2093
+ PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
2094
+ (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
2095
+ #endif
2096
+
2097
+ #if PNG_MIPS_MSA_OPT > 0
2098
+ PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_msa,
2099
+ (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
2100
+ #endif
2101
+
2102
+ # if PNG_INTEL_SSE_IMPLEMENTATION > 0
2103
+ PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2,
2104
+ (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
2105
+ # endif
2106
+ #endif
2107
+
2108
+ PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
2109
+ png_const_charp key, png_bytep new_key), PNG_EMPTY);
2110
+
2111
+ #if PNG_ARM_NEON_IMPLEMENTATION == 1
2112
+ PNG_INTERNAL_FUNCTION(void,
2113
+ png_riffle_palette_neon,
2114
+ (png_structrp),
2115
+ PNG_EMPTY);
2116
+ PNG_INTERNAL_FUNCTION(int,
2117
+ png_do_expand_palette_rgba8_neon,
2118
+ (png_structrp,
2119
+ png_row_infop,
2120
+ png_const_bytep,
2121
+ const png_bytepp,
2122
+ const png_bytepp),
2123
+ PNG_EMPTY);
2124
+ PNG_INTERNAL_FUNCTION(int,
2125
+ png_do_expand_palette_rgb8_neon,
2126
+ (png_structrp,
2127
+ png_row_infop,
2128
+ png_const_bytep,
2129
+ const png_bytepp,
2130
+ const png_bytepp),
2131
+ PNG_EMPTY);
2132
+ #endif
2133
+
2134
+ /* Maintainer: Put new private prototypes here ^ */
2135
+
2136
+ #include "pngdebug.h"
2137
+
2138
+ #ifdef __cplusplus
2139
+ }
2140
+ #endif
2141
+
2142
+ #endif /* PNG_VERSION_INFO_ONLY */
2143
+ #endif /* PNGPRIV_H */
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/c/tsl_status.h ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_C_TSL_STATUS_H_
17
+ #define TENSORFLOW_TSL_C_TSL_STATUS_H_
18
+
19
+ #ifdef __cplusplus
20
+ extern "C" {
21
+ #endif
22
+
23
+ typedef struct TSL_Status TSL_Status;
24
+
25
+ // --------------------------------------------------------------------------
26
+ // TSL_Code holds an error code. The enum values here are identical to
27
+ // corresponding values in error_codes.proto.
28
+ typedef enum TSL_Code {
29
+ TSL_OK = 0,
30
+ TSL_CANCELLED = 1,
31
+ TSL_UNKNOWN = 2,
32
+ TSL_INVALID_ARGUMENT = 3,
33
+ TSL_DEADLINE_EXCEEDED = 4,
34
+ TSL_NOT_FOUND = 5,
35
+ TSL_ALREADY_EXISTS = 6,
36
+ TSL_PERMISSION_DENIED = 7,
37
+ TSL_UNAUTHENTICATED = 16,
38
+ TSL_RESOURCE_EXHAUSTED = 8,
39
+ TSL_FAILED_PRECONDITION = 9,
40
+ TSL_ABORTED = 10,
41
+ TSL_OUT_OF_RANGE = 11,
42
+ TSL_UNIMPLEMENTED = 12,
43
+ TSL_INTERNAL = 13,
44
+ TSL_UNAVAILABLE = 14,
45
+ TSL_DATA_LOSS = 15,
46
+ } TSL_Code;
47
+
48
+ // --------------------------------------------------------------------------
49
+
50
+ // Return a new status object.
51
+ extern TSL_Status* TSL_NewStatus(void);
52
+
53
+ // Delete a previously created status object.
54
+ extern void TSL_DeleteStatus(TSL_Status*);
55
+
56
+ // Record <code, msg> in *s. Any previous information is lost.
57
+ // A common use is to clear a status: TSL_SetStatus(s, TSL_OK, "");
58
+ extern void TSL_SetStatus(TSL_Status* s, TSL_Code code, const char* msg);
59
+
60
+ // Record <key, value> as a payload in *s. The previous payload having the
61
+ // same key (if any) is overwritten. Payload will not be added if the Status
62
+ // is OK.
63
+ extern void TSL_SetPayload(TSL_Status* s, const char* key, const char* value);
64
+
65
+ // Iterates over the stored payloads and calls the `visitor(key, value)`
66
+ // callable for each one. `key` and `value` is only usable during the callback.
67
+ // `capture` will be passed to the callback without modification.
68
+ typedef void (*TSL_PayloadVisitor)(const char* key, const char* value,
69
+ void* capture);
70
+ extern void TSL_ForEachPayload(const TSL_Status* s, TSL_PayloadVisitor visitor,
71
+ void* capture);
72
+
73
+ // Convert from an I/O error code (e.g., errno) to a TSL_Status value.
74
+ // Any previous information is lost. Prefer to use this instead of TSL_SetStatus
75
+ // when the error comes from I/O operations.
76
+ extern void TSL_SetStatusFromIOError(TSL_Status* s, int error_code,
77
+ const char* context);
78
+
79
+ // Return the code record in *s.
80
+ extern TSL_Code TSL_GetCode(const TSL_Status* s);
81
+
82
+ // Return a pointer to the (null-terminated) error message in *s. The
83
+ // return value points to memory that is only usable until the next
84
+ // mutation to *s. Always returns an empty string if TSL_GetCode(s) is
85
+ // TSL_OK.
86
+ extern const char* TSL_Message(const TSL_Status* s);
87
+
88
+ #ifdef __cplusplus
89
+ } /* end extern "C" */
90
+ #endif
91
+
92
+ #endif // TENSORFLOW_TSL_C_TSL_STATUS_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/c/tsl_status_helper.h ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_C_TSL_STATUS_HELPER_H_
17
+ #define TENSORFLOW_TSL_C_TSL_STATUS_HELPER_H_
18
+
19
+ #include <memory>
20
+
21
+ #include "tsl/c/tsl_status.h"
22
+ #include "tsl/platform/status.h"
23
+
24
+ namespace tsl {
25
+
26
+ TSL_Code TSLCodeFromStatusCode(absl::StatusCode code);
27
+
28
+ absl::StatusCode StatusCodeFromTSLCode(TSL_Code code);
29
+
30
+ } // namespace tsl
31
+
32
+ #endif // TENSORFLOW_TSL_C_TSL_STATUS_HELPER_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/c/tsl_status_internal.h ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_C_TSL_STATUS_INTERNAL_H_
17
+ #define TENSORFLOW_TSL_C_TSL_STATUS_INTERNAL_H_
18
+
19
+ #include "tsl/platform/status.h"
20
+
21
+ // Internal structures used by the status C API. These are likely to change
22
+ // and should not be depended on.
23
+
24
+ struct TSL_Status {
25
+ tsl::Status status;
26
+ };
27
+
28
+ #endif // TENSORFLOW_TSL_C_TSL_STATUS_INTERNAL_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/concurrency/async_value.h ADDED
@@ -0,0 +1,998 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2022 Google LLC. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_CONCURRENCY_ASYNC_VALUE_H_
17
+ #define TENSORFLOW_TSL_CONCURRENCY_ASYNC_VALUE_H_
18
+
19
+ #include <atomic>
20
+ #include <cassert>
21
+ #include <cstddef>
22
+ #include <cstdint>
23
+ #include <iostream>
24
+ #include <memory>
25
+ #include <string>
26
+ #include <type_traits>
27
+ #include <utility>
28
+
29
+ #include "absl/functional/any_invocable.h"
30
+ #include "absl/status/status.h"
31
+ #include "absl/status/statusor.h"
32
+ #include "absl/types/span.h"
33
+ #include "tsl/concurrency/concurrent_vector.h"
34
+ #include "tsl/concurrency/ref_count.h"
35
+
36
+ namespace tsl {
37
+
38
+ class NotifierListNode;
39
+
40
+ namespace internal {
41
+
42
+ template <typename T>
43
+ class ConcreteAsyncValue;
44
+
45
+ template <typename T>
46
+ constexpr bool kMaybeBase = std::is_class<T>::value && !std::is_final<T>::value;
47
+
48
+ // TODO(ezhulenev): Switch to `tsl::port::Aligned(Malloc|Free)` once TFRT will
49
+ // be able to properly depend on TSL in the open source build.
50
+ void* AlignedAlloc(size_t alignment, size_t size);
51
+ void AlignedFree(void* ptr);
52
+
53
+ } // namespace internal
54
+
55
+ // This is a future of the specified value type. Arbitrary C++ types may be used
56
+ // here, even non-copyable types and expensive ones like tensors.
57
+ //
58
+ // An AsyncValue is in one of two states: unavailable or available. If it is in
59
+ // the unavailable state, it may have a list of waiters which are notified when
60
+ // the value transitions to another state.
61
+ //
62
+ // The actual payload data is stored in the templated subclass
63
+ // ConcreteAsyncValue. This achieves good cache efficiency by storing the meta
64
+ // data and the payload data in consecutive memory locations.
65
+ class AsyncValue {
66
+ public:
67
+ ~AsyncValue();
68
+
69
+ // Return true if state is kUnconstructed.
70
+ bool IsUnconstructed() const;
71
+
72
+ // Return true if state is kConstructed.
73
+ bool IsConstructed() const;
74
+
75
+ // Return true if state is kConcrete.
76
+ bool IsConcrete() const;
77
+
78
+ // Return true if state is kError.
79
+ bool IsError() const;
80
+
81
+ // Return true if this async value is resolved to a concrete value or error.
82
+ bool IsAvailable() const;
83
+ bool IsUnavailable() const { return !IsAvailable(); }
84
+
85
+ // Return true if this is an IndirectAsyncValue that hasn't been resolved.
86
+ // Currently an IndirectAsyncValue is available if and only if it is resolved.
87
+ bool IsUnresolvedIndirect() const;
88
+
89
+ // Return true if this is an IndirectAsyncValue.
90
+ bool IsIndirect() const;
91
+
92
+ // Return reference count. This should be used for testing and debugging only.
93
+ uint32_t NumRef() const { return refcount_.load(std::memory_order_acquire); }
94
+
95
+ // Return true if reference count is 1.
96
+ bool IsUnique() const;
97
+
98
+ // Add a new reference to this object.
99
+ //
100
+ // Return this object for convenience. e.g. when a call-site wants to feed an
101
+ // AsyncValue object into a function call that takes the object at +1, we can
102
+ // write: foo(av->AddRef());
103
+ AsyncValue* AddRef() { return AddRef(1); }
104
+ AsyncValue* AddRef(uint32_t count);
105
+
106
+ // Drop a reference to this object, potentially deallocating it.
107
+ void DropRef() { DropRef(1); }
108
+ void DropRef(uint32_t count);
109
+
110
+ // Return the stored value as type T. For the consumer of the AsyncValue, this
111
+ // requires that the state be `kConcrete`. For the producer of the AsyncValue,
112
+ // the state may also be `constructed`, as long as the producer can ensure
113
+ // race-free access to the data (e.g. no concurrent writes and reads and no
114
+ // concurrent changing the state to `kError). For both cases, T must be the
115
+ // exact type or a base type of the payload type of this AsyncValue. When T is
116
+ // a base type of the payload type, the following additional conditions are
117
+ // required:
118
+ // 1) Both the payload type and T are polymorphic (have virtual function) or
119
+ // neither are.
120
+ // 2) The payload type does not use multiple inheritance.
121
+ // The above conditions are required since we store only the offset of the
122
+ // payload type in AsyncValue as data_traits_.buf_offset. Violation of either
123
+ // 1) or 2) requires additional pointer adjustments to get the proper pointer
124
+ // for the base type, which we do not have sufficient information to perform
125
+ // at runtime.
126
+ template <typename T>
127
+ const T& get() const;
128
+
129
+ // Same as the const overload of get(), except for returning a non-const ref.
130
+ template <typename T>
131
+ T& get();
132
+
133
+ // Returns the underlying error. IsError() must be true.
134
+ const absl::Status& GetError() const;
135
+
136
+ // Returns the underlying error, or nullptr if there is none.
137
+ const absl::Status* GetErrorIfPresent() const;
138
+
139
+ template <typename T>
140
+ bool IsType() const {
141
+ return GetTypeId<T>() == type_id_;
142
+ }
143
+
144
+ // Change state to kConcrete. Requires that this AsyncValue
145
+ // previously have state constructed.
146
+ void SetStateConcrete();
147
+
148
+ // Construct the payload of the AsyncValue in place and change its state to
149
+ // kConcrete. Requires that this AsyncValue previously have state
150
+ // kUnconstructed or kConstructed.
151
+ template <typename T, typename... Args>
152
+ void emplace(Args&&... args);
153
+
154
+ void SetError(absl::Status status);
155
+
156
+ // If the value is available or becomes available, this calls the closure
157
+ // immediately. Otherwise, adds the waiter to the waiter list and calls it
158
+ // when the value becomes available.
159
+ template <typename WaiterT>
160
+ void AndThen(WaiterT waiter);
161
+
162
+ // Return the total number of async values that are currently live in the
163
+ // process. This is intended for debugging/assertions only, and shouldn't be
164
+ // used for mainline logic in the runtime.
165
+ static size_t GetNumAsyncValueInstances() {
166
+ assert(AsyncValueAllocationTrackingEnabled() &&
167
+ "AsyncValue instance tracking disabled!");
168
+ return total_allocated_async_values_.load(std::memory_order_relaxed);
169
+ }
170
+
171
+ // Returns true if we track the number of alive AsyncValue instances in
172
+ // total_allocated_async_values_.
173
+ static bool AsyncValueAllocationTrackingEnabled() {
174
+ // For now we track the number of alive AsyncValue instances only in debug
175
+ // builds.
176
+ #ifdef NDEBUG
177
+ return false;
178
+ #else
179
+ return true;
180
+ #endif
181
+ }
182
+
183
+ // What sort of AsyncValue this is.
184
+ //
185
+ // We make this an unsigned type so that loading the enum from the bitfield
186
+ // does not sign extend.
187
+ enum class Kind : uint8_t {
188
+ kConcrete = 0, // ConcreteAsyncValue
189
+ kIndirect = 1, // IndirectAsyncValue
190
+ };
191
+
192
+ // Return the kind of this AsyncValue.
193
+ Kind kind() const { return kind_; }
194
+
195
+ class State {
196
+ public:
197
+ // The state of AsyncValue.
198
+ enum StateEnum : int8_t {
199
+ // The underlying value's constructor is not called and the value is not
200
+ // available for consumption. This state can transition to kConstructed,
201
+ // kConcrete and kError.
202
+ kUnconstructed = 0,
203
+ // The underlying value's constructor is called but the value is not
204
+ // available for consumption. This state can transition to
205
+ // kConcrete and kError.
206
+ kConstructed = 1,
207
+ // The underlying value is available for consumption. This state can not
208
+ // transition to any other state.
209
+ kConcrete = 2,
210
+ // This AsyncValue is available and contains an error. This state can not
211
+ // transition to any other state.
212
+ kError = 3,
213
+ };
214
+
215
+ State(StateEnum s) : state_(s) {} // NOLINT
216
+
217
+ operator StateEnum() { return state_; } // NOLINT
218
+
219
+ // Return true if state is kUnconstructed.
220
+ bool IsUnconstructed() const { return state_ == kUnconstructed; }
221
+
222
+ // Return true if state is kConstructed.
223
+ bool IsConstructed() const { return state_ == kConstructed; }
224
+
225
+ // Return true if state is kConcrete.
226
+ bool IsConcrete() const { return state_ == kConcrete; }
227
+
228
+ // Return true if state is kError.
229
+ bool IsError() const { return state_ == kError; }
230
+
231
+ // Return true if this async value is resolved to a concrete value or error.
232
+ bool IsAvailable() const { return state_ == kConcrete || state_ == kError; }
233
+ bool IsUnavailable() const { return !IsAvailable(); }
234
+
235
+ const char* DebugString() const {
236
+ switch (state_) {
237
+ case kUnconstructed:
238
+ return "kUnconstructed";
239
+ case kConstructed:
240
+ return "kConstructed";
241
+ case kConcrete:
242
+ return "kConcrete";
243
+ case kError:
244
+ return "kError";
245
+ }
246
+ }
247
+
248
+ private:
249
+ StateEnum state_;
250
+ };
251
+
252
+ // Return which state this AsyncValue is in.
253
+ State state() const {
254
+ return waiters_and_state_.load(std::memory_order_acquire).state();
255
+ }
256
+
257
+ protected:
258
+ // -----------------------------------------------------------
259
+ // Implementation details follow. Clients should ignore them.
260
+
261
+ // Utility template for tag dispatching.
262
+ template <typename T>
263
+ struct TypeTag {};
264
+
265
+ friend class IndirectAsyncValue;
266
+ template <typename T>
267
+ AsyncValue(Kind kind, State state, bool is_refcounted, TypeTag<T>)
268
+ : refcount_(1),
269
+ kind_(kind),
270
+ has_vtable_(std::is_polymorphic<T>()),
271
+ is_refcounted_(is_refcounted),
272
+ type_id_(GetTypeId<T>()),
273
+ waiters_and_state_(WaitersAndState(nullptr, state)) {
274
+ if (AsyncValueAllocationTrackingEnabled() && is_refcounted)
275
+ total_allocated_async_values_.fetch_add(1, std::memory_order_relaxed);
276
+ }
277
+
278
+ AsyncValue(Kind kind, State state, bool is_refcounted)
279
+ : refcount_(1),
280
+ kind_(kind),
281
+ has_vtable_(false),
282
+ is_refcounted_(is_refcounted),
283
+ type_id_(0),
284
+ waiters_and_state_(WaitersAndState(nullptr, state)) {
285
+ if (AsyncValueAllocationTrackingEnabled() && is_refcounted)
286
+ total_allocated_async_values_.fetch_add(1, std::memory_order_relaxed);
287
+ }
288
+
289
+ AsyncValue(const AsyncValue&) = delete;
290
+ AsyncValue& operator=(const AsyncValue&) = delete;
291
+
292
+ void NotifyAvailable(State available_state);
293
+ void Destroy();
294
+ void RunWaiters(NotifierListNode* list);
295
+
296
+ // IsTypeIdCompatible returns true if the type value stored in this AsyncValue
297
+ // instance can be safely cast to `T`. This is a conservative check. I.e.
298
+ // IsTypeIdCompatible may return true even if the value cannot be safely cast
299
+ // to `T`. However, if it returns false then the value definitely cannot be
300
+ // safely cast to `T`. This means it is useful mainly as a debugging aid for
301
+ // use in assert() etc.
302
+
303
+ template <typename T, std::enable_if_t<internal::kMaybeBase<T>>* = nullptr>
304
+ bool IsTypeIdCompatible() const {
305
+ // We can't do a GetTypeId<T> in this case because `T` might be an abstract
306
+ // class. So we conservatively return true.
307
+ return true;
308
+ }
309
+
310
+ template <typename T, std::enable_if_t<!internal::kMaybeBase<T>>* = nullptr>
311
+ bool IsTypeIdCompatible() const {
312
+ return GetTypeId<T>() == type_id_;
313
+ }
314
+
315
+ // Return the ID of the given type. Note that at most 2^16-2 (approx. 64K)
316
+ // unique types can be used in AsyncValues, since the ID is 16 bits, and 0 and
317
+ // 2^16-1 are not allowed to be used as type IDs.
318
+ template <typename T>
319
+ static uint16_t GetTypeId() {
320
+ return internal::ConcreteAsyncValue<T>::concrete_type_id_;
321
+ }
322
+
323
+ // Creates a AsyncValue::TypeInfo object for `T` and store it in the global
324
+ // TypeInfo table. Returns the "type id" for `T` which currently happens to
325
+ // be one plus the index of this TypeInfo object in the TypeInfo table.
326
+ //
327
+ // This should only be called from the initializer for the static
328
+ // ConcreteAsyncValue concrete_type_id_ field.
329
+ template <typename T>
330
+ static uint16_t CreateTypeInfoAndReturnTypeId() {
331
+ return CreateTypeInfoAndReturnTypeIdImpl(
332
+ MakeTypeInfo<internal::ConcreteAsyncValue<T>>());
333
+ }
334
+
335
+ std::atomic<uint32_t> refcount_{1};
336
+
337
+ Kind kind_ : 2;
338
+ // has_vtable_ has the same value for a given payload type T. If we want to
339
+ // use the unused bits here for other purpose in the future, we can move
340
+ // has_vtable_ to a global vector<bool> indexed by type_id_.
341
+ const bool has_vtable_ : 1;
342
+
343
+ // When is_refcounted_ is false, `AddRef` and `DropRef` have no effect in
344
+ // optimized builds. We always do reference counting in debug builds to verify
345
+ // that async values used correctly and we do not have accidental dangling
346
+ // references.
347
+ const bool is_refcounted_ : 1;
348
+
349
+ // This is a 16-bit value that identifies the type.
350
+ uint16_t type_id_ = 0;
351
+
352
+ // The waiter list and the state are compacted into one single atomic word as
353
+ // accesses to them are tightly related. To change the state from unavailable
354
+ // (i.e. kUnconstructed or kConstructed) to available
355
+ // (i.e. kConcrete or kError), we also need to empty the waiter
356
+ // list. To add a node to the waiter list, we want to make sure the state is
357
+ // unavailable, otherwise we could run the new node immediately.
358
+ //
359
+ // Invariant: If the state is not available, then the waiter list must be
360
+ // nullptr.
361
+ struct WaitersAndState {
362
+ // We rely on the fact that all `NotifierListNode` values are aligned at
363
+ // least to 8 bytes and we can encode state in the lowest 3 bits. We use
364
+ // the conservative estimation of the minimal alignment of pointers returned
365
+ // from memory allocation functions.
366
+ //
367
+ // See: https://en.cppreference.com/w/cpp/types/max_align_t
368
+ static_assert(alignof(std::max_align_t) >= 8 &&
369
+ sizeof(NotifierListNode*) == 8);
370
+
371
+ static constexpr uint64_t kStateMask = (1ull << 2) - 1;
372
+ static constexpr uint64_t kPointerMask = ~kStateMask;
373
+
374
+ WaitersAndState(NotifierListNode* ptr, State state) {
375
+ value = (reinterpret_cast<uintptr_t>(ptr) & kPointerMask) |
376
+ (state & kStateMask);
377
+ }
378
+
379
+ State state() const {
380
+ return State(static_cast<State::StateEnum>(value & kStateMask));
381
+ }
382
+
383
+ NotifierListNode* waiter() const {
384
+ return reinterpret_cast<NotifierListNode*>(value & kPointerMask);
385
+ }
386
+
387
+ uintptr_t value;
388
+ };
389
+
390
+ std::atomic<WaitersAndState> waiters_and_state_;
391
+
392
+ // We assume (and static_assert) that this is the offset of
393
+ // ConcreteAsyncValue::data_, which is the same as the offset of
394
+ // ConcreteAsyncValue::error_.
395
+ static constexpr int kDataOffset = 16;
396
+
397
+ private:
398
+ // Information about a ConcreteAsyncValue<T> subclass.
399
+ struct TypeInfo {
400
+ // Destructor returns the size of the derived AsyncValue to be deallocated.
401
+ using DestructorFn = size_t (*)(AsyncValue*);
402
+ using GetErrorFn = const absl::Status& (*)(const AsyncValue*);
403
+ using SetErrorFn = void (*)(AsyncValue*, absl::Status);
404
+ using HasDataFn = bool (*)(const AsyncValue*);
405
+
406
+ DestructorFn destructor;
407
+ GetErrorFn get_error;
408
+ SetErrorFn set_error;
409
+ HasDataFn has_data;
410
+ };
411
+
412
+ template <typename Derived>
413
+ static TypeInfo MakeTypeInfo() {
414
+ return TypeInfo{
415
+ [](AsyncValue* v) {
416
+ static_cast<Derived*>(v)->~Derived();
417
+ return sizeof(Derived);
418
+ },
419
+ [](const AsyncValue* v) -> const absl::Status& {
420
+ return static_cast<const Derived*>(v)->GetError();
421
+ },
422
+ [](AsyncValue* v, absl::Status status) {
423
+ static_cast<Derived*>(v)->SetError(std::move(status));
424
+ },
425
+ [](const AsyncValue* v) {
426
+ return static_cast<const Derived*>(v)->HasData();
427
+ },
428
+ };
429
+ }
430
+
431
+ static uint16_t CreateTypeInfoAndReturnTypeIdImpl(const TypeInfo& type_info);
432
+
433
+ template <typename T>
434
+ const T& GetConcreteValue() const;
435
+
436
+ // Get the TypeInfo instance for this AsyncValue.
437
+ const TypeInfo& GetTypeInfo() const;
438
+
439
+ using TypeInfoTable = internal::ConcurrentVector<TypeInfo>;
440
+
441
+ // Returns the TypeInfoTable instance (there is one per process).
442
+ static TypeInfoTable* GetTypeInfoTableSingleton();
443
+
444
+ void EnqueueWaiter(absl::AnyInvocable<void()> waiter,
445
+ WaitersAndState old_value);
446
+
447
+ // This is a global counter of the number of AsyncValue instances currently
448
+ // live in the process. This is intended to be used for debugging only, and
449
+ // is only kept in sync if AsyncValueAllocationTrackingEnabled() returns
450
+ // true.
451
+ static std::atomic<size_t> total_allocated_async_values_;
452
+ };
453
+
454
+ // We only optimize the code for 64-bit architectures for now.
455
+ static_assert(sizeof(AsyncValue) == 16 || sizeof(void*) != 8,
456
+ "Unexpected size for AsyncValue");
457
+
458
+ //===----------------------------------------------------------------------===//
459
+ // Functions for awaiting on the async values.
460
+ //===----------------------------------------------------------------------===//
461
+
462
+ // Blocks the caller thread until the async value becomes available.
463
+ void BlockUntilReady(AsyncValue* async_value);
464
+
465
+ // Runs the `callee` when all async values become available.
466
+ void RunWhenReady(absl::Span<AsyncValue* const> values,
467
+ absl::AnyInvocable<void()> callee);
468
+ void RunWhenReady(absl::Span<RCReference<AsyncValue> const> values,
469
+ absl::AnyInvocable<void()> callee);
470
+
471
+ //===----------------------------------------------------------------------===//
472
+
473
+ namespace internal {
474
+
475
+ // Under the normal behavior, if an AsyncValue is in kConstructed state (i.e.
476
+ // the payload data is constructed), it will destruct the payload data when the
477
+ // AsyncValue enters the error state (e.g. on AsyncValue::SetError()).
478
+ //
479
+ // However, for the payload types that inherit from
480
+ // `KeepAsyncValuePayloadOnError`, AsyncValue exhibits a different behavior: the
481
+ // payload value if constructed will be kept valid when the AsyncValue goes into
482
+ // the error state. This behavior is intended for use only in the TpuRuntime
483
+ // code. All the other code shall *not* use this behavior. We keep this struct
484
+ // in the `internal` namespace to indicate this restriction.
485
+ struct KeepAsyncValuePayloadOnError {};
486
+
487
+ // Async value itself is a container that either holds `absl::Status` (in error
488
+ // state) or a concrete value of type `T` (in concrete state). Async value that
489
+ // holds a status is typically a bad idea, and should be expressed as a plain
490
+ // async value.
491
+ //
492
+ // Example:
493
+ // - Prefer `AsyncValueRef<Chain>` to `AsyncValueRef<absl::Status>`.
494
+ // Instead of a `Chain` it can be any other empty struct to signal that only
495
+ // the potential error is important.
496
+ //
497
+ // - Prefer `AsyncValueRef<T>` to `AsyncValueRef<absl::StatusOr<T>>`.
498
+ // Similar to the `absl::StatusOr<T>` async value will be either in error
499
+ // state holding an `absl::Status` error, or in concrete state holding a
500
+ // value of type `T`.
501
+ //
502
+ // Subclass for storing the payload of the AsyncValue
503
+ template <typename T>
504
+ class ConcreteAsyncValue : public AsyncValue {
505
+ public:
506
+ // Tag type for making a ConcreteAsyncValue without calling underlying value's
507
+ // constructor.
508
+ struct UnconstructedPayload {
509
+ bool is_refcounted = true;
510
+ };
511
+
512
+ // Tag type for making a ConcreteAsyncValue with the underlying value
513
+ // constructed but not available for consumption.
514
+ struct ConstructedPayload {
515
+ bool is_refcounted = true;
516
+ };
517
+
518
+ // Tag type for making a ConcreteAsyncValue with the underlying value
519
+ // constructed and available for consumption.
520
+ struct ConcretePayload {
521
+ bool is_refcounted = true;
522
+ };
523
+
524
+ // Make a ConcreteAsyncValue with kUnconstructed state.
525
+ explicit ConcreteAsyncValue(UnconstructedPayload payload)
526
+ : AsyncValue(Kind::kConcrete, State::kUnconstructed,
527
+ payload.is_refcounted, TypeTag<T>()) {
528
+ VerifyOffsets();
529
+ }
530
+
531
+ // Make a ConcreteAsyncValue with kError state.
532
+ explicit ConcreteAsyncValue(absl::Status status)
533
+ : AsyncValue(Kind::kConcrete, State::kError,
534
+ /*is_refcounted=*/true, TypeTag<T>()),
535
+ data_store_{std::move(status)} {
536
+ VerifyOffsets();
537
+ }
538
+
539
+ // Make a ConcreteAsyncValue with kConstructed state.
540
+ template <typename... Args>
541
+ explicit ConcreteAsyncValue(ConstructedPayload payload, Args&&... args)
542
+ : AsyncValue(Kind::kConcrete, State::kConstructed, payload.is_refcounted,
543
+ TypeTag<T>()),
544
+ data_store_{TypeTag<T>(), std::forward<Args>(args)...} {}
545
+
546
+ // Make a ConcreteAsyncValue with kConcrete state.
547
+ template <typename... Args>
548
+ explicit ConcreteAsyncValue(ConcretePayload payload, Args&&... args)
549
+ : AsyncValue(Kind::kConcrete, State::kConcrete, payload.is_refcounted,
550
+ TypeTag<T>()),
551
+ data_store_{TypeTag<T>(), std::forward<Args>(args)...} {}
552
+
553
+ ~ConcreteAsyncValue() { Destroy(); }
554
+
555
+ // Return the underlying error. IsError() must return true.
556
+ const absl::Status& GetError() const {
557
+ assert(IsError());
558
+ return data_store_.error();
559
+ }
560
+
561
+ void SetError(absl::Status status) {
562
+ data_store_.SetError(state(), std::move(status));
563
+ NotifyAvailable(State::kError);
564
+ }
565
+
566
+ const T& get() const {
567
+ assert(HasData());
568
+ return data_store_.data();
569
+ }
570
+
571
+ T& get() {
572
+ assert(HasData());
573
+ return data_store_.data();
574
+ }
575
+
576
+ // Construct the payload of the AsyncValue in place and change its state to
577
+ // kConcrete. Requires that this AsyncValue previously have state
578
+ // unavailable.
579
+ template <typename... Args>
580
+ void emplace(Args&&... args) {
581
+ data_store_.EmplaceData(std::forward<Args>(args)...);
582
+ NotifyAvailable(State::kConcrete);
583
+ }
584
+
585
+ static bool classof(const AsyncValue* v) {
586
+ return v->kind() == AsyncValue::Kind::kConcrete;
587
+ }
588
+
589
+ private:
590
+ friend class AsyncValue;
591
+
592
+ // Data and error layout when the payload does not inherit from
593
+ // KeepAsyncValuePayloadOnError. This type destructs the payload value on
594
+ // error. It never keeps both data and error alive at the same time.
595
+ class DataOrError {
596
+ public:
597
+ DataOrError() {}
598
+
599
+ explicit DataOrError(absl::Status status)
600
+ : error_{new absl::Status(std::move(status))} {}
601
+
602
+ template <typename... Args>
603
+ explicit DataOrError(TypeTag<T>, Args&&... args)
604
+ : data_{std::forward<Args>(args)...} {}
605
+
606
+ ~DataOrError() {}
607
+
608
+ void Destroy(State s) {
609
+ if (s == State::kError) {
610
+ delete error_;
611
+ } else if (s == State::kConstructed || s == State::kConcrete) {
612
+ data_.~T();
613
+ }
614
+ }
615
+
616
+ void SetError(State s, absl::Status status) {
617
+ assert(s == State::kUnconstructed || s == State::kConstructed);
618
+ if (s == State::kConstructed) {
619
+ data_.~T();
620
+ }
621
+ error_ = new absl::Status(std::move(status));
622
+ }
623
+
624
+ template <typename... Args>
625
+ void EmplaceData(Args&&... args) {
626
+ new (&data_) T(std::forward<Args>(args)...);
627
+ }
628
+
629
+ bool HasData(State s) const {
630
+ return s == State::kConstructed || s == State::kConcrete;
631
+ }
632
+
633
+ absl::Status& error() { return *error_; }
634
+ T& data() { return data_; }
635
+ const absl::Status& error() const { return *error_; }
636
+ const T& data() const { return data_; }
637
+
638
+ private:
639
+ friend class ConcreteAsyncValue;
640
+ union {
641
+ absl::Status* error_;
642
+ T data_;
643
+ };
644
+ };
645
+
646
+ // Data and error layout when the payload inherits from
647
+ // KeepAsyncValuePayloadOnError. This type does to destruct the payload value
648
+ // on error. It may keep both data and error alive at the same time.
649
+ class DataAndError {
650
+ public:
651
+ explicit DataAndError(absl::Status status) { SetError(std::move(status)); }
652
+
653
+ template <typename... Args>
654
+ explicit DataAndError(TypeTag<T>, Args&&... args) {
655
+ EmplaceData(std::forward<Args>(args)...);
656
+ }
657
+
658
+ void Destroy(State s) {
659
+ if (HasData()) data().~T();
660
+ error_.reset();
661
+ has_data_ = false;
662
+ }
663
+
664
+ void SetError(State s, absl::Status status) {
665
+ assert(!error_);
666
+ error_ = std::make_unique<absl::Status>(std::move(status));
667
+ }
668
+
669
+ template <typename... Args>
670
+ void EmplaceData(Args&&... args) {
671
+ assert(!HasData());
672
+ new (&data_) T(std::forward<Args>(args)...);
673
+ has_data_ = true;
674
+ }
675
+
676
+ T& data() { return *reinterpret_cast<T*>(&data_); }
677
+ const T& data() const { return *reinterpret_cast<const T*>(&data_); }
678
+
679
+ bool HasData(State s) const { return has_data_; }
680
+ bool HasData() const { return has_data_; }
681
+ const absl::Status& error() const { return *error_; }
682
+ absl::Status& error() { return *error_; }
683
+
684
+ private:
685
+ friend class ConcreteAsyncValue;
686
+ using StorageT = typename std::aligned_storage<sizeof(T), alignof(T)>::type;
687
+
688
+ StorageT data_;
689
+ bool has_data_ = false;
690
+ std::unique_ptr<absl::Status> error_;
691
+ };
692
+
693
+ using DataStoreT =
694
+ std::conditional_t<std::is_base_of_v<KeepAsyncValuePayloadOnError, T>,
695
+ DataAndError, DataOrError>;
696
+ DataStoreT data_store_;
697
+
698
+ void Destroy() { data_store_.Destroy(state()); }
699
+ bool HasData() const { return data_store_.HasData(state()); }
700
+
701
+ static void VerifyOffsets() {
702
+ static_assert(offsetof(ConcreteAsyncValue<T>, data_store_.data_) ==
703
+ AsyncValue::kDataOffset,
704
+ "Offset of ConcreteAsyncValue::data_ is assumed to be "
705
+ "AsyncValue::kDataOffset == 16");
706
+ static_assert(offsetof(ConcreteAsyncValue<T>, data_store_.error_) ==
707
+ AsyncValue::kDataOffset,
708
+ "Offset of ConcreteAsyncValue::error_ is assumed to be "
709
+ "AsyncValue::kDataOffset == 16");
710
+ }
711
+
712
+ static const uint16_t concrete_type_id_;
713
+ };
714
+
715
+ template <typename T>
716
+ const uint16_t ConcreteAsyncValue<T>::concrete_type_id_ =
717
+ AsyncValue::CreateTypeInfoAndReturnTypeId<T>();
718
+ } // namespace internal
719
+
720
+ struct DummyValueForErrorAsyncValue {};
721
+
722
+ class ErrorAsyncValue
723
+ : public internal::ConcreteAsyncValue<DummyValueForErrorAsyncValue> {
724
+ public:
725
+ ErrorAsyncValue(absl::Status status) // NOLINT
726
+ : internal::ConcreteAsyncValue<DummyValueForErrorAsyncValue>(
727
+ std::move(status)) {}
728
+ };
729
+
730
+ // IndirectAsyncValue represents an uncomputed AsyncValue of unspecified kind
731
+ // and type. IndirectAsyncValue is used when an AsyncValue must be returned,
732
+ // but the value it holds is not ready and the producer of the value doesn't
733
+ // know what type it will ultimately be, or whether it will be an error.
734
+ class IndirectAsyncValue : public AsyncValue {
735
+ friend class AsyncValue;
736
+
737
+ public:
738
+ IndirectAsyncValue()
739
+ : AsyncValue(Kind::kIndirect, State::kUnconstructed,
740
+ /*is_refcounted=*/true) {}
741
+
742
+ IndirectAsyncValue* AddRef() { return AddRef(1); }
743
+ IndirectAsyncValue* AddRef(uint32_t count) {
744
+ return static_cast<IndirectAsyncValue*>(AsyncValue::AddRef(count));
745
+ }
746
+
747
+ // Mark this IndirectAsyncValue as forwarding to the specified value. This
748
+ // gives the IndirectAsyncValue a +1 reference.
749
+ // This method must be called at most once.
750
+ void ForwardTo(RCReference<AsyncValue> value);
751
+
752
+ static bool classof(const AsyncValue* v) {
753
+ return v->kind() == AsyncValue::Kind::kIndirect;
754
+ }
755
+
756
+ bool IsUnique() const {
757
+ // In addition to checking the refcount of this IndirectAsyncValue, we also
758
+ // need to check the refcount of the underlying value. If the underlying
759
+ // value is not available, we conservatively return false.
760
+ return (refcount_.load(std::memory_order_acquire) == 1) && IsAvailable() &&
761
+ value_->IsUnique();
762
+ }
763
+
764
+ private:
765
+ ~IndirectAsyncValue() { Destroy(); }
766
+
767
+ void Destroy() {
768
+ if (value_) {
769
+ value_->DropRef();
770
+ value_ = nullptr;
771
+ }
772
+ }
773
+
774
+ AsyncValue* value_ = nullptr;
775
+ };
776
+
777
+ // -----------------------------------------------------------
778
+ // Implementation details follow. Clients should ignore them.
779
+ //
780
+ inline AsyncValue::~AsyncValue() {
781
+ assert(waiters_and_state_.load().waiter() == nullptr &&
782
+ "An async value with waiters should never have refcount of zero");
783
+ if (AsyncValueAllocationTrackingEnabled() && is_refcounted_)
784
+ total_allocated_async_values_.fetch_sub(1, std::memory_order_relaxed);
785
+
786
+ // Catch use-after-free errors more eagerly, by triggering the size assertion
787
+ // in the 'get' accessor.
788
+ type_id_ = ~0;
789
+ }
790
+
791
+ inline bool AsyncValue::IsAvailable() const {
792
+ auto s = state();
793
+ return s == State::kConcrete || s == State::kError;
794
+ }
795
+
796
+ inline bool AsyncValue::IsError() const { return state() == State::kError; }
797
+
798
+ inline bool AsyncValue::IsUnconstructed() const {
799
+ return state() == State::kUnconstructed;
800
+ }
801
+
802
+ inline bool AsyncValue::IsConstructed() const {
803
+ return state() == State::kConstructed;
804
+ }
805
+
806
+ inline bool AsyncValue::IsConcrete() const {
807
+ return state() == State::kConcrete;
808
+ }
809
+
810
+ // Return true if this is an IndirectAsyncValue that hasn't been resolved.
811
+ // Currently an IndirectAsyncValue is available if and only if it is resolved.
812
+ inline bool AsyncValue::IsUnresolvedIndirect() const {
813
+ return IsUnavailable() && (kind() == Kind::kIndirect);
814
+ }
815
+
816
+ inline bool AsyncValue::IsIndirect() const { return kind() == Kind::kIndirect; }
817
+
818
+ inline AsyncValue* AsyncValue::AddRef(uint32_t count) {
819
+ // Always enable reference counting in debug builds to verify that the use of
820
+ // async values is "ref count correct". In optimized builds the async value
821
+ // owner is responsible for destructing the non-reference-counted async value.
822
+ #if defined(NDEBUG)
823
+ if (!is_refcounted_) return this;
824
+ #endif
825
+
826
+ if (count > 0) {
827
+ assert(refcount_.load(std::memory_order_relaxed) > 0);
828
+ // Increasing the reference counter can always be done with
829
+ // memory_order_relaxed: New references to an object can only be formed from
830
+ // an existing reference, and passing an existing reference from one thread
831
+ // to another must already provide any required synchronization.
832
+ refcount_.fetch_add(count, std::memory_order_relaxed);
833
+ }
834
+ return this;
835
+ }
836
+
837
+ inline void AsyncValue::DropRef(uint32_t count) {
838
+ // Always enable reference counting in debug builds to verify that the use of
839
+ // async values is "ref count correct". In optimized builds the async value
840
+ // owner is responsible for destructing the non-reference-counted async value.
841
+ #if defined(NDEBUG)
842
+ if (!is_refcounted_) return;
843
+ #endif
844
+
845
+ assert(refcount_.load(std::memory_order_relaxed) > 0);
846
+ // We expect that `count` argument will often equal the actual reference count
847
+ // here; optimize for that. If `count` == reference count, only an acquire
848
+ // barrier is needed to prevent the effects of the deletion from leaking
849
+ // before this point.
850
+ auto is_last_ref = refcount_.load(std::memory_order_acquire) == count;
851
+ if (!is_last_ref) {
852
+ // If `count` != reference count, a release barrier is needed in
853
+ // addition to an acquire barrier so that prior changes by this thread
854
+ // cannot be seen to occur after this decrement.
855
+ is_last_ref =
856
+ refcount_.fetch_sub(count, std::memory_order_acq_rel) == count;
857
+ }
858
+ // Destroy this value if the refcount drops to zero.
859
+ if (is_last_ref) {
860
+ Destroy();
861
+ }
862
+ }
863
+
864
+ template <typename T>
865
+ const T& AsyncValue::GetConcreteValue() const {
866
+ // Make sure both T (the stored type) and BaseT have vtable_ptr or
867
+ // neither have the vtable_ptr.
868
+ assert(std::is_polymorphic<T>::value == has_vtable_);
869
+ assert(IsTypeIdCompatible<T>() && "Incorrect accessor");
870
+
871
+ const char* this_ptr = reinterpret_cast<const char*>(this);
872
+ return *reinterpret_cast<const T*>(this_ptr + AsyncValue::kDataOffset);
873
+ }
874
+
875
+ template <typename T>
876
+ const T& AsyncValue::get() const {
877
+ auto s = state();
878
+ (void)s;
879
+
880
+ switch (kind()) {
881
+ case Kind::kConcrete:
882
+ #ifndef NDEBUG
883
+ // TODO(ezhulenev): Use `DLOG_IF` when absl logging is available.
884
+ if (!GetTypeInfo().has_data(this)) {
885
+ std::cerr << "Cannot call get() when ConcreteAsyncValue" // Crash OK
886
+ << " isn't constructed; state: " << s.DebugString() << ","
887
+ << " error message: "
888
+ << (IsError() ? GetError().message() : "None");
889
+ std::abort();
890
+ }
891
+ #endif // NDEBUG
892
+ return GetConcreteValue<T>();
893
+ case Kind::kIndirect:
894
+ #ifndef NDEBUG
895
+ // TODO(ezhulenev): Use `DLOG_IF` when absl logging is available.
896
+ if (s != State::kConcrete) {
897
+ std::cerr << "Cannot call get() when IndirectAsyncValue" // Crash OK
898
+ << " isn't concrete; state: " << s.DebugString() << ","
899
+ << " error message: "
900
+ << (IsError() ? GetError().message() : "None");
901
+ std::abort();
902
+ }
903
+ #endif // NDEBUG
904
+ auto* iv_value = static_cast<const IndirectAsyncValue*>(this)->value_;
905
+ assert(iv_value && "Indirect value not resolved");
906
+ return iv_value->get<T>();
907
+ }
908
+ assert(false && "unexpected AsyncValue kind");
909
+ }
910
+
911
+ template <typename T>
912
+ T& AsyncValue::get() {
913
+ return const_cast<T&>(static_cast<const AsyncValue*>(this)->get<T>());
914
+ }
915
+
916
+ inline void AsyncValue::SetStateConcrete() {
917
+ assert(IsConstructed() && kind() == Kind::kConcrete);
918
+ NotifyAvailable(State::kConcrete);
919
+ }
920
+
921
+ template <typename T, typename... Args>
922
+ void AsyncValue::emplace(Args&&... args) {
923
+ assert(GetTypeId<T>() == type_id_ && "Incorrect accessor");
924
+ assert(IsUnconstructed() && kind() == Kind::kConcrete);
925
+
926
+ static_cast<internal::ConcreteAsyncValue<T>*>(this)->emplace(
927
+ std::forward<Args>(args)...);
928
+ }
929
+
930
+ // Returns the underlying error, or nullptr if there is none.
931
+ inline const absl::Status* AsyncValue::GetErrorIfPresent() const {
932
+ switch (kind()) {
933
+ case Kind::kConcrete: {
934
+ if (state() != State::kError) return nullptr;
935
+ return &GetTypeInfo().get_error(this);
936
+ }
937
+ case Kind::kIndirect: {
938
+ auto* iv_value = static_cast<const IndirectAsyncValue*>(this)->value_;
939
+ // Unresolved IndirectAsyncValues are not errors.
940
+ if (!iv_value) return nullptr;
941
+
942
+ assert(iv_value->kind() != Kind::kIndirect);
943
+ return iv_value->GetErrorIfPresent();
944
+ }
945
+ }
946
+ }
947
+
948
+ inline const absl::Status& AsyncValue::GetError() const {
949
+ auto* result = GetErrorIfPresent();
950
+ assert(result && "Cannot call GetError() when error isn't available.");
951
+ return *result;
952
+ }
953
+
954
+ template <typename WaiterT>
955
+ void AsyncValue::AndThen(WaiterT waiter) {
956
+ // Clients generally want to use AndThen without them each having to check
957
+ // to see if the value is present. Check for them, and immediately run the
958
+ // lambda if it is already here.
959
+ auto old_value = waiters_and_state_.load(std::memory_order_acquire);
960
+ if (old_value.state() == State::kConcrete ||
961
+ old_value.state() == State::kError) {
962
+ assert(old_value.waiter() == nullptr);
963
+ waiter();
964
+ return;
965
+ }
966
+ EnqueueWaiter(std::forward<WaiterT>(waiter), old_value);
967
+ }
968
+
969
+ inline void AsyncValue::Destroy() {
970
+ // Copy `is_refcounted` flag before destroying the async value object.
971
+ bool was_ref_counted = is_refcounted_;
972
+
973
+ if (kind() == Kind::kIndirect) {
974
+ // Depending on what the benchmarks say, it might make sense to remove this
975
+ // explicit check and instead make ~IndirectAsyncValue go through the
976
+ // GetTypeInfo().destructor case below.
977
+ static_cast<IndirectAsyncValue*>(this)->~IndirectAsyncValue();
978
+ if (was_ref_counted) internal::AlignedFree(this);
979
+ return;
980
+ }
981
+
982
+ GetTypeInfo().destructor(this);
983
+ if (was_ref_counted) internal::AlignedFree(this);
984
+ }
985
+
986
+ inline bool AsyncValue::IsUnique() const {
987
+ if (kind() != Kind::kIndirect) {
988
+ return refcount_.load(std::memory_order_acquire) == 1;
989
+ }
990
+
991
+ // If it is an IndirectAsyncValue, we also need to check the refcount of the
992
+ // underlying value.
993
+ return static_cast<const IndirectAsyncValue*>(this)->IsUnique();
994
+ }
995
+
996
+ } // namespace tsl
997
+
998
+ #endif // TENSORFLOW_TSL_CONCURRENCY_ASYNC_VALUE_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/concurrency/chain.h ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2022 Google LLC. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_CONCURRENCY_CHAIN_H_
17
+ #define TENSORFLOW_TSL_CONCURRENCY_CHAIN_H_
18
+
19
+ namespace tsl {
20
+
21
+ class Chain {};
22
+
23
+ } // namespace tsl
24
+
25
+ #endif // TENSORFLOW_TSL_CONCURRENCY_CHAIN_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/concurrency/concurrent_vector.h ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2022 Google LLC. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_CONCURRENCY_CONCURRENT_VECTOR_H_
17
+ #define TENSORFLOW_TSL_CONCURRENCY_CONCURRENT_VECTOR_H_
18
+
19
+ #include <algorithm>
20
+ #include <atomic>
21
+ #include <cassert>
22
+ #include <memory>
23
+ #include <vector>
24
+
25
+ #include "absl/synchronization/mutex.h"
26
+ #include "absl/types/span.h"
27
+
28
+ namespace tsl {
29
+ namespace internal {
30
+
31
+ // A simple concurrent sequential container that allows concurrent reads and
32
+ // writes and is optimized for read access. It is designed for the usage pattern
33
+ // where objects are inserted once but are read many times. The key difference
34
+ // between this data structure and std::vector is that when we re-allocate the
35
+ // underlying buffer, we do not free the previous buffer. This allows us to
36
+ // implement read access with a single atomic load.
37
+ //
38
+ // Sample usage:
39
+ //
40
+ // ConcurrentVector<T> vec;
41
+ //
42
+ // On the writer side, concurrent writers are allowed;
43
+ //
44
+ // size_t index1 = vec.emplace_back(args);
45
+ // size_t index2 = vec.emplace_back(args);
46
+ //
47
+ // On the reader side, concurrent readers are allowed.
48
+ //
49
+ // auto& t1 = vec[index1];
50
+ // auto& t2 = vec[index1];
51
+ //
52
+ // Requirements:
53
+ //
54
+ // Type T needs to be copyable.
55
+
56
+ template <typename T>
57
+ class ConcurrentVector {
58
+ public:
59
+ // Initialize the vector with the given initial_capapcity
60
+ explicit ConcurrentVector(size_t initial_capacity) : state_(0ull) {
61
+ // ConcurrentVector does not support inserting more than 2^64 elements,
62
+ // which should be more than enough for any reasonable use case.
63
+ all_allocated_elements_.reserve(65);
64
+ all_allocated_elements_.emplace_back();
65
+ auto& v = all_allocated_elements_.back();
66
+ v.reserve(std::max(static_cast<size_t>(1), initial_capacity));
67
+ }
68
+
69
+ T& operator[](size_t index) {
70
+ auto state = State::Decode(state_.load(std::memory_order_acquire));
71
+ assert(index < state.size);
72
+ // .data() is a workaround for libc++ assertions in operator[], which will
73
+ // cause data race when container is resized from another thread.
74
+ return all_allocated_elements_.data()[state.last_allocated].data()[index];
75
+ }
76
+
77
+ const T& operator[](size_t index) const {
78
+ auto state = State::Decode(state_.load(std::memory_order_acquire));
79
+ assert(index < state.size);
80
+ // .data() is a workaround for libc++ assertions in operator[], which will
81
+ // cause data race when container is resized from another thread.
82
+ return all_allocated_elements_.data()[state.last_allocated].data()[index];
83
+ }
84
+
85
+ absl::Span<const T> ToConstSpan() const {
86
+ auto state = State::Decode(state_.load(std::memory_order_acquire));
87
+ auto& storage = all_allocated_elements_[state.last_allocated];
88
+ // .data() is a workaround for libc++ assertions in operator[], which will
89
+ // cause data race when container is resized from another thread.
90
+ return absl::MakeConstSpan(storage.data(), state.size);
91
+ }
92
+
93
+ // Return the number of elements currently valid in this vector. The vector
94
+ // only grows, so this is conservative w.r.t. the execution of the current
95
+ // thread.
96
+ size_t size() const {
97
+ return State::Decode(state_.load(std::memory_order_relaxed)).size;
98
+ }
99
+
100
+ // Insert a new element at the end. If the current buffer is full, we allocate
101
+ // a new buffer with twice as much capacity and copy the items in the
102
+ // previous buffer over.
103
+ //
104
+ // Returns the index of the newly inserted item.
105
+ template <typename... Args>
106
+ size_t emplace_back(Args&&... args) {
107
+ absl::MutexLock lock(&mutex_);
108
+
109
+ auto& last = all_allocated_elements_.back();
110
+
111
+ if (last.size() < last.capacity()) {
112
+ // There is still room in the current vector without reallocation. Just
113
+ // add the new element there.
114
+ last.emplace_back(std::forward<Args>(args)...);
115
+
116
+ // Increment the size of the concurrent vector.
117
+ auto state = State::Decode(state_.load(std::memory_order_relaxed));
118
+ state.size += 1;
119
+ state_.store(state.Encode(), std::memory_order_release);
120
+
121
+ return state.size - 1; // return insertion index
122
+ }
123
+ // There is no more room in the current vector without reallocation.
124
+ // Allocate a new vector with twice as much capacity, copy the elements
125
+ // from the previous vector, and set elements_ to point to the data of the
126
+ // new vector.
127
+ auto& new_last = all_allocated_elements_.emplace_back();
128
+ auto& prev = *(all_allocated_elements_.rbegin() + 1);
129
+ new_last.reserve(prev.capacity() * 2);
130
+ assert(prev.size() == prev.capacity());
131
+
132
+ // Copy over the previous vector to the new vector.
133
+ new_last.insert(new_last.begin(), prev.begin(), prev.end());
134
+ new_last.emplace_back(std::forward<Args>(args)...);
135
+
136
+ // Increment the size of the concurrent vector and index of the last
137
+ // allocated vector.
138
+ auto state = State::Decode(state_.load(std::memory_order_relaxed));
139
+ state.last_allocated += 1;
140
+ state.size += 1;
141
+ state_.store(state.Encode(), std::memory_order_release);
142
+
143
+ return state.size - 1; // return insertion index
144
+ }
145
+
146
+ private:
147
+ // Concurrent vector state layout:
148
+ // - Low 32 bits encode the index of the last allocated vector.
149
+ // - High 32 bits encode the size of the concurrent vector.
150
+ static constexpr uint64_t kLastAllocatedMask = (1ull << 32) - 1;
151
+ static constexpr uint64_t kSizeMask = ((1ull << 32) - 1) << 32;
152
+
153
+ struct State {
154
+ uint64_t last_allocated; // index of last allocated vector
155
+ uint64_t size; // size of the concurrent vector
156
+
157
+ static State Decode(uint64_t state) {
158
+ uint64_t last_allocated = (state & kLastAllocatedMask);
159
+ uint64_t size = (state & kSizeMask) >> 32;
160
+ return {last_allocated, size};
161
+ }
162
+
163
+ uint64_t Encode() const { return (size << 32) | last_allocated; }
164
+ };
165
+
166
+ // Stores/loads to/from this atomic used to enforce happens-before
167
+ // relationship between emplace_back and operator[].
168
+ std::atomic<uint64_t> state_;
169
+
170
+ absl::Mutex mutex_;
171
+ std::vector<std::vector<T>> all_allocated_elements_;
172
+ };
173
+
174
+ } // namespace internal
175
+ } // namespace tsl
176
+
177
+ #endif // TENSORFLOW_TSL_CONCURRENCY_CONCURRENT_VECTOR_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/concurrency/ref_count.h ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2022 Google LLC. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_CONCURRENCY_REF_COUNT_H_
17
+ #define TENSORFLOW_TSL_CONCURRENCY_REF_COUNT_H_
18
+
19
+ #include <atomic>
20
+ #include <cassert>
21
+ #include <cstddef>
22
+ #include <type_traits>
23
+ #include <utility>
24
+
25
+ namespace tsl {
26
+
27
+ #ifndef NDEBUG
28
+ inline std::atomic<size_t> total_reference_counted_objects;
29
+
30
+ // Return the total number of reference-counted objects that are currently
31
+ // live in the process. This is intended for debugging/assertions only, and
32
+ // shouldn't be used for mainline logic in the runtime.
33
+ inline size_t GetNumReferenceCountedObjects() {
34
+ return total_reference_counted_objects.load(std::memory_order_relaxed);
35
+ }
36
+ inline void AddNumReferenceCountedObjects() {
37
+ total_reference_counted_objects.fetch_add(1, std::memory_order_relaxed);
38
+ }
39
+ inline void DropNumReferenceCountedObjects() {
40
+ total_reference_counted_objects.fetch_sub(1, std::memory_order_relaxed);
41
+ }
42
+ #else
43
+ inline void AddNumReferenceCountedObjects() {}
44
+ inline void DropNumReferenceCountedObjects() {}
45
+ #endif
46
+
47
+ // This class is a common base class for things that need an atomic reference
48
+ // count for ownership management.
49
+ //
50
+ // Subclasses of this are allowed to implement a Destroy() instance method,
51
+ // which allows custom allocation/deallocation logic.
52
+ //
53
+ // This class intentionally doesn't have a virtual destructor or anything else
54
+ // that would require a vtable, but subclasses can have one if they choose.
55
+ template <typename SubClass>
56
+ class ReferenceCounted {
57
+ public:
58
+ ReferenceCounted() : ReferenceCounted(1) {}
59
+ explicit ReferenceCounted(unsigned ref_count) : ref_count_(ref_count) {
60
+ AddNumReferenceCountedObjects();
61
+ }
62
+
63
+ ~ReferenceCounted() {
64
+ assert(ref_count_.load() == 0 &&
65
+ "Shouldn't destroy a reference counted object with references!");
66
+ DropNumReferenceCountedObjects();
67
+ }
68
+
69
+ // Not copyable or movable.
70
+ ReferenceCounted(const ReferenceCounted&) = delete;
71
+ ReferenceCounted& operator=(const ReferenceCounted&) = delete;
72
+
73
+ // Add a new reference to this object.
74
+ void AddRef() {
75
+ assert(ref_count_.load(std::memory_order_relaxed) >= 1);
76
+ // It is OK to use std::memory_order_relaxed here as it does not affect the
77
+ // ownership state of the object.
78
+ ref_count_.fetch_add(1, std::memory_order_relaxed);
79
+ }
80
+
81
+ // Drop a reference to this object, potentially deallocating it.
82
+ void DropRef() {
83
+ assert(ref_count_.load(std::memory_order_relaxed) > 0);
84
+
85
+ // If ref_count_==1, this object is owned only by the caller. Bypass a
86
+ // locked op in that case.
87
+ if (ref_count_.load(std::memory_order_acquire) == 1 ||
88
+ ref_count_.fetch_sub(1, std::memory_order_acq_rel) == 1) {
89
+ // Make assert in ~ReferenceCounted happy
90
+ assert((ref_count_.store(0, std::memory_order_relaxed), true));
91
+ static_cast<SubClass*>(this)->Destroy();
92
+ }
93
+ }
94
+
95
+ // Return reference count. This should be used for testing and debugging only.
96
+ uint32_t NumRef() const { return ref_count_.load(); }
97
+
98
+ // Return true if reference count is 1.
99
+ bool IsUnique() const {
100
+ return ref_count_.load(std::memory_order_acquire) == 1;
101
+ }
102
+
103
+ protected:
104
+ // Subclasses are allowed to customize this, but the default implementation of
105
+ // Destroy() just deletes the pointer.
106
+ void Destroy() { delete static_cast<SubClass*>(this); }
107
+
108
+ private:
109
+ std::atomic<unsigned> ref_count_;
110
+ };
111
+
112
+ // This is a smart pointer that keeps the specified reference counted value
113
+ // around. It is move-only to avoid accidental copies, but it can be copied
114
+ // explicitly.
115
+ template <typename T>
116
+ class RCReference {
117
+ public:
118
+ RCReference() : pointer_(nullptr) {}
119
+
120
+ RCReference(RCReference&& other) : pointer_(other.pointer_) {
121
+ other.pointer_ = nullptr;
122
+ }
123
+
124
+ RCReference(const RCReference& other) : pointer_(other.pointer_) {
125
+ if (pointer_) pointer_->AddRef();
126
+ }
127
+
128
+ RCReference& operator=(RCReference&& other) {
129
+ reset(other.pointer_);
130
+ other.pointer_ = nullptr;
131
+ return *this;
132
+ }
133
+
134
+ RCReference& operator=(const RCReference& other) {
135
+ reset(other.pointer_);
136
+ if (pointer_) pointer_->AddRef();
137
+ return *this;
138
+ }
139
+
140
+ // Support implicit conversion from RCReference<Derived> to RCReference<Base>.
141
+ template <typename U,
142
+ typename = std::enable_if_t<std::is_base_of<T, U>::value>>
143
+ RCReference(RCReference<U>&& u) : pointer_(u.pointer_) { // NOLINT
144
+ u.pointer_ = nullptr;
145
+ }
146
+ template <typename U,
147
+ typename = std::enable_if_t<std::is_base_of<T, U>::value>>
148
+ RCReference(const RCReference<U>& u) : pointer_(u.pointer_) { // NOLINT
149
+ if (pointer_) pointer_->AddRef();
150
+ }
151
+
152
+ ~RCReference() {
153
+ if (pointer_ != nullptr) pointer_->DropRef();
154
+ }
155
+
156
+ void reset(T* pointer = nullptr) {
157
+ if (pointer_ != nullptr) pointer_->DropRef();
158
+ pointer_ = pointer;
159
+ }
160
+
161
+ T* release() {
162
+ T* tmp = pointer_;
163
+ pointer_ = nullptr;
164
+ return tmp;
165
+ }
166
+
167
+ T& operator*() const {
168
+ assert(pointer_ && "null RCReference");
169
+ return *pointer_;
170
+ }
171
+
172
+ T* operator->() const {
173
+ assert(pointer_ && "null RCReference");
174
+ return pointer_;
175
+ }
176
+
177
+ // Return a raw pointer.
178
+ T* get() const { return pointer_; }
179
+
180
+ // Make an explicit copy of this RCReference, increasing the refcount by one.
181
+ [[deprecated("Use copy constructor instead.")]] RCReference CopyRef() const;
182
+
183
+ explicit operator bool() const { return pointer_ != nullptr; }
184
+
185
+ void swap(RCReference& other) {
186
+ using std::swap;
187
+ swap(pointer_, other.pointer_);
188
+ }
189
+
190
+ bool operator==(const RCReference& ref) const {
191
+ return pointer_ == ref.pointer_;
192
+ }
193
+ bool operator!=(const RCReference& ref) const {
194
+ return pointer_ != ref.pointer_;
195
+ }
196
+
197
+ friend bool operator==(const RCReference& ref, std::nullptr_t) {
198
+ return ref.pointer_ == nullptr;
199
+ }
200
+ friend bool operator==(std::nullptr_t, const RCReference& ref) {
201
+ return ref.pointer_ == nullptr;
202
+ }
203
+ friend bool operator!=(const RCReference& ref, std::nullptr_t) {
204
+ return ref.pointer_ != nullptr;
205
+ }
206
+ friend bool operator!=(std::nullptr_t, const RCReference& ref) {
207
+ return ref.pointer_ != nullptr;
208
+ }
209
+
210
+ template <typename R>
211
+ friend RCReference<R> FormRef(R*);
212
+ template <typename R>
213
+ friend RCReference<R> TakeRef(R*);
214
+
215
+ private:
216
+ T* pointer_;
217
+
218
+ template <typename R>
219
+ friend class RCReference;
220
+ };
221
+
222
+ // Add a new reference to the specified pointer.
223
+ template <typename T>
224
+ RCReference<T> FormRef(T* pointer) {
225
+ RCReference<T> ref;
226
+ ref.pointer_ = pointer;
227
+ pointer->AddRef();
228
+ return ref;
229
+ }
230
+
231
+ // Return an RCReference for the specified object and *takes ownership* of a
232
+ // +1 reference. When destroyed, this will drop the reference.
233
+ template <typename T>
234
+ RCReference<T> TakeRef(T* pointer) {
235
+ RCReference<T> ref;
236
+ ref.pointer_ = pointer;
237
+ return ref;
238
+ }
239
+
240
+ template <typename T>
241
+ RCReference<T> RCReference<T>::CopyRef() const {
242
+ if (!pointer_) return RCReference();
243
+ return FormRef(get());
244
+ }
245
+
246
+ // Create a new reference counted object, similar to std::make_shared.
247
+ template <typename T, typename... Args>
248
+ RCReference<T> MakeRef(Args&&... args) {
249
+ auto t = new T(std::forward<Args>(args)...);
250
+ return TakeRef(t);
251
+ }
252
+ // For ADL style swap.
253
+ template <typename T>
254
+ void swap(RCReference<T>& a, RCReference<T>& b) {
255
+ a.swap(b);
256
+ }
257
+
258
+ } // namespace tsl
259
+
260
+ #endif // TENSORFLOW_TSL_CONCURRENCY_REF_COUNT_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/cuda/cublas.inc ADDED
@@ -0,0 +1,736 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "cublasAlloc",
2
+ "cublasAsumEx",
3
+ "cublasAsumEx_64",
4
+ "cublasAxpyEx",
5
+ "cublasAxpyEx_64",
6
+ "cublasCaxpy",
7
+ "cublasCaxpy_v2",
8
+ "cublasCaxpy_v2_64",
9
+ "cublasCbdmm",
10
+ "cublasCcopy",
11
+ "cublasCcopy_v2",
12
+ "cublasCcopy_v2_64",
13
+ "cublasCdgmm",
14
+ "cublasCdgmm_64",
15
+ "cublasCdotc",
16
+ "cublasCdotc_v2",
17
+ "cublasCdotc_v2_64",
18
+ "cublasCdotu",
19
+ "cublasCdotu_v2",
20
+ "cublasCdotu_v2_64",
21
+ "cublasCgbmv",
22
+ "cublasCgbmv_v2",
23
+ "cublasCgbmv_v2_64",
24
+ "cublasCgeam",
25
+ "cublasCgeam_64",
26
+ "cublasCgelsBatched",
27
+ "cublasCgemm",
28
+ "cublasCgemm3m",
29
+ "cublasCgemm3mBatched",
30
+ "cublasCgemm3mBatched_64",
31
+ "cublasCgemm3mEx",
32
+ "cublasCgemm3mEx_64",
33
+ "cublasCgemm3mStridedBatched",
34
+ "cublasCgemm3mStridedBatched_64",
35
+ "cublasCgemm3m_64",
36
+ "cublasCgemmBatched",
37
+ "cublasCgemmBatched_64",
38
+ "cublasCgemmEx",
39
+ "cublasCgemmEx_64",
40
+ "cublasCgemmStridedBatched",
41
+ "cublasCgemmStridedBatched_64",
42
+ "cublasCgemm_v2",
43
+ "cublasCgemm_v2_64",
44
+ "cublasCgemv",
45
+ "cublasCgemvBatched",
46
+ "cublasCgemvBatched_64",
47
+ "cublasCgemvStridedBatched",
48
+ "cublasCgemvStridedBatched_64",
49
+ "cublasCgemv_v2",
50
+ "cublasCgemv_v2_64",
51
+ "cublasCgeqrfBatched",
52
+ "cublasCgerc",
53
+ "cublasCgerc_v2",
54
+ "cublasCgerc_v2_64",
55
+ "cublasCgeru",
56
+ "cublasCgeru_v2",
57
+ "cublasCgeru_v2_64",
58
+ "cublasCgetrfBatched",
59
+ "cublasCgetriBatched",
60
+ "cublasCgetrsBatched",
61
+ "cublasChbmv",
62
+ "cublasChbmv_v2",
63
+ "cublasChbmv_v2_64",
64
+ "cublasChemm",
65
+ "cublasChemm_v2",
66
+ "cublasChemm_v2_64",
67
+ "cublasChemv",
68
+ "cublasChemv_v2",
69
+ "cublasChemv_v2_64",
70
+ "cublasCher",
71
+ "cublasCher2",
72
+ "cublasCher2_v2",
73
+ "cublasCher2_v2_64",
74
+ "cublasCher2k",
75
+ "cublasCher2k_v2",
76
+ "cublasCher2k_v2_64",
77
+ "cublasCher_v2",
78
+ "cublasCher_v2_64",
79
+ "cublasCherk",
80
+ "cublasCherk3mEx",
81
+ "cublasCherk3mEx_64",
82
+ "cublasCherkEx",
83
+ "cublasCherkEx_64",
84
+ "cublasCherk_v2",
85
+ "cublasCherk_v2_64",
86
+ "cublasCherkx",
87
+ "cublasCherkx_64",
88
+ "cublasChpmv",
89
+ "cublasChpmv_v2",
90
+ "cublasChpmv_v2_64",
91
+ "cublasChpr",
92
+ "cublasChpr2",
93
+ "cublasChpr2_v2",
94
+ "cublasChpr2_v2_64",
95
+ "cublasChpr_v2",
96
+ "cublasChpr_v2_64",
97
+ "cublasCmatinvBatched",
98
+ "cublasCopyEx",
99
+ "cublasCopyEx_64",
100
+ "cublasCreate_v2",
101
+ "cublasCrot",
102
+ "cublasCrot_v2",
103
+ "cublasCrot_v2_64",
104
+ "cublasCrotg",
105
+ "cublasCrotg_v2",
106
+ "cublasCscal",
107
+ "cublasCscal_v2",
108
+ "cublasCscal_v2_64",
109
+ "cublasCsrot",
110
+ "cublasCsrot_v2",
111
+ "cublasCsrot_v2_64",
112
+ "cublasCsscal",
113
+ "cublasCsscal_v2",
114
+ "cublasCsscal_v2_64",
115
+ "cublasCswap",
116
+ "cublasCswap_v2",
117
+ "cublasCswap_v2_64",
118
+ "cublasCsymm",
119
+ "cublasCsymm_v2",
120
+ "cublasCsymm_v2_64",
121
+ "cublasCsymv_v2",
122
+ "cublasCsymv_v2_64",
123
+ "cublasCsyr2_v2",
124
+ "cublasCsyr2_v2_64",
125
+ "cublasCsyr2k",
126
+ "cublasCsyr2k_v2",
127
+ "cublasCsyr2k_v2_64",
128
+ "cublasCsyr_v2",
129
+ "cublasCsyr_v2_64",
130
+ "cublasCsyrk",
131
+ "cublasCsyrk3mEx",
132
+ "cublasCsyrk3mEx_64",
133
+ "cublasCsyrkEx",
134
+ "cublasCsyrkEx_64",
135
+ "cublasCsyrk_v2",
136
+ "cublasCsyrk_v2_64",
137
+ "cublasCsyrkx",
138
+ "cublasCsyrkx_64",
139
+ "cublasCtbmv",
140
+ "cublasCtbmv_v2",
141
+ "cublasCtbmv_v2_64",
142
+ "cublasCtbsv",
143
+ "cublasCtbsv_v2",
144
+ "cublasCtbsv_v2_64",
145
+ "cublasCtpmv",
146
+ "cublasCtpmv_v2",
147
+ "cublasCtpmv_v2_64",
148
+ "cublasCtpsv",
149
+ "cublasCtpsv_v2",
150
+ "cublasCtpsv_v2_64",
151
+ "cublasCtpttr",
152
+ "cublasCtrmm",
153
+ "cublasCtrmm_v2",
154
+ "cublasCtrmm_v2_64",
155
+ "cublasCtrmv",
156
+ "cublasCtrmv_v2",
157
+ "cublasCtrmv_v2_64",
158
+ "cublasCtrsm",
159
+ "cublasCtrsmBatched",
160
+ "cublasCtrsmBatched_64",
161
+ "cublasCtrsm_v2",
162
+ "cublasCtrsm_v2_64",
163
+ "cublasCtrsv",
164
+ "cublasCtrsv_v2",
165
+ "cublasCtrsv_v2_64",
166
+ "cublasCtrttp",
167
+ "cublasDasum",
168
+ "cublasDasum_v2",
169
+ "cublasDasum_v2_64",
170
+ "cublasDaxpy",
171
+ "cublasDaxpy_v2",
172
+ "cublasDaxpy_v2_64",
173
+ "cublasDbdmm",
174
+ "cublasDcopy",
175
+ "cublasDcopy_v2",
176
+ "cublasDcopy_v2_64",
177
+ "cublasDdgmm",
178
+ "cublasDdgmm_64",
179
+ "cublasDdot",
180
+ "cublasDdot_v2",
181
+ "cublasDdot_v2_64",
182
+ "cublasDestroy_v2",
183
+ "cublasDgbmv",
184
+ "cublasDgbmv_v2",
185
+ "cublasDgbmv_v2_64",
186
+ "cublasDgeam",
187
+ "cublasDgeam_64",
188
+ "cublasDgelsBatched",
189
+ "cublasDgemm",
190
+ "cublasDgemmBatched",
191
+ "cublasDgemmBatched_64",
192
+ "cublasDgemmStridedBatched",
193
+ "cublasDgemmStridedBatched_64",
194
+ "cublasDgemm_v2",
195
+ "cublasDgemm_v2_64",
196
+ "cublasDgemv",
197
+ "cublasDgemvBatched",
198
+ "cublasDgemvBatched_64",
199
+ "cublasDgemvStridedBatched",
200
+ "cublasDgemvStridedBatched_64",
201
+ "cublasDgemv_v2",
202
+ "cublasDgemv_v2_64",
203
+ "cublasDgeqrfBatched",
204
+ "cublasDger",
205
+ "cublasDger_v2",
206
+ "cublasDger_v2_64",
207
+ "cublasDgetrfBatched",
208
+ "cublasDgetriBatched",
209
+ "cublasDgetrsBatched",
210
+ "cublasDmatinvBatched",
211
+ "cublasDnrm2",
212
+ "cublasDnrm2_v2",
213
+ "cublasDnrm2_v2_64",
214
+ "cublasDotEx",
215
+ "cublasDotEx_64",
216
+ "cublasDotcEx",
217
+ "cublasDotcEx_64",
218
+ "cublasDrot",
219
+ "cublasDrot_v2",
220
+ "cublasDrot_v2_64",
221
+ "cublasDrotg",
222
+ "cublasDrotg_v2",
223
+ "cublasDrotm",
224
+ "cublasDrotm_v2",
225
+ "cublasDrotm_v2_64",
226
+ "cublasDrotmg",
227
+ "cublasDrotmg_v2",
228
+ "cublasDsbmv",
229
+ "cublasDsbmv_v2",
230
+ "cublasDsbmv_v2_64",
231
+ "cublasDscal",
232
+ "cublasDscal_v2",
233
+ "cublasDscal_v2_64",
234
+ "cublasDspmv",
235
+ "cublasDspmv_v2",
236
+ "cublasDspmv_v2_64",
237
+ "cublasDspr",
238
+ "cublasDspr2",
239
+ "cublasDspr2_v2",
240
+ "cublasDspr2_v2_64",
241
+ "cublasDspr_v2",
242
+ "cublasDspr_v2_64",
243
+ "cublasDswap",
244
+ "cublasDswap_v2",
245
+ "cublasDswap_v2_64",
246
+ "cublasDsymm",
247
+ "cublasDsymm_v2",
248
+ "cublasDsymm_v2_64",
249
+ "cublasDsymv",
250
+ "cublasDsymv_v2",
251
+ "cublasDsymv_v2_64",
252
+ "cublasDsyr",
253
+ "cublasDsyr2",
254
+ "cublasDsyr2_v2",
255
+ "cublasDsyr2_v2_64",
256
+ "cublasDsyr2k",
257
+ "cublasDsyr2k_v2",
258
+ "cublasDsyr2k_v2_64",
259
+ "cublasDsyr_v2",
260
+ "cublasDsyr_v2_64",
261
+ "cublasDsyrk",
262
+ "cublasDsyrk_v2",
263
+ "cublasDsyrk_v2_64",
264
+ "cublasDsyrkx",
265
+ "cublasDsyrkx_64",
266
+ "cublasDtbmv",
267
+ "cublasDtbmv_v2",
268
+ "cublasDtbmv_v2_64",
269
+ "cublasDtbsv",
270
+ "cublasDtbsv_v2",
271
+ "cublasDtbsv_v2_64",
272
+ "cublasDtpmv",
273
+ "cublasDtpmv_v2",
274
+ "cublasDtpmv_v2_64",
275
+ "cublasDtpsv",
276
+ "cublasDtpsv_v2",
277
+ "cublasDtpsv_v2_64",
278
+ "cublasDtpttr",
279
+ "cublasDtrmm",
280
+ "cublasDtrmm_v2",
281
+ "cublasDtrmm_v2_64",
282
+ "cublasDtrmv",
283
+ "cublasDtrmv_v2",
284
+ "cublasDtrmv_v2_64",
285
+ "cublasDtrsm",
286
+ "cublasDtrsmBatched",
287
+ "cublasDtrsmBatched_64",
288
+ "cublasDtrsm_v2",
289
+ "cublasDtrsm_v2_64",
290
+ "cublasDtrsv",
291
+ "cublasDtrsv_v2",
292
+ "cublasDtrsv_v2_64",
293
+ "cublasDtrttp",
294
+ "cublasDzasum",
295
+ "cublasDzasum_v2",
296
+ "cublasDzasum_v2_64",
297
+ "cublasDznrm2",
298
+ "cublasDznrm2_v2",
299
+ "cublasDznrm2_v2_64",
300
+ "cublasFree",
301
+ "cublasGemmBatchedEx",
302
+ "cublasGemmBatchedEx_64",
303
+ "cublasGemmEx",
304
+ "cublasGemmEx_64",
305
+ "cublasGemmStridedBatchedEx",
306
+ "cublasGemmStridedBatchedEx_64",
307
+ "cublasGetAtomicsMode",
308
+ "cublasGetBackdoor",
309
+ "cublasGetCudartVersion",
310
+ "cublasGetError",
311
+ "cublasGetLoggerCallback",
312
+ "cublasGetMathMode",
313
+ "cublasGetMatrix",
314
+ "cublasGetMatrixAsync",
315
+ "cublasGetMatrixAsync_64",
316
+ "cublasGetMatrix_64",
317
+ "cublasGetPointerMode_v2",
318
+ "cublasGetProperty",
319
+ "cublasGetSmCountTarget",
320
+ "cublasGetStatusName",
321
+ "cublasGetStatusString",
322
+ "cublasGetStream_v2",
323
+ "cublasGetVector",
324
+ "cublasGetVectorAsync",
325
+ "cublasGetVectorAsync_64",
326
+ "cublasGetVector_64",
327
+ "cublasGetVersion",
328
+ "cublasGetVersion_v2",
329
+ "cublasHSHgemvBatched",
330
+ "cublasHSHgemvBatched_64",
331
+ "cublasHSHgemvStridedBatched",
332
+ "cublasHSHgemvStridedBatched_64",
333
+ "cublasHSSgemvBatched",
334
+ "cublasHSSgemvBatched_64",
335
+ "cublasHSSgemvStridedBatched",
336
+ "cublasHSSgemvStridedBatched_64",
337
+ "cublasHgemm",
338
+ "cublasHgemmBatched",
339
+ "cublasHgemmBatched_64",
340
+ "cublasHgemmStridedBatched",
341
+ "cublasHgemmStridedBatched_64",
342
+ "cublasHgemm_64",
343
+ "cublasIamaxEx",
344
+ "cublasIamaxEx_64",
345
+ "cublasIaminEx",
346
+ "cublasIaminEx_64",
347
+ "cublasIcamax",
348
+ "cublasIcamax_v2",
349
+ "cublasIcamax_v2_64",
350
+ "cublasIcamin",
351
+ "cublasIcamin_v2",
352
+ "cublasIcamin_v2_64",
353
+ "cublasIdamax",
354
+ "cublasIdamax_v2",
355
+ "cublasIdamax_v2_64",
356
+ "cublasIdamin",
357
+ "cublasIdamin_v2",
358
+ "cublasIdamin_v2_64",
359
+ "cublasInit",
360
+ "cublasIsamax",
361
+ "cublasIsamax_v2",
362
+ "cublasIsamax_v2_64",
363
+ "cublasIsamin",
364
+ "cublasIsamin_v2",
365
+ "cublasIsamin_v2_64",
366
+ "cublasIzamax",
367
+ "cublasIzamax_v2",
368
+ "cublasIzamax_v2_64",
369
+ "cublasIzamin",
370
+ "cublasIzamin_v2",
371
+ "cublasIzamin_v2_64",
372
+ "cublasLoggerConfigure",
373
+ "cublasNrm2Ex",
374
+ "cublasNrm2Ex_64",
375
+ "cublasRotEx",
376
+ "cublasRotEx_64",
377
+ "cublasRotgEx",
378
+ "cublasRotmEx",
379
+ "cublasRotmEx_64",
380
+ "cublasRotmgEx",
381
+ "cublasSasum",
382
+ "cublasSasum_v2",
383
+ "cublasSasum_v2_64",
384
+ "cublasSaxpy",
385
+ "cublasSaxpy_v2",
386
+ "cublasSaxpy_v2_64",
387
+ "cublasSbdmm",
388
+ "cublasScalEx",
389
+ "cublasScalEx_64",
390
+ "cublasScasum",
391
+ "cublasScasum_v2",
392
+ "cublasScasum_v2_64",
393
+ "cublasScnrm2",
394
+ "cublasScnrm2_v2",
395
+ "cublasScnrm2_v2_64",
396
+ "cublasScopy",
397
+ "cublasScopy_v2",
398
+ "cublasScopy_v2_64",
399
+ "cublasSdgmm",
400
+ "cublasSdgmm_64",
401
+ "cublasSdot",
402
+ "cublasSdot_v2",
403
+ "cublasSdot_v2_64",
404
+ "cublasSetAtomicsMode",
405
+ "cublasSetBackdoor",
406
+ "cublasSetBackdoorEx",
407
+ "cublasSetKernelStream",
408
+ "cublasSetLoggerCallback",
409
+ "cublasSetMathMode",
410
+ "cublasSetMatrix",
411
+ "cublasSetMatrixAsync",
412
+ "cublasSetMatrixAsync_64",
413
+ "cublasSetMatrix_64",
414
+ "cublasSetPointerMode_v2",
415
+ "cublasSetSmCountTarget",
416
+ "cublasSetStream_v2",
417
+ "cublasSetVector",
418
+ "cublasSetVectorAsync",
419
+ "cublasSetVectorAsync_64",
420
+ "cublasSetVector_64",
421
+ "cublasSetWorkspace_v2",
422
+ "cublasSgbmv",
423
+ "cublasSgbmv_v2",
424
+ "cublasSgbmv_v2_64",
425
+ "cublasSgeam",
426
+ "cublasSgeam_64",
427
+ "cublasSgelsBatched",
428
+ "cublasSgemm",
429
+ "cublasSgemmBatched",
430
+ "cublasSgemmBatched_64",
431
+ "cublasSgemmEx",
432
+ "cublasSgemmEx_64",
433
+ "cublasSgemmStridedBatched",
434
+ "cublasSgemmStridedBatched_64",
435
+ "cublasSgemm_v2",
436
+ "cublasSgemm_v2_64",
437
+ "cublasSgemv",
438
+ "cublasSgemvBatched",
439
+ "cublasSgemvBatched_64",
440
+ "cublasSgemvStridedBatched",
441
+ "cublasSgemvStridedBatched_64",
442
+ "cublasSgemv_v2",
443
+ "cublasSgemv_v2_64",
444
+ "cublasSgeqrfBatched",
445
+ "cublasSger",
446
+ "cublasSger_v2",
447
+ "cublasSger_v2_64",
448
+ "cublasSgetrfBatched",
449
+ "cublasSgetriBatched",
450
+ "cublasSgetrsBatched",
451
+ "cublasShutdown",
452
+ "cublasSmatinvBatched",
453
+ "cublasSnrm2",
454
+ "cublasSnrm2_v2",
455
+ "cublasSnrm2_v2_64",
456
+ "cublasSrot",
457
+ "cublasSrot_v2",
458
+ "cublasSrot_v2_64",
459
+ "cublasSrotg",
460
+ "cublasSrotg_v2",
461
+ "cublasSrotm",
462
+ "cublasSrotm_v2",
463
+ "cublasSrotm_v2_64",
464
+ "cublasSrotmg",
465
+ "cublasSrotmg_v2",
466
+ "cublasSsbmv",
467
+ "cublasSsbmv_v2",
468
+ "cublasSsbmv_v2_64",
469
+ "cublasSscal",
470
+ "cublasSscal_v2",
471
+ "cublasSscal_v2_64",
472
+ "cublasSspmv",
473
+ "cublasSspmv_v2",
474
+ "cublasSspmv_v2_64",
475
+ "cublasSspr",
476
+ "cublasSspr2",
477
+ "cublasSspr2_v2",
478
+ "cublasSspr2_v2_64",
479
+ "cublasSspr_v2",
480
+ "cublasSspr_v2_64",
481
+ "cublasSswap",
482
+ "cublasSswap_v2",
483
+ "cublasSswap_v2_64",
484
+ "cublasSsymm",
485
+ "cublasSsymm_v2",
486
+ "cublasSsymm_v2_64",
487
+ "cublasSsymv",
488
+ "cublasSsymv_v2",
489
+ "cublasSsymv_v2_64",
490
+ "cublasSsyr",
491
+ "cublasSsyr2",
492
+ "cublasSsyr2_v2",
493
+ "cublasSsyr2_v2_64",
494
+ "cublasSsyr2k",
495
+ "cublasSsyr2k_v2",
496
+ "cublasSsyr2k_v2_64",
497
+ "cublasSsyr_v2",
498
+ "cublasSsyr_v2_64",
499
+ "cublasSsyrk",
500
+ "cublasSsyrk_v2",
501
+ "cublasSsyrk_v2_64",
502
+ "cublasSsyrkx",
503
+ "cublasSsyrkx_64",
504
+ "cublasStbmv",
505
+ "cublasStbmv_v2",
506
+ "cublasStbmv_v2_64",
507
+ "cublasStbsv",
508
+ "cublasStbsv_v2",
509
+ "cublasStbsv_v2_64",
510
+ "cublasStpmv",
511
+ "cublasStpmv_v2",
512
+ "cublasStpmv_v2_64",
513
+ "cublasStpsv",
514
+ "cublasStpsv_v2",
515
+ "cublasStpsv_v2_64",
516
+ "cublasStpttr",
517
+ "cublasStrmm",
518
+ "cublasStrmm_v2",
519
+ "cublasStrmm_v2_64",
520
+ "cublasStrmv",
521
+ "cublasStrmv_v2",
522
+ "cublasStrmv_v2_64",
523
+ "cublasStrsm",
524
+ "cublasStrsmBatched",
525
+ "cublasStrsmBatched_64",
526
+ "cublasStrsm_v2",
527
+ "cublasStrsm_v2_64",
528
+ "cublasStrsv",
529
+ "cublasStrsv_v2",
530
+ "cublasStrsv_v2_64",
531
+ "cublasStrttp",
532
+ "cublasSwapEx",
533
+ "cublasSwapEx_64",
534
+ "cublasTSSgemvBatched",
535
+ "cublasTSSgemvBatched_64",
536
+ "cublasTSSgemvStridedBatched",
537
+ "cublasTSSgemvStridedBatched_64",
538
+ "cublasTSTgemvBatched",
539
+ "cublasTSTgemvBatched_64",
540
+ "cublasTSTgemvStridedBatched",
541
+ "cublasTSTgemvStridedBatched_64",
542
+ "cublasUint8gemmBias",
543
+ "cublasXerbla",
544
+ "cublasXtCgemm",
545
+ "cublasXtChemm",
546
+ "cublasXtCher2k",
547
+ "cublasXtCherk",
548
+ "cublasXtCherkx",
549
+ "cublasXtCreate",
550
+ "cublasXtCspmm",
551
+ "cublasXtCsymm",
552
+ "cublasXtCsyr2k",
553
+ "cublasXtCsyrk",
554
+ "cublasXtCsyrkx",
555
+ "cublasXtCtrmm",
556
+ "cublasXtCtrsm",
557
+ "cublasXtDestroy",
558
+ "cublasXtDeviceSelect",
559
+ "cublasXtDgemm",
560
+ "cublasXtDspmm",
561
+ "cublasXtDsymm",
562
+ "cublasXtDsyr2k",
563
+ "cublasXtDsyrk",
564
+ "cublasXtDsyrkx",
565
+ "cublasXtDtrmm",
566
+ "cublasXtDtrsm",
567
+ "cublasXtGetBlockDim",
568
+ "cublasXtGetNumBoards",
569
+ "cublasXtGetPinningMemMode",
570
+ "cublasXtMaxBoards",
571
+ "cublasXtSetBlockDim",
572
+ "cublasXtSetCpuRatio",
573
+ "cublasXtSetCpuRoutine",
574
+ "cublasXtSetPinningMemMode",
575
+ "cublasXtSgemm",
576
+ "cublasXtSspmm",
577
+ "cublasXtSsymm",
578
+ "cublasXtSsyr2k",
579
+ "cublasXtSsyrk",
580
+ "cublasXtSsyrkx",
581
+ "cublasXtStrmm",
582
+ "cublasXtStrsm",
583
+ "cublasXtZgemm",
584
+ "cublasXtZhemm",
585
+ "cublasXtZher2k",
586
+ "cublasXtZherk",
587
+ "cublasXtZherkx",
588
+ "cublasXtZspmm",
589
+ "cublasXtZsymm",
590
+ "cublasXtZsyr2k",
591
+ "cublasXtZsyrk",
592
+ "cublasXtZsyrkx",
593
+ "cublasXtZtrmm",
594
+ "cublasXtZtrsm",
595
+ "cublasZaxpy",
596
+ "cublasZaxpy_v2",
597
+ "cublasZaxpy_v2_64",
598
+ "cublasZbdmm",
599
+ "cublasZcopy",
600
+ "cublasZcopy_v2",
601
+ "cublasZcopy_v2_64",
602
+ "cublasZdgmm",
603
+ "cublasZdgmm_64",
604
+ "cublasZdotc",
605
+ "cublasZdotc_v2",
606
+ "cublasZdotc_v2_64",
607
+ "cublasZdotu",
608
+ "cublasZdotu_v2",
609
+ "cublasZdotu_v2_64",
610
+ "cublasZdrot",
611
+ "cublasZdrot_v2",
612
+ "cublasZdrot_v2_64",
613
+ "cublasZdscal",
614
+ "cublasZdscal_v2",
615
+ "cublasZdscal_v2_64",
616
+ "cublasZgbmv",
617
+ "cublasZgbmv_v2",
618
+ "cublasZgbmv_v2_64",
619
+ "cublasZgeam",
620
+ "cublasZgeam_64",
621
+ "cublasZgelsBatched",
622
+ "cublasZgemm",
623
+ "cublasZgemm3m",
624
+ "cublasZgemm3m_64",
625
+ "cublasZgemmBatched",
626
+ "cublasZgemmBatched_64",
627
+ "cublasZgemmStridedBatched",
628
+ "cublasZgemmStridedBatched_64",
629
+ "cublasZgemm_v2",
630
+ "cublasZgemm_v2_64",
631
+ "cublasZgemv",
632
+ "cublasZgemvBatched",
633
+ "cublasZgemvBatched_64",
634
+ "cublasZgemvStridedBatched",
635
+ "cublasZgemvStridedBatched_64",
636
+ "cublasZgemv_v2",
637
+ "cublasZgemv_v2_64",
638
+ "cublasZgeqrfBatched",
639
+ "cublasZgerc",
640
+ "cublasZgerc_v2",
641
+ "cublasZgerc_v2_64",
642
+ "cublasZgeru",
643
+ "cublasZgeru_v2",
644
+ "cublasZgeru_v2_64",
645
+ "cublasZgetrfBatched",
646
+ "cublasZgetriBatched",
647
+ "cublasZgetrsBatched",
648
+ "cublasZhbmv",
649
+ "cublasZhbmv_v2",
650
+ "cublasZhbmv_v2_64",
651
+ "cublasZhemm",
652
+ "cublasZhemm_v2",
653
+ "cublasZhemm_v2_64",
654
+ "cublasZhemv",
655
+ "cublasZhemv_v2",
656
+ "cublasZhemv_v2_64",
657
+ "cublasZher",
658
+ "cublasZher2",
659
+ "cublasZher2_v2",
660
+ "cublasZher2_v2_64",
661
+ "cublasZher2k",
662
+ "cublasZher2k_v2",
663
+ "cublasZher2k_v2_64",
664
+ "cublasZher_v2",
665
+ "cublasZher_v2_64",
666
+ "cublasZherk",
667
+ "cublasZherk_v2",
668
+ "cublasZherk_v2_64",
669
+ "cublasZherkx",
670
+ "cublasZherkx_64",
671
+ "cublasZhpmv",
672
+ "cublasZhpmv_v2",
673
+ "cublasZhpmv_v2_64",
674
+ "cublasZhpr",
675
+ "cublasZhpr2",
676
+ "cublasZhpr2_v2",
677
+ "cublasZhpr2_v2_64",
678
+ "cublasZhpr_v2",
679
+ "cublasZhpr_v2_64",
680
+ "cublasZmatinvBatched",
681
+ "cublasZrot",
682
+ "cublasZrot_v2",
683
+ "cublasZrot_v2_64",
684
+ "cublasZrotg",
685
+ "cublasZrotg_v2",
686
+ "cublasZscal",
687
+ "cublasZscal_v2",
688
+ "cublasZscal_v2_64",
689
+ "cublasZswap",
690
+ "cublasZswap_v2",
691
+ "cublasZswap_v2_64",
692
+ "cublasZsymm",
693
+ "cublasZsymm_v2",
694
+ "cublasZsymm_v2_64",
695
+ "cublasZsymv_v2",
696
+ "cublasZsymv_v2_64",
697
+ "cublasZsyr2_v2",
698
+ "cublasZsyr2_v2_64",
699
+ "cublasZsyr2k",
700
+ "cublasZsyr2k_v2",
701
+ "cublasZsyr2k_v2_64",
702
+ "cublasZsyr_v2",
703
+ "cublasZsyr_v2_64",
704
+ "cublasZsyrk",
705
+ "cublasZsyrk_v2",
706
+ "cublasZsyrk_v2_64",
707
+ "cublasZsyrkx",
708
+ "cublasZsyrkx_64",
709
+ "cublasZtbmv",
710
+ "cublasZtbmv_v2",
711
+ "cublasZtbmv_v2_64",
712
+ "cublasZtbsv",
713
+ "cublasZtbsv_v2",
714
+ "cublasZtbsv_v2_64",
715
+ "cublasZtpmv",
716
+ "cublasZtpmv_v2",
717
+ "cublasZtpmv_v2_64",
718
+ "cublasZtpsv",
719
+ "cublasZtpsv_v2",
720
+ "cublasZtpsv_v2_64",
721
+ "cublasZtpttr",
722
+ "cublasZtrmm",
723
+ "cublasZtrmm_v2",
724
+ "cublasZtrmm_v2_64",
725
+ "cublasZtrmv",
726
+ "cublasZtrmv_v2",
727
+ "cublasZtrmv_v2_64",
728
+ "cublasZtrsm",
729
+ "cublasZtrsmBatched",
730
+ "cublasZtrsmBatched_64",
731
+ "cublasZtrsm_v2",
732
+ "cublasZtrsm_v2_64",
733
+ "cublasZtrsv",
734
+ "cublasZtrsv_v2",
735
+ "cublasZtrsv_v2_64",
736
+ "cublasZtrttp",
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/cuda/cublasLt.inc ADDED
@@ -0,0 +1,291 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "cublasLtACCMatmul",
2
+ "cublasLtACCMatmulAlgoCapGetAttribute",
3
+ "cublasLtACCMatmulAlgoCheck",
4
+ "cublasLtACCMatmulAlgoGetHeuristic",
5
+ "cublasLtACCMatmulAlgoGetIds",
6
+ "cublasLtACCMatmulAlgoInit",
7
+ "cublasLtAlgoCharacteristicGetAttribute",
8
+ "cublasLtBIIMatmul",
9
+ "cublasLtBIIMatmulAlgoCapGetAttribute",
10
+ "cublasLtBIIMatmulAlgoCheck",
11
+ "cublasLtBIIMatmulAlgoGetHeuristic",
12
+ "cublasLtBIIMatmulAlgoGetIds",
13
+ "cublasLtBIIMatmulAlgoInit",
14
+ "cublasLtBSBMatmul",
15
+ "cublasLtBSBMatmulAlgoCapGetAttribute",
16
+ "cublasLtBSBMatmulAlgoCheck",
17
+ "cublasLtBSBMatmulAlgoGetHeuristic",
18
+ "cublasLtBSBMatmulAlgoGetIds",
19
+ "cublasLtBSBMatmulAlgoInit",
20
+ "cublasLtBSSMatmul",
21
+ "cublasLtBSSMatmulAlgoCapGetAttribute",
22
+ "cublasLtBSSMatmulAlgoCheck",
23
+ "cublasLtBSSMatmulAlgoGetHeuristic",
24
+ "cublasLtBSSMatmulAlgoGetIds",
25
+ "cublasLtBSSMatmulAlgoInit",
26
+ "cublasLtCCCMatmul",
27
+ "cublasLtCCCMatmulAlgoCapGetAttribute",
28
+ "cublasLtCCCMatmulAlgoCheck",
29
+ "cublasLtCCCMatmulAlgoGetHeuristic",
30
+ "cublasLtCCCMatmulAlgoGetIds",
31
+ "cublasLtCCCMatmulAlgoInit",
32
+ "cublasLtCreate",
33
+ "cublasLtCtxInit",
34
+ "cublasLtDDDMatmul",
35
+ "cublasLtDDDMatmulAlgoCapGetAttribute",
36
+ "cublasLtDDDMatmulAlgoCheck",
37
+ "cublasLtDDDMatmulAlgoGetHeuristic",
38
+ "cublasLtDDDMatmulAlgoGetIds",
39
+ "cublasLtDDDMatmulAlgoInit",
40
+ "cublasLtDestroy",
41
+ "cublasLtE4m3E4m3Fp32Bf16Bf16Matmul",
42
+ "cublasLtE4m3E4m3Fp32Bf16Bf16MatmulAlgoCapGetAttribute",
43
+ "cublasLtE4m3E4m3Fp32Bf16Bf16MatmulAlgoCheck",
44
+ "cublasLtE4m3E4m3Fp32Bf16Bf16MatmulAlgoGetHeuristic",
45
+ "cublasLtE4m3E4m3Fp32Bf16Bf16MatmulAlgoGetIds",
46
+ "cublasLtE4m3E4m3Fp32Bf16Bf16MatmulAlgoInit",
47
+ "cublasLtE4m3E4m3Fp32Bf16E4m3Matmul",
48
+ "cublasLtE4m3E4m3Fp32Bf16E4m3MatmulAlgoCapGetAttribute",
49
+ "cublasLtE4m3E4m3Fp32Bf16E4m3MatmulAlgoCheck",
50
+ "cublasLtE4m3E4m3Fp32Bf16E4m3MatmulAlgoGetHeuristic",
51
+ "cublasLtE4m3E4m3Fp32Bf16E4m3MatmulAlgoGetIds",
52
+ "cublasLtE4m3E4m3Fp32Bf16E4m3MatmulAlgoInit",
53
+ "cublasLtE4m3E4m3Fp32Fp16E4m3Matmul",
54
+ "cublasLtE4m3E4m3Fp32Fp16E4m3MatmulAlgoCapGetAttribute",
55
+ "cublasLtE4m3E4m3Fp32Fp16E4m3MatmulAlgoCheck",
56
+ "cublasLtE4m3E4m3Fp32Fp16E4m3MatmulAlgoGetHeuristic",
57
+ "cublasLtE4m3E4m3Fp32Fp16E4m3MatmulAlgoGetIds",
58
+ "cublasLtE4m3E4m3Fp32Fp16E4m3MatmulAlgoInit",
59
+ "cublasLtE4m3E4m3Fp32Fp16Fp16Matmul",
60
+ "cublasLtE4m3E4m3Fp32Fp16Fp16MatmulAlgoCapGetAttribute",
61
+ "cublasLtE4m3E4m3Fp32Fp16Fp16MatmulAlgoCheck",
62
+ "cublasLtE4m3E4m3Fp32Fp16Fp16MatmulAlgoGetHeuristic",
63
+ "cublasLtE4m3E4m3Fp32Fp16Fp16MatmulAlgoGetIds",
64
+ "cublasLtE4m3E4m3Fp32Fp16Fp16MatmulAlgoInit",
65
+ "cublasLtE4m3E4m3Fp32Fp32Fp32Matmul",
66
+ "cublasLtE4m3E4m3Fp32Fp32Fp32MatmulAlgoCapGetAttribute",
67
+ "cublasLtE4m3E4m3Fp32Fp32Fp32MatmulAlgoCheck",
68
+ "cublasLtE4m3E4m3Fp32Fp32Fp32MatmulAlgoGetHeuristic",
69
+ "cublasLtE4m3E4m3Fp32Fp32Fp32MatmulAlgoGetIds",
70
+ "cublasLtE4m3E4m3Fp32Fp32Fp32MatmulAlgoInit",
71
+ "cublasLtE4m3E5m2Fp32Bf16Bf16Matmul",
72
+ "cublasLtE4m3E5m2Fp32Bf16Bf16MatmulAlgoCapGetAttribute",
73
+ "cublasLtE4m3E5m2Fp32Bf16Bf16MatmulAlgoCheck",
74
+ "cublasLtE4m3E5m2Fp32Bf16Bf16MatmulAlgoGetHeuristic",
75
+ "cublasLtE4m3E5m2Fp32Bf16Bf16MatmulAlgoGetIds",
76
+ "cublasLtE4m3E5m2Fp32Bf16Bf16MatmulAlgoInit",
77
+ "cublasLtE4m3E5m2Fp32Bf16E4m3Matmul",
78
+ "cublasLtE4m3E5m2Fp32Bf16E4m3MatmulAlgoCapGetAttribute",
79
+ "cublasLtE4m3E5m2Fp32Bf16E4m3MatmulAlgoCheck",
80
+ "cublasLtE4m3E5m2Fp32Bf16E4m3MatmulAlgoGetHeuristic",
81
+ "cublasLtE4m3E5m2Fp32Bf16E4m3MatmulAlgoGetIds",
82
+ "cublasLtE4m3E5m2Fp32Bf16E4m3MatmulAlgoInit",
83
+ "cublasLtE4m3E5m2Fp32Bf16E5m2Matmul",
84
+ "cublasLtE4m3E5m2Fp32Bf16E5m2MatmulAlgoCapGetAttribute",
85
+ "cublasLtE4m3E5m2Fp32Bf16E5m2MatmulAlgoCheck",
86
+ "cublasLtE4m3E5m2Fp32Bf16E5m2MatmulAlgoGetHeuristic",
87
+ "cublasLtE4m3E5m2Fp32Bf16E5m2MatmulAlgoGetIds",
88
+ "cublasLtE4m3E5m2Fp32Bf16E5m2MatmulAlgoInit",
89
+ "cublasLtE4m3E5m2Fp32Fp16E4m3Matmul",
90
+ "cublasLtE4m3E5m2Fp32Fp16E4m3MatmulAlgoCapGetAttribute",
91
+ "cublasLtE4m3E5m2Fp32Fp16E4m3MatmulAlgoCheck",
92
+ "cublasLtE4m3E5m2Fp32Fp16E4m3MatmulAlgoGetHeuristic",
93
+ "cublasLtE4m3E5m2Fp32Fp16E4m3MatmulAlgoGetIds",
94
+ "cublasLtE4m3E5m2Fp32Fp16E4m3MatmulAlgoInit",
95
+ "cublasLtE4m3E5m2Fp32Fp16E5m2Matmul",
96
+ "cublasLtE4m3E5m2Fp32Fp16E5m2MatmulAlgoCapGetAttribute",
97
+ "cublasLtE4m3E5m2Fp32Fp16E5m2MatmulAlgoCheck",
98
+ "cublasLtE4m3E5m2Fp32Fp16E5m2MatmulAlgoGetHeuristic",
99
+ "cublasLtE4m3E5m2Fp32Fp16E5m2MatmulAlgoGetIds",
100
+ "cublasLtE4m3E5m2Fp32Fp16E5m2MatmulAlgoInit",
101
+ "cublasLtE4m3E5m2Fp32Fp16Fp16Matmul",
102
+ "cublasLtE4m3E5m2Fp32Fp16Fp16MatmulAlgoCapGetAttribute",
103
+ "cublasLtE4m3E5m2Fp32Fp16Fp16MatmulAlgoCheck",
104
+ "cublasLtE4m3E5m2Fp32Fp16Fp16MatmulAlgoGetHeuristic",
105
+ "cublasLtE4m3E5m2Fp32Fp16Fp16MatmulAlgoGetIds",
106
+ "cublasLtE4m3E5m2Fp32Fp16Fp16MatmulAlgoInit",
107
+ "cublasLtE4m3E5m2Fp32Fp32Fp32Matmul",
108
+ "cublasLtE4m3E5m2Fp32Fp32Fp32MatmulAlgoCapGetAttribute",
109
+ "cublasLtE4m3E5m2Fp32Fp32Fp32MatmulAlgoCheck",
110
+ "cublasLtE4m3E5m2Fp32Fp32Fp32MatmulAlgoGetHeuristic",
111
+ "cublasLtE4m3E5m2Fp32Fp32Fp32MatmulAlgoGetIds",
112
+ "cublasLtE4m3E5m2Fp32Fp32Fp32MatmulAlgoInit",
113
+ "cublasLtE5m2E4m3Fp32Bf16Bf16Matmul",
114
+ "cublasLtE5m2E4m3Fp32Bf16Bf16MatmulAlgoCapGetAttribute",
115
+ "cublasLtE5m2E4m3Fp32Bf16Bf16MatmulAlgoCheck",
116
+ "cublasLtE5m2E4m3Fp32Bf16Bf16MatmulAlgoGetHeuristic",
117
+ "cublasLtE5m2E4m3Fp32Bf16Bf16MatmulAlgoGetIds",
118
+ "cublasLtE5m2E4m3Fp32Bf16Bf16MatmulAlgoInit",
119
+ "cublasLtE5m2E4m3Fp32Bf16E4m3Matmul",
120
+ "cublasLtE5m2E4m3Fp32Bf16E4m3MatmulAlgoCapGetAttribute",
121
+ "cublasLtE5m2E4m3Fp32Bf16E4m3MatmulAlgoCheck",
122
+ "cublasLtE5m2E4m3Fp32Bf16E4m3MatmulAlgoGetHeuristic",
123
+ "cublasLtE5m2E4m3Fp32Bf16E4m3MatmulAlgoGetIds",
124
+ "cublasLtE5m2E4m3Fp32Bf16E4m3MatmulAlgoInit",
125
+ "cublasLtE5m2E4m3Fp32Bf16E5m2Matmul",
126
+ "cublasLtE5m2E4m3Fp32Bf16E5m2MatmulAlgoCapGetAttribute",
127
+ "cublasLtE5m2E4m3Fp32Bf16E5m2MatmulAlgoCheck",
128
+ "cublasLtE5m2E4m3Fp32Bf16E5m2MatmulAlgoGetHeuristic",
129
+ "cublasLtE5m2E4m3Fp32Bf16E5m2MatmulAlgoGetIds",
130
+ "cublasLtE5m2E4m3Fp32Bf16E5m2MatmulAlgoInit",
131
+ "cublasLtE5m2E4m3Fp32Fp16E4m3Matmul",
132
+ "cublasLtE5m2E4m3Fp32Fp16E4m3MatmulAlgoCapGetAttribute",
133
+ "cublasLtE5m2E4m3Fp32Fp16E4m3MatmulAlgoCheck",
134
+ "cublasLtE5m2E4m3Fp32Fp16E4m3MatmulAlgoGetHeuristic",
135
+ "cublasLtE5m2E4m3Fp32Fp16E4m3MatmulAlgoGetIds",
136
+ "cublasLtE5m2E4m3Fp32Fp16E4m3MatmulAlgoInit",
137
+ "cublasLtE5m2E4m3Fp32Fp16E5m2Matmul",
138
+ "cublasLtE5m2E4m3Fp32Fp16E5m2MatmulAlgoCapGetAttribute",
139
+ "cublasLtE5m2E4m3Fp32Fp16E5m2MatmulAlgoCheck",
140
+ "cublasLtE5m2E4m3Fp32Fp16E5m2MatmulAlgoGetHeuristic",
141
+ "cublasLtE5m2E4m3Fp32Fp16E5m2MatmulAlgoGetIds",
142
+ "cublasLtE5m2E4m3Fp32Fp16E5m2MatmulAlgoInit",
143
+ "cublasLtE5m2E4m3Fp32Fp16Fp16Matmul",
144
+ "cublasLtE5m2E4m3Fp32Fp16Fp16MatmulAlgoCapGetAttribute",
145
+ "cublasLtE5m2E4m3Fp32Fp16Fp16MatmulAlgoCheck",
146
+ "cublasLtE5m2E4m3Fp32Fp16Fp16MatmulAlgoGetHeuristic",
147
+ "cublasLtE5m2E4m3Fp32Fp16Fp16MatmulAlgoGetIds",
148
+ "cublasLtE5m2E4m3Fp32Fp16Fp16MatmulAlgoInit",
149
+ "cublasLtE5m2E4m3Fp32Fp32Fp32Matmul",
150
+ "cublasLtE5m2E4m3Fp32Fp32Fp32MatmulAlgoCapGetAttribute",
151
+ "cublasLtE5m2E4m3Fp32Fp32Fp32MatmulAlgoCheck",
152
+ "cublasLtE5m2E4m3Fp32Fp32Fp32MatmulAlgoGetHeuristic",
153
+ "cublasLtE5m2E4m3Fp32Fp32Fp32MatmulAlgoGetIds",
154
+ "cublasLtE5m2E4m3Fp32Fp32Fp32MatmulAlgoInit",
155
+ "cublasLtGetCudartVersion",
156
+ "cublasLtGetProperty",
157
+ "cublasLtGetStatusName",
158
+ "cublasLtGetStatusString",
159
+ "cublasLtGetVersion",
160
+ "cublasLtHHHMatmul",
161
+ "cublasLtHHHMatmulAlgoCapGetAttribute",
162
+ "cublasLtHHHMatmulAlgoCheck",
163
+ "cublasLtHHHMatmulAlgoGetHeuristic",
164
+ "cublasLtHHHMatmulAlgoGetIds",
165
+ "cublasLtHHHMatmulAlgoInit",
166
+ "cublasLtHSHMatmul",
167
+ "cublasLtHSHMatmulAlgoCapGetAttribute",
168
+ "cublasLtHSHMatmulAlgoCheck",
169
+ "cublasLtHSHMatmulAlgoGetHeuristic",
170
+ "cublasLtHSHMatmulAlgoGetIds",
171
+ "cublasLtHSHMatmulAlgoInit",
172
+ "cublasLtHSSMatmul",
173
+ "cublasLtHSSMatmulAlgoCapGetAttribute",
174
+ "cublasLtHSSMatmulAlgoCheck",
175
+ "cublasLtHSSMatmulAlgoGetHeuristic",
176
+ "cublasLtHSSMatmulAlgoGetIds",
177
+ "cublasLtHSSMatmulAlgoInit",
178
+ "cublasLtHeuristicLutSerializeEntry",
179
+ "cublasLtHeuristicsCacheGetCapacity",
180
+ "cublasLtHeuristicsCacheSetCapacity",
181
+ "cublasLtKCCMatmul",
182
+ "cublasLtKCCMatmulAlgoCapGetAttribute",
183
+ "cublasLtKCCMatmulAlgoCheck",
184
+ "cublasLtKCCMatmulAlgoGetHeuristic",
185
+ "cublasLtKCCMatmulAlgoGetIds",
186
+ "cublasLtKCCMatmulAlgoInit",
187
+ "cublasLtKCKMatmul",
188
+ "cublasLtKCKMatmulAlgoCapGetAttribute",
189
+ "cublasLtKCKMatmulAlgoCheck",
190
+ "cublasLtKCKMatmulAlgoGetHeuristic",
191
+ "cublasLtKCKMatmulAlgoGetIds",
192
+ "cublasLtKCKMatmulAlgoInit",
193
+ "cublasLtLegacyGemmACC",
194
+ "cublasLtLegacyGemmBII",
195
+ "cublasLtLegacyGemmBSS",
196
+ "cublasLtLegacyGemmCCC",
197
+ "cublasLtLegacyGemmDDD",
198
+ "cublasLtLegacyGemmHHH",
199
+ "cublasLtLegacyGemmHSH",
200
+ "cublasLtLegacyGemmHSS",
201
+ "cublasLtLegacyGemmSSS",
202
+ "cublasLtLegacyGemmTSS",
203
+ "cublasLtLegacyGemmTST",
204
+ "cublasLtLegacyGemmUtilizationCCC",
205
+ "cublasLtLegacyGemmUtilizationDDD",
206
+ "cublasLtLegacyGemmUtilizationZZZ",
207
+ "cublasLtLegacyGemmZZZ",
208
+ "cublasLtLoggerForceDisable",
209
+ "cublasLtLoggerOpenFile",
210
+ "cublasLtLoggerSetCallback",
211
+ "cublasLtLoggerSetFile",
212
+ "cublasLtLoggerSetLevel",
213
+ "cublasLtLoggerSetMask",
214
+ "cublasLtMatmul",
215
+ "cublasLtMatmulAlgoCapGetAttribute",
216
+ "cublasLtMatmulAlgoCheck",
217
+ "cublasLtMatmulAlgoConfigGetAttribute",
218
+ "cublasLtMatmulAlgoConfigGetAttributeRange",
219
+ "cublasLtMatmulAlgoConfigSetAttribute",
220
+ "cublasLtMatmulAlgoGetHeuristic",
221
+ "cublasLtMatmulAlgoGetIds",
222
+ "cublasLtMatmulAlgoInit",
223
+ "cublasLtMatmulDescCreate",
224
+ "cublasLtMatmulDescDestroy",
225
+ "cublasLtMatmulDescGetAttribute",
226
+ "cublasLtMatmulDescInit_internal",
227
+ "cublasLtMatmulDescSetAttribute",
228
+ "cublasLtMatmulPreferenceCreate",
229
+ "cublasLtMatmulPreferenceDestroy",
230
+ "cublasLtMatmulPreferenceGetAttribute",
231
+ "cublasLtMatmulPreferenceInit_internal",
232
+ "cublasLtMatmulPreferenceSetAttribute",
233
+ "cublasLtMatrixLayoutCreate",
234
+ "cublasLtMatrixLayoutDestroy",
235
+ "cublasLtMatrixLayoutGetAttribute",
236
+ "cublasLtMatrixLayoutInit_internal",
237
+ "cublasLtMatrixLayoutSetAttribute",
238
+ "cublasLtMatrixTransform",
239
+ "cublasLtMatrixTransformDescCreate",
240
+ "cublasLtMatrixTransformDescDestroy",
241
+ "cublasLtMatrixTransformDescGetAttribute",
242
+ "cublasLtMatrixTransformDescInit_internal",
243
+ "cublasLtMatrixTransformDescSetAttribute",
244
+ "cublasLtSSSMatmul",
245
+ "cublasLtSSSMatmulAlgoCapGetAttribute",
246
+ "cublasLtSSSMatmulAlgoCheck",
247
+ "cublasLtSSSMatmulAlgoGetHeuristic",
248
+ "cublasLtSSSMatmulAlgoGetIds",
249
+ "cublasLtSSSMatmulAlgoInit",
250
+ "cublasLtShutdownCtx",
251
+ "cublasLtTSSMatmul",
252
+ "cublasLtTSSMatmulAlgoCapGetAttribute",
253
+ "cublasLtTSSMatmulAlgoCheck",
254
+ "cublasLtTSSMatmulAlgoGetHeuristic",
255
+ "cublasLtTSSMatmulAlgoGetIds",
256
+ "cublasLtTSSMatmulAlgoInit",
257
+ "cublasLtTSTMatmul",
258
+ "cublasLtTSTMatmulAlgoCapGetAttribute",
259
+ "cublasLtTSTMatmulAlgoCheck",
260
+ "cublasLtTSTMatmulAlgoGetHeuristic",
261
+ "cublasLtTSTMatmulAlgoGetIds",
262
+ "cublasLtTSTMatmulAlgoInit",
263
+ "cublasLtVCCMatmul",
264
+ "cublasLtVCCMatmulAlgoCapGetAttribute",
265
+ "cublasLtVCCMatmulAlgoCheck",
266
+ "cublasLtVCCMatmulAlgoGetHeuristic",
267
+ "cublasLtVCCMatmulAlgoGetIds",
268
+ "cublasLtVCCMatmulAlgoInit",
269
+ "cublasLtVCVMatmul",
270
+ "cublasLtVCVMatmulAlgoCapGetAttribute",
271
+ "cublasLtVCVMatmulAlgoCheck",
272
+ "cublasLtVCVMatmulAlgoGetHeuristic",
273
+ "cublasLtVCVMatmulAlgoGetIds",
274
+ "cublasLtVCVMatmulAlgoInit",
275
+ "cublasLtZZZMatmul",
276
+ "cublasLtZZZMatmulAlgoCapGetAttribute",
277
+ "cublasLtZZZMatmulAlgoCheck",
278
+ "cublasLtZZZMatmulAlgoGetHeuristic",
279
+ "cublasLtZZZMatmulAlgoGetIds",
280
+ "cublasLtZZZMatmulAlgoInit",
281
+ "cublasLt_for_cublas_BII",
282
+ "cublasLt_for_cublas_BSS",
283
+ "cublasLt_for_cublas_CCC",
284
+ "cublasLt_for_cublas_DDD",
285
+ "cublasLt_for_cublas_HHH",
286
+ "cublasLt_for_cublas_HSH",
287
+ "cublasLt_for_cublas_HSS",
288
+ "cublasLt_for_cublas_SSS",
289
+ "cublasLt_for_cublas_TSS",
290
+ "cublasLt_for_cublas_TST",
291
+ "cublasLt_for_cublas_ZZZ",
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/cuda/cufft.inc ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "cufftCreate",
2
+ "cufftDebug",
3
+ "cufftDestroy",
4
+ "cufftEstimate1d",
5
+ "cufftEstimate2d",
6
+ "cufftEstimate3d",
7
+ "cufftEstimateMany",
8
+ "cufftExecC2C",
9
+ "cufftExecC2R",
10
+ "cufftExecD2Z",
11
+ "cufftExecR2C",
12
+ "cufftExecZ2D",
13
+ "cufftExecZ2Z",
14
+ "cufftGetProperty",
15
+ "cufftGetSize",
16
+ "cufftGetSize1d",
17
+ "cufftGetSize2d",
18
+ "cufftGetSize3d",
19
+ "cufftGetSizeMany",
20
+ "cufftGetSizeMany64",
21
+ "cufftGetVersion",
22
+ "cufftMakePlan1d",
23
+ "cufftMakePlan2d",
24
+ "cufftMakePlan3d",
25
+ "cufftMakePlanMany",
26
+ "cufftMakePlanMany64",
27
+ "cufftPlan1d",
28
+ "cufftPlan2d",
29
+ "cufftPlan3d",
30
+ "cufftPlanMany",
31
+ "cufftSetAutoAllocation",
32
+ "cufftSetStream",
33
+ "cufftSetWorkArea",
34
+ "cufftXtClearCallback",
35
+ "cufftXtExec",
36
+ "cufftXtExecDescriptor",
37
+ "cufftXtExecDescriptorC2C",
38
+ "cufftXtExecDescriptorC2R",
39
+ "cufftXtExecDescriptorD2Z",
40
+ "cufftXtExecDescriptorR2C",
41
+ "cufftXtExecDescriptorZ2D",
42
+ "cufftXtExecDescriptorZ2Z",
43
+ "cufftXtFree",
44
+ "cufftXtGetSizeMany",
45
+ "cufftXtMakePlanGuru64",
46
+ "cufftXtMakePlanMany",
47
+ "cufftXtMalloc",
48
+ "cufftXtMemcpy",
49
+ "cufftXtQueryPlan",
50
+ "cufftXtSetCallback",
51
+ "cufftXtSetCallbackSharedSize",
52
+ "cufftXtSetDistribution",
53
+ "cufftXtSetGPUs",
54
+ "cufftXtSetWorkArea",
55
+ "cufftXtSetWorkAreaPolicy",
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/cuda/cupti.inc ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "InitializeInjectionNvtx",
2
+ "InitializeInjectionNvtx2",
3
+ "cuptiActivityConfigurePCSampling",
4
+ "cuptiActivityConfigureUnifiedMemoryCounter",
5
+ "cuptiActivityDisable",
6
+ "cuptiActivityDisableContext",
7
+ "cuptiActivityEnable",
8
+ "cuptiActivityEnableAndDump",
9
+ "cuptiActivityEnableBufferSummary",
10
+ "cuptiActivityEnableContext",
11
+ "cuptiActivityEnableLatencyTimestamps",
12
+ "cuptiActivityEnableLaunchAttributes",
13
+ "cuptiActivityEnableRawTimestamps",
14
+ "cuptiActivityFlush",
15
+ "cuptiActivityFlushAll",
16
+ "cuptiActivityFlushPeriod",
17
+ "cuptiActivityGetAttribute",
18
+ "cuptiActivityGetNextRecord",
19
+ "cuptiActivityGetNumDroppedRecords",
20
+ "cuptiActivityPopExternalCorrelationId",
21
+ "cuptiActivityPushExternalCorrelationId",
22
+ "cuptiActivityRegisterCallbacks",
23
+ "cuptiActivityRegisterTimestampCallback",
24
+ "cuptiActivitySetAttribute",
25
+ "cuptiComputeCapabilitySupported",
26
+ "cuptiDeviceEnumEventDomains",
27
+ "cuptiDeviceEnumMetrics",
28
+ "cuptiDeviceGetAttribute",
29
+ "cuptiDeviceGetChipName",
30
+ "cuptiDeviceGetEventDomainAttribute",
31
+ "cuptiDeviceGetNumEventDomains",
32
+ "cuptiDeviceGetNumMetrics",
33
+ "cuptiDeviceSupported",
34
+ "cuptiDeviceVirtualizationMode",
35
+ "cuptiDisableKernelReplayMode",
36
+ "cuptiDisableLibcuda",
37
+ "cuptiDisableNonOverlappingMode",
38
+ "cuptiEnableAllDomains",
39
+ "cuptiEnableCallback",
40
+ "cuptiEnableDomain",
41
+ "cuptiEnableKernelReplayMode",
42
+ "cuptiEnableNonOverlappingMode",
43
+ "cuptiEnumEventDomains",
44
+ "cuptiEnumMetrics",
45
+ "cuptiEventDomainEnumEvents",
46
+ "cuptiEventDomainGetAttribute",
47
+ "cuptiEventDomainGetNumEvents",
48
+ "cuptiEventGetAttribute",
49
+ "cuptiEventGetIdFromName",
50
+ "cuptiEventGroupAddEvent",
51
+ "cuptiEventGroupCreate",
52
+ "cuptiEventGroupDestroy",
53
+ "cuptiEventGroupDisable",
54
+ "cuptiEventGroupEnable",
55
+ "cuptiEventGroupGetAttribute",
56
+ "cuptiEventGroupReadAllEvents",
57
+ "cuptiEventGroupReadEvent",
58
+ "cuptiEventGroupRemoveAllEvents",
59
+ "cuptiEventGroupRemoveEvent",
60
+ "cuptiEventGroupResetAllEvents",
61
+ "cuptiEventGroupSetAttribute",
62
+ "cuptiEventGroupSetDisable",
63
+ "cuptiEventGroupSetEnable",
64
+ "cuptiEventGroupSetsCreate",
65
+ "cuptiEventGroupSetsDestroy",
66
+ "cuptiFinalize",
67
+ "cuptiGetAutoBoostState",
68
+ "cuptiGetCallbackName",
69
+ "cuptiGetCallbackState",
70
+ "cuptiGetContextId",
71
+ "cuptiGetCubinCrc",
72
+ "cuptiGetDeviceId",
73
+ "cuptiGetErrorMessage",
74
+ "cuptiGetGlobalCallbackState",
75
+ "cuptiGetGraphId",
76
+ "cuptiGetGraphNodeId",
77
+ "cuptiGetLastError",
78
+ "cuptiGetNumContexts",
79
+ "cuptiGetNumEventDomains",
80
+ "cuptiGetNumMetrics",
81
+ "cuptiGetRecommendedBufferSize",
82
+ "cuptiGetResultString",
83
+ "cuptiGetSassToSourceCorrelation",
84
+ "cuptiGetStreamId",
85
+ "cuptiGetStreamIdEx",
86
+ "cuptiGetThreadIdType",
87
+ "cuptiGetTimestamp",
88
+ "cuptiGetVersion",
89
+ "cuptiKernelReplaySubscribeUpdate",
90
+ "cuptiMetricCreateEventGroupSets",
91
+ "cuptiMetricEnumEvents",
92
+ "cuptiMetricEnumProperties",
93
+ "cuptiMetricGetAttribute",
94
+ "cuptiMetricGetIdFromName",
95
+ "cuptiMetricGetNumEvents",
96
+ "cuptiMetricGetNumProperties",
97
+ "cuptiMetricGetRequiredEventGroupSets",
98
+ "cuptiMetricGetValue",
99
+ "cuptiMetricGetValue2",
100
+ "cuptiNvtxInitialize",
101
+ "cuptiNvtxInitialize2",
102
+ "cuptiOpenACCInitialize",
103
+ "cuptiOpenMpInitialize",
104
+ "cuptiOpenMpInitialize_v2",
105
+ "cuptiPCSamplingDisable",
106
+ "cuptiPCSamplingEnable",
107
+ "cuptiPCSamplingGetConfigurationAttribute",
108
+ "cuptiPCSamplingGetData",
109
+ "cuptiPCSamplingGetNumStallReasons",
110
+ "cuptiPCSamplingGetStallReasons",
111
+ "cuptiPCSamplingSetConfigurationAttribute",
112
+ "cuptiPCSamplingStart",
113
+ "cuptiPCSamplingStop",
114
+ "cuptiProfilerBeginPass",
115
+ "cuptiProfilerBeginSession",
116
+ "cuptiProfilerCounterDataImageCalculateScratchBufferSize",
117
+ "cuptiProfilerCounterDataImageCalculateSize",
118
+ "cuptiProfilerCounterDataImageInitialize",
119
+ "cuptiProfilerCounterDataImageInitializeScratchBuffer",
120
+ "cuptiProfilerDeInitialize",
121
+ "cuptiProfilerDeviceSupported",
122
+ "cuptiProfilerDisableProfiling",
123
+ "cuptiProfilerEnableProfiling",
124
+ "cuptiProfilerEndPass",
125
+ "cuptiProfilerEndSession",
126
+ "cuptiProfilerFlushCounterData",
127
+ "cuptiProfilerGetCounterAvailability",
128
+ "cuptiProfilerInitialize",
129
+ "cuptiProfilerPopRange",
130
+ "cuptiProfilerPushRange",
131
+ "cuptiProfilerSetConfig",
132
+ "cuptiProfilerUnsetConfig",
133
+ "cuptiRegisterComputeCrcCallback",
134
+ "cuptiSassMetricsDisable",
135
+ "cuptiSassMetricsEnable",
136
+ "cuptiSassMetricsFlushData",
137
+ "cuptiSassMetricsGetDataProperties",
138
+ "cuptiSassMetricsGetMetrics",
139
+ "cuptiSassMetricsGetNumOfMetrics",
140
+ "cuptiSassMetricsGetProperties",
141
+ "cuptiSassMetricsSetConfig",
142
+ "cuptiSassMetricsUnsetConfig",
143
+ "cuptiSetEventCollectionMode",
144
+ "cuptiSetThreadIdType",
145
+ "cuptiStateQuery",
146
+ "cuptiSubscribe",
147
+ "cuptiSupportedDomains",
148
+ "cuptiUnsubscribe",
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/cuda/cusolver.inc ADDED
@@ -0,0 +1,926 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "cublasCbatchAccGemm",
2
+ "cublasCbatchAccGemm_BufferSize",
3
+ "cublasCbatchGemm",
4
+ "cublasCbatchTrsm",
5
+ "cublasDbatchAccGemm",
6
+ "cublasDbatchAccGemm_BufferSize",
7
+ "cublasDbatchGemm",
8
+ "cublasDbatchTrsm",
9
+ "cublasSbatchAccGemm",
10
+ "cublasSbatchAccGemm_BufferSize",
11
+ "cublasSbatchGemm",
12
+ "cublasSbatchTrsm",
13
+ "cublasZbatchAccGemm",
14
+ "cublasZbatchAccGemm_BufferSize",
15
+ "cublasZbatchGemm",
16
+ "cublasZbatchTrsm",
17
+ "cusolverDnCCgels",
18
+ "cusolverDnCCgels_bufferSize",
19
+ "cusolverDnCCgesv",
20
+ "cusolverDnCCgesv_bufferSize",
21
+ "cusolverDnCEgels",
22
+ "cusolverDnCEgels_bufferSize",
23
+ "cusolverDnCEgesv",
24
+ "cusolverDnCEgesv_bufferSize",
25
+ "cusolverDnCKgels",
26
+ "cusolverDnCKgels_bufferSize",
27
+ "cusolverDnCKgesv",
28
+ "cusolverDnCKgesv_bufferSize",
29
+ "cusolverDnCYgels",
30
+ "cusolverDnCYgels_bufferSize",
31
+ "cusolverDnCYgesv",
32
+ "cusolverDnCYgesv_bufferSize",
33
+ "cusolverDnCaxpyHost",
34
+ "cusolverDnCeyeBatch",
35
+ "cusolverDnCgebrd",
36
+ "cusolverDnCgebrd_bufferSize",
37
+ "cusolverDnCgehd2",
38
+ "cusolverDnCgehd2_bufferSize",
39
+ "cusolverDnCgehrd",
40
+ "cusolverDnCgehrd_bufferSize",
41
+ "cusolverDnCgelqfHost",
42
+ "cusolverDnCgemmHost",
43
+ "cusolverDnCgeqlfHost",
44
+ "cusolverDnCgeqrf",
45
+ "cusolverDnCgeqrfHost",
46
+ "cusolverDnCgeqrf_ApI",
47
+ "cusolverDnCgeqrf_ApI_bufferSize",
48
+ "cusolverDnCgeqrf_bufferSize",
49
+ "cusolverDnCgercond",
50
+ "cusolverDnCgercond_bufferSize",
51
+ "cusolverDnCgesvd",
52
+ "cusolverDnCgesvd_bufferSize",
53
+ "cusolverDnCgesvdaStridedBatched",
54
+ "cusolverDnCgesvdaStridedBatched_bufferSize",
55
+ "cusolverDnCgesvdj",
56
+ "cusolverDnCgesvdjBatched",
57
+ "cusolverDnCgesvdjBatched_bufferSize",
58
+ "cusolverDnCgesvdj_bufferSize",
59
+ "cusolverDnCgetrf",
60
+ "cusolverDnCgetrf_bufferSize",
61
+ "cusolverDnCgetrs",
62
+ "cusolverDnCheevd",
63
+ "cusolverDnCheevd_bufferSize",
64
+ "cusolverDnCheevdx",
65
+ "cusolverDnCheevdx_bufferSize",
66
+ "cusolverDnCheevj",
67
+ "cusolverDnCheevjBatched",
68
+ "cusolverDnCheevjBatched_bufferSize",
69
+ "cusolverDnCheevj_bufferSize",
70
+ "cusolverDnChegst",
71
+ "cusolverDnChegst2",
72
+ "cusolverDnChegst2_bufferSize",
73
+ "cusolverDnChegst_bufferSize",
74
+ "cusolverDnChegvd",
75
+ "cusolverDnChegvd_bufferSize",
76
+ "cusolverDnChegvdx",
77
+ "cusolverDnChegvdx_bufferSize",
78
+ "cusolverDnChegvj",
79
+ "cusolverDnChegvj_bufferSize",
80
+ "cusolverDnChemv",
81
+ "cusolverDnChemv_bufferSize",
82
+ "cusolverDnChetrd",
83
+ "cusolverDnChetrd_bufferSize",
84
+ "cusolverDnClacpyHost",
85
+ "cusolverDnClahr2",
86
+ "cusolverDnClange",
87
+ "cusolverDnClangeHost",
88
+ "cusolverDnClange_bufferSize",
89
+ "cusolverDnClanhe",
90
+ "cusolverDnClanheHost",
91
+ "cusolverDnClanhe_bufferSize",
92
+ "cusolverDnClantrHost",
93
+ "cusolverDnClarfb",
94
+ "cusolverDnClarfgHost",
95
+ "cusolverDnClarft",
96
+ "cusolverDnClarft_bufferSize",
97
+ "cusolverDnClarnvHost",
98
+ "cusolverDnClascl",
99
+ "cusolverDnClasetHost",
100
+ "cusolverDnClaswp",
101
+ "cusolverDnClauum",
102
+ "cusolverDnClauumHost",
103
+ "cusolverDnClauum_bufferSize",
104
+ "cusolverDnCnrm2Host",
105
+ "cusolverDnCpolar",
106
+ "cusolverDnCpolar_bufferSize",
107
+ "cusolverDnCpotrf",
108
+ "cusolverDnCpotrfBatched",
109
+ "cusolverDnCpotrfHost",
110
+ "cusolverDnCpotrf_bufferSize",
111
+ "cusolverDnCpotri",
112
+ "cusolverDnCpotriHost",
113
+ "cusolverDnCpotri_bufferSize",
114
+ "cusolverDnCpotrs",
115
+ "cusolverDnCpotrsBatched",
116
+ "cusolverDnCpotrsHost",
117
+ "cusolverDnCreate",
118
+ "cusolverDnCreateGesvdjInfo",
119
+ "cusolverDnCreateParams",
120
+ "cusolverDnCreateSyevjInfo",
121
+ "cusolverDnCsscalHost",
122
+ "cusolverDnCsytrf",
123
+ "cusolverDnCsytrf_bufferSize",
124
+ "cusolverDnCsytri",
125
+ "cusolverDnCsytriHost",
126
+ "cusolverDnCsytri_bufferSize",
127
+ "cusolverDnCsytrsHost",
128
+ "cusolverDnCtrtriHost",
129
+ "cusolverDnCungbr",
130
+ "cusolverDnCungbrHost",
131
+ "cusolverDnCungbr_bufferSize",
132
+ "cusolverDnCunghrHost",
133
+ "cusolverDnCunglqHost",
134
+ "cusolverDnCungqr",
135
+ "cusolverDnCungqr_ApI",
136
+ "cusolverDnCungqr_ApI_bufferSize",
137
+ "cusolverDnCungqr_bufferSize",
138
+ "cusolverDnCungtr",
139
+ "cusolverDnCungtrHost",
140
+ "cusolverDnCungtr_bufferSize",
141
+ "cusolverDnCunmqr",
142
+ "cusolverDnCunmqrHost",
143
+ "cusolverDnCunmqr_bufferSize",
144
+ "cusolverDnCunmtr",
145
+ "cusolverDnCunmtrHost",
146
+ "cusolverDnCunmtr_bufferSize",
147
+ "cusolverDnDBgels",
148
+ "cusolverDnDBgels_bufferSize",
149
+ "cusolverDnDBgesv",
150
+ "cusolverDnDBgesv_bufferSize",
151
+ "cusolverDnDDgels",
152
+ "cusolverDnDDgels_bufferSize",
153
+ "cusolverDnDDgesv",
154
+ "cusolverDnDDgesv_bufferSize",
155
+ "cusolverDnDHgels",
156
+ "cusolverDnDHgels_bufferSize",
157
+ "cusolverDnDHgesv",
158
+ "cusolverDnDHgesv_bufferSize",
159
+ "cusolverDnDSgels",
160
+ "cusolverDnDSgels_bufferSize",
161
+ "cusolverDnDSgesv",
162
+ "cusolverDnDSgesv_bufferSize",
163
+ "cusolverDnDXgels",
164
+ "cusolverDnDXgels_bufferSize",
165
+ "cusolverDnDXgesv",
166
+ "cusolverDnDXgesv_bufferSize",
167
+ "cusolverDnDaxpyHost",
168
+ "cusolverDnDestroy",
169
+ "cusolverDnDestroyGesvdjInfo",
170
+ "cusolverDnDestroyParams",
171
+ "cusolverDnDestroySyevjInfo",
172
+ "cusolverDnDeyeBatch",
173
+ "cusolverDnDgebrd",
174
+ "cusolverDnDgebrd_bufferSize",
175
+ "cusolverDnDgehd2",
176
+ "cusolverDnDgehd2_bufferSize",
177
+ "cusolverDnDgehrd",
178
+ "cusolverDnDgehrd_bufferSize",
179
+ "cusolverDnDgelqfHost",
180
+ "cusolverDnDgemmHost",
181
+ "cusolverDnDgeqlfHost",
182
+ "cusolverDnDgeqrf",
183
+ "cusolverDnDgeqrfHost",
184
+ "cusolverDnDgeqrf_ApI",
185
+ "cusolverDnDgeqrf_ApI_bufferSize",
186
+ "cusolverDnDgeqrf_bufferSize",
187
+ "cusolverDnDgercond",
188
+ "cusolverDnDgercond_bufferSize",
189
+ "cusolverDnDgesvd",
190
+ "cusolverDnDgesvd_bufferSize",
191
+ "cusolverDnDgesvdaStridedBatched",
192
+ "cusolverDnDgesvdaStridedBatched_bufferSize",
193
+ "cusolverDnDgesvdj",
194
+ "cusolverDnDgesvdjBatched",
195
+ "cusolverDnDgesvdjBatched_bufferSize",
196
+ "cusolverDnDgesvdj_bufferSize",
197
+ "cusolverDnDgetrf",
198
+ "cusolverDnDgetrf_bufferSize",
199
+ "cusolverDnDgetrs",
200
+ "cusolverDnDlacpyHost",
201
+ "cusolverDnDlahr2",
202
+ "cusolverDnDlamchHost",
203
+ "cusolverDnDlange",
204
+ "cusolverDnDlangeHost",
205
+ "cusolverDnDlange_bufferSize",
206
+ "cusolverDnDlansy",
207
+ "cusolverDnDlansyHost",
208
+ "cusolverDnDlansy_bufferSize",
209
+ "cusolverDnDlantrHost",
210
+ "cusolverDnDlarfb",
211
+ "cusolverDnDlarfgHost",
212
+ "cusolverDnDlarft",
213
+ "cusolverDnDlarft_bufferSize",
214
+ "cusolverDnDlarnvHost",
215
+ "cusolverDnDlascl",
216
+ "cusolverDnDlasetHost",
217
+ "cusolverDnDlaswp",
218
+ "cusolverDnDlauum",
219
+ "cusolverDnDlauumHost",
220
+ "cusolverDnDlauum_bufferSize",
221
+ "cusolverDnDnrm2Host",
222
+ "cusolverDnDorgbr",
223
+ "cusolverDnDorgbrHost",
224
+ "cusolverDnDorgbr_bufferSize",
225
+ "cusolverDnDorghrHost",
226
+ "cusolverDnDorglqHost",
227
+ "cusolverDnDorgqr",
228
+ "cusolverDnDorgqr_ApI",
229
+ "cusolverDnDorgqr_ApI_bufferSize",
230
+ "cusolverDnDorgqr_bufferSize",
231
+ "cusolverDnDorgtr",
232
+ "cusolverDnDorgtrHost",
233
+ "cusolverDnDorgtr_bufferSize",
234
+ "cusolverDnDormqr",
235
+ "cusolverDnDormqrHost",
236
+ "cusolverDnDormqr_bufferSize",
237
+ "cusolverDnDormtr",
238
+ "cusolverDnDormtrHost",
239
+ "cusolverDnDormtr_bufferSize",
240
+ "cusolverDnDpolar",
241
+ "cusolverDnDpolar_bufferSize",
242
+ "cusolverDnDpotrf",
243
+ "cusolverDnDpotrfBatched",
244
+ "cusolverDnDpotrfHost",
245
+ "cusolverDnDpotrf_bufferSize",
246
+ "cusolverDnDpotri",
247
+ "cusolverDnDpotriHost",
248
+ "cusolverDnDpotri_bufferSize",
249
+ "cusolverDnDpotrs",
250
+ "cusolverDnDpotrsBatched",
251
+ "cusolverDnDpotrsHost",
252
+ "cusolverDnDscalHost",
253
+ "cusolverDnDsteqrHost",
254
+ "cusolverDnDsterfHost",
255
+ "cusolverDnDsyevd",
256
+ "cusolverDnDsyevd_bufferSize",
257
+ "cusolverDnDsyevdx",
258
+ "cusolverDnDsyevdx_bufferSize",
259
+ "cusolverDnDsyevj",
260
+ "cusolverDnDsyevjBatched",
261
+ "cusolverDnDsyevjBatched_bufferSize",
262
+ "cusolverDnDsyevj_bufferSize",
263
+ "cusolverDnDsygst",
264
+ "cusolverDnDsygst2",
265
+ "cusolverDnDsygst2_bufferSize",
266
+ "cusolverDnDsygst_bufferSize",
267
+ "cusolverDnDsygvd",
268
+ "cusolverDnDsygvd_bufferSize",
269
+ "cusolverDnDsygvdx",
270
+ "cusolverDnDsygvdx_bufferSize",
271
+ "cusolverDnDsygvj",
272
+ "cusolverDnDsygvj_bufferSize",
273
+ "cusolverDnDsymv",
274
+ "cusolverDnDsymv_bufferSize",
275
+ "cusolverDnDsytrd",
276
+ "cusolverDnDsytrd_bufferSize",
277
+ "cusolverDnDsytrf",
278
+ "cusolverDnDsytrf_bufferSize",
279
+ "cusolverDnDsytri",
280
+ "cusolverDnDsytriHost",
281
+ "cusolverDnDsytri_bufferSize",
282
+ "cusolverDnDsytrsHost",
283
+ "cusolverDnDtrtriHost",
284
+ "cusolverDnGeqrf",
285
+ "cusolverDnGeqrf_bufferSize",
286
+ "cusolverDnGesvd",
287
+ "cusolverDnGesvd_bufferSize",
288
+ "cusolverDnGetDeterministicMode",
289
+ "cusolverDnGetStream",
290
+ "cusolverDnGetrf",
291
+ "cusolverDnGetrf_bufferSize",
292
+ "cusolverDnGetrs",
293
+ "cusolverDnIRSInfosCreate",
294
+ "cusolverDnIRSInfosDestroy",
295
+ "cusolverDnIRSInfosGetMaxIters",
296
+ "cusolverDnIRSInfosGetNiters",
297
+ "cusolverDnIRSInfosGetOuterNiters",
298
+ "cusolverDnIRSInfosGetResidualHistory",
299
+ "cusolverDnIRSInfosRequestResidual",
300
+ "cusolverDnIRSParamsCreate",
301
+ "cusolverDnIRSParamsDestroy",
302
+ "cusolverDnIRSParamsDisableFallback",
303
+ "cusolverDnIRSParamsEnableFallback",
304
+ "cusolverDnIRSParamsGetMaxIters",
305
+ "cusolverDnIRSParamsSetMaxIters",
306
+ "cusolverDnIRSParamsSetMaxItersInner",
307
+ "cusolverDnIRSParamsSetRefinementSolver",
308
+ "cusolverDnIRSParamsSetSolverLowestPrecision",
309
+ "cusolverDnIRSParamsSetSolverMainPrecision",
310
+ "cusolverDnIRSParamsSetSolverPrecisions",
311
+ "cusolverDnIRSParamsSetTol",
312
+ "cusolverDnIRSParamsSetTolInner",
313
+ "cusolverDnIRSXgels",
314
+ "cusolverDnIRSXgels_bufferSize",
315
+ "cusolverDnIRSXgesv",
316
+ "cusolverDnIRSXgesv_bufferSize",
317
+ "cusolverDnPotrf",
318
+ "cusolverDnPotrf_bufferSize",
319
+ "cusolverDnPotrs",
320
+ "cusolverDnSBgels",
321
+ "cusolverDnSBgels_bufferSize",
322
+ "cusolverDnSBgesv",
323
+ "cusolverDnSBgesv_bufferSize",
324
+ "cusolverDnSHgels",
325
+ "cusolverDnSHgels_bufferSize",
326
+ "cusolverDnSHgesv",
327
+ "cusolverDnSHgesv_bufferSize",
328
+ "cusolverDnSSgels",
329
+ "cusolverDnSSgels_bufferSize",
330
+ "cusolverDnSSgesv",
331
+ "cusolverDnSSgesv_bufferSize",
332
+ "cusolverDnSXgels",
333
+ "cusolverDnSXgels_bufferSize",
334
+ "cusolverDnSXgesv",
335
+ "cusolverDnSXgesv_bufferSize",
336
+ "cusolverDnSaxpyHost",
337
+ "cusolverDnSetAdvOptions",
338
+ "cusolverDnSetDeterministicMode",
339
+ "cusolverDnSetStream",
340
+ "cusolverDnSeyeBatch",
341
+ "cusolverDnSgebrd",
342
+ "cusolverDnSgebrd_bufferSize",
343
+ "cusolverDnSgehd2",
344
+ "cusolverDnSgehd2_bufferSize",
345
+ "cusolverDnSgehrd",
346
+ "cusolverDnSgehrd_bufferSize",
347
+ "cusolverDnSgelqfHost",
348
+ "cusolverDnSgemmHost",
349
+ "cusolverDnSgeqlfHost",
350
+ "cusolverDnSgeqrf",
351
+ "cusolverDnSgeqrfHost",
352
+ "cusolverDnSgeqrf_ApI",
353
+ "cusolverDnSgeqrf_ApI_bufferSize",
354
+ "cusolverDnSgeqrf_bufferSize",
355
+ "cusolverDnSgercond",
356
+ "cusolverDnSgercond_bufferSize",
357
+ "cusolverDnSgesvd",
358
+ "cusolverDnSgesvd_bufferSize",
359
+ "cusolverDnSgesvdaStridedBatched",
360
+ "cusolverDnSgesvdaStridedBatched_bufferSize",
361
+ "cusolverDnSgesvdj",
362
+ "cusolverDnSgesvdjBatched",
363
+ "cusolverDnSgesvdjBatched_bufferSize",
364
+ "cusolverDnSgesvdj_bufferSize",
365
+ "cusolverDnSgetrf",
366
+ "cusolverDnSgetrf_bufferSize",
367
+ "cusolverDnSgetrs",
368
+ "cusolverDnSlacpyHost",
369
+ "cusolverDnSlahr2",
370
+ "cusolverDnSlamchHost",
371
+ "cusolverDnSlange",
372
+ "cusolverDnSlangeHost",
373
+ "cusolverDnSlange_bufferSize",
374
+ "cusolverDnSlansy",
375
+ "cusolverDnSlansyHost",
376
+ "cusolverDnSlansy_bufferSize",
377
+ "cusolverDnSlantrHost",
378
+ "cusolverDnSlarfb",
379
+ "cusolverDnSlarfgHost",
380
+ "cusolverDnSlarft",
381
+ "cusolverDnSlarft_bufferSize",
382
+ "cusolverDnSlarnvHost",
383
+ "cusolverDnSlascl",
384
+ "cusolverDnSlasetHost",
385
+ "cusolverDnSlaswp",
386
+ "cusolverDnSlauum",
387
+ "cusolverDnSlauumHost",
388
+ "cusolverDnSlauum_bufferSize",
389
+ "cusolverDnSnrm2Host",
390
+ "cusolverDnSorgbr",
391
+ "cusolverDnSorgbrHost",
392
+ "cusolverDnSorgbr_bufferSize",
393
+ "cusolverDnSorghrHost",
394
+ "cusolverDnSorglqHost",
395
+ "cusolverDnSorgqr",
396
+ "cusolverDnSorgqr_ApI",
397
+ "cusolverDnSorgqr_ApI_bufferSize",
398
+ "cusolverDnSorgqr_bufferSize",
399
+ "cusolverDnSorgtr",
400
+ "cusolverDnSorgtrHost",
401
+ "cusolverDnSorgtr_bufferSize",
402
+ "cusolverDnSormqr",
403
+ "cusolverDnSormqrHost",
404
+ "cusolverDnSormqr_bufferSize",
405
+ "cusolverDnSormtr",
406
+ "cusolverDnSormtrHost",
407
+ "cusolverDnSormtr_bufferSize",
408
+ "cusolverDnSpolar",
409
+ "cusolverDnSpolar_bufferSize",
410
+ "cusolverDnSpotrf",
411
+ "cusolverDnSpotrfBatched",
412
+ "cusolverDnSpotrfHost",
413
+ "cusolverDnSpotrf_bufferSize",
414
+ "cusolverDnSpotri",
415
+ "cusolverDnSpotriHost",
416
+ "cusolverDnSpotri_bufferSize",
417
+ "cusolverDnSpotrs",
418
+ "cusolverDnSpotrsBatched",
419
+ "cusolverDnSpotrsHost",
420
+ "cusolverDnSscalHost",
421
+ "cusolverDnSsteqrHost",
422
+ "cusolverDnSsterfHost",
423
+ "cusolverDnSsyevd",
424
+ "cusolverDnSsyevd_bufferSize",
425
+ "cusolverDnSsyevdx",
426
+ "cusolverDnSsyevdx_bufferSize",
427
+ "cusolverDnSsyevj",
428
+ "cusolverDnSsyevjBatched",
429
+ "cusolverDnSsyevjBatched_bufferSize",
430
+ "cusolverDnSsyevj_bufferSize",
431
+ "cusolverDnSsygst",
432
+ "cusolverDnSsygst2",
433
+ "cusolverDnSsygst2_bufferSize",
434
+ "cusolverDnSsygst_bufferSize",
435
+ "cusolverDnSsygvd",
436
+ "cusolverDnSsygvd_bufferSize",
437
+ "cusolverDnSsygvdx",
438
+ "cusolverDnSsygvdx_bufferSize",
439
+ "cusolverDnSsygvj",
440
+ "cusolverDnSsygvj_bufferSize",
441
+ "cusolverDnSsymv",
442
+ "cusolverDnSsymv_bufferSize",
443
+ "cusolverDnSsytrd",
444
+ "cusolverDnSsytrd_bufferSize",
445
+ "cusolverDnSsytrf",
446
+ "cusolverDnSsytrf_bufferSize",
447
+ "cusolverDnSsytri",
448
+ "cusolverDnSsytriHost",
449
+ "cusolverDnSsytri_bufferSize",
450
+ "cusolverDnSsytrsHost",
451
+ "cusolverDnStrtriHost",
452
+ "cusolverDnSyevd",
453
+ "cusolverDnSyevd_bufferSize",
454
+ "cusolverDnSyevdx",
455
+ "cusolverDnSyevdx_bufferSize",
456
+ "cusolverDnXfillRandNormalOnDevice",
457
+ "cusolverDnXfillRandNormalOnHost",
458
+ "cusolverDnXgeqrf",
459
+ "cusolverDnXgeqrf_bufferSize",
460
+ "cusolverDnXgesvd",
461
+ "cusolverDnXgesvd_bufferSize",
462
+ "cusolverDnXgesvdjGetResidual",
463
+ "cusolverDnXgesvdjGetSweeps",
464
+ "cusolverDnXgesvdjSetMaxSweeps",
465
+ "cusolverDnXgesvdjSetSortEig",
466
+ "cusolverDnXgesvdjSetTolerance",
467
+ "cusolverDnXgesvdp",
468
+ "cusolverDnXgesvdp_bufferSize",
469
+ "cusolverDnXgesvdr",
470
+ "cusolverDnXgesvdr_bufferSize",
471
+ "cusolverDnXgetrf",
472
+ "cusolverDnXgetrf_bufferSize",
473
+ "cusolverDnXgetrs",
474
+ "cusolverDnXpotrf",
475
+ "cusolverDnXpotrf_bufferSize",
476
+ "cusolverDnXpotrs",
477
+ "cusolverDnXsyevd",
478
+ "cusolverDnXsyevd_bufferSize",
479
+ "cusolverDnXsyevdx",
480
+ "cusolverDnXsyevdx_bufferSize",
481
+ "cusolverDnXsyevjGetResidual",
482
+ "cusolverDnXsyevjGetSweeps",
483
+ "cusolverDnXsyevjSetMaxSweeps",
484
+ "cusolverDnXsyevjSetSortEig",
485
+ "cusolverDnXsyevjSetTolerance",
486
+ "cusolverDnXsytrs",
487
+ "cusolverDnXsytrs_bufferSize",
488
+ "cusolverDnXtrtri",
489
+ "cusolverDnXtrtri_bufferSize",
490
+ "cusolverDnZCgels",
491
+ "cusolverDnZCgels_bufferSize",
492
+ "cusolverDnZCgesv",
493
+ "cusolverDnZCgesv_bufferSize",
494
+ "cusolverDnZEgels",
495
+ "cusolverDnZEgels_bufferSize",
496
+ "cusolverDnZEgesv",
497
+ "cusolverDnZEgesv_bufferSize",
498
+ "cusolverDnZKgels",
499
+ "cusolverDnZKgels_bufferSize",
500
+ "cusolverDnZKgesv",
501
+ "cusolverDnZKgesv_bufferSize",
502
+ "cusolverDnZYgels",
503
+ "cusolverDnZYgels_bufferSize",
504
+ "cusolverDnZYgesv",
505
+ "cusolverDnZYgesv_bufferSize",
506
+ "cusolverDnZZgels",
507
+ "cusolverDnZZgels_bufferSize",
508
+ "cusolverDnZZgesv",
509
+ "cusolverDnZZgesv_bufferSize",
510
+ "cusolverDnZaxpyHost",
511
+ "cusolverDnZdscalHost",
512
+ "cusolverDnZeyeBatch",
513
+ "cusolverDnZgebrd",
514
+ "cusolverDnZgebrd_bufferSize",
515
+ "cusolverDnZgehd2",
516
+ "cusolverDnZgehd2_bufferSize",
517
+ "cusolverDnZgehrd",
518
+ "cusolverDnZgehrd_bufferSize",
519
+ "cusolverDnZgelqfHost",
520
+ "cusolverDnZgemmHost",
521
+ "cusolverDnZgeqlfHost",
522
+ "cusolverDnZgeqrf",
523
+ "cusolverDnZgeqrfHost",
524
+ "cusolverDnZgeqrf_ApI",
525
+ "cusolverDnZgeqrf_ApI_bufferSize",
526
+ "cusolverDnZgeqrf_bufferSize",
527
+ "cusolverDnZgercond",
528
+ "cusolverDnZgercond_bufferSize",
529
+ "cusolverDnZgesvd",
530
+ "cusolverDnZgesvd_bufferSize",
531
+ "cusolverDnZgesvdaStridedBatched",
532
+ "cusolverDnZgesvdaStridedBatched_bufferSize",
533
+ "cusolverDnZgesvdj",
534
+ "cusolverDnZgesvdjBatched",
535
+ "cusolverDnZgesvdjBatched_bufferSize",
536
+ "cusolverDnZgesvdj_bufferSize",
537
+ "cusolverDnZgetrf",
538
+ "cusolverDnZgetrf_bufferSize",
539
+ "cusolverDnZgetrs",
540
+ "cusolverDnZheevd",
541
+ "cusolverDnZheevd_bufferSize",
542
+ "cusolverDnZheevdx",
543
+ "cusolverDnZheevdx_bufferSize",
544
+ "cusolverDnZheevj",
545
+ "cusolverDnZheevjBatched",
546
+ "cusolverDnZheevjBatched_bufferSize",
547
+ "cusolverDnZheevj_bufferSize",
548
+ "cusolverDnZhegst",
549
+ "cusolverDnZhegst2",
550
+ "cusolverDnZhegst2_bufferSize",
551
+ "cusolverDnZhegst_bufferSize",
552
+ "cusolverDnZhegvd",
553
+ "cusolverDnZhegvd_bufferSize",
554
+ "cusolverDnZhegvdx",
555
+ "cusolverDnZhegvdx_bufferSize",
556
+ "cusolverDnZhegvj",
557
+ "cusolverDnZhegvj_bufferSize",
558
+ "cusolverDnZhemv",
559
+ "cusolverDnZhemv_bufferSize",
560
+ "cusolverDnZhetrd",
561
+ "cusolverDnZhetrd_bufferSize",
562
+ "cusolverDnZlacpyHost",
563
+ "cusolverDnZlahr2",
564
+ "cusolverDnZlange",
565
+ "cusolverDnZlangeHost",
566
+ "cusolverDnZlange_bufferSize",
567
+ "cusolverDnZlanhe",
568
+ "cusolverDnZlanheHost",
569
+ "cusolverDnZlanhe_bufferSize",
570
+ "cusolverDnZlantrHost",
571
+ "cusolverDnZlarfb",
572
+ "cusolverDnZlarfgHost",
573
+ "cusolverDnZlarft",
574
+ "cusolverDnZlarft_bufferSize",
575
+ "cusolverDnZlarnvHost",
576
+ "cusolverDnZlascl",
577
+ "cusolverDnZlasetHost",
578
+ "cusolverDnZlaswp",
579
+ "cusolverDnZlauum",
580
+ "cusolverDnZlauumHost",
581
+ "cusolverDnZlauum_bufferSize",
582
+ "cusolverDnZnrm2Host",
583
+ "cusolverDnZpolar",
584
+ "cusolverDnZpolar_bufferSize",
585
+ "cusolverDnZpotrf",
586
+ "cusolverDnZpotrfBatched",
587
+ "cusolverDnZpotrfHost",
588
+ "cusolverDnZpotrf_bufferSize",
589
+ "cusolverDnZpotri",
590
+ "cusolverDnZpotriHost",
591
+ "cusolverDnZpotri_bufferSize",
592
+ "cusolverDnZpotrs",
593
+ "cusolverDnZpotrsBatched",
594
+ "cusolverDnZpotrsHost",
595
+ "cusolverDnZsytrf",
596
+ "cusolverDnZsytrf_bufferSize",
597
+ "cusolverDnZsytri",
598
+ "cusolverDnZsytriHost",
599
+ "cusolverDnZsytri_bufferSize",
600
+ "cusolverDnZsytrsHost",
601
+ "cusolverDnZtrtriHost",
602
+ "cusolverDnZungbr",
603
+ "cusolverDnZungbrHost",
604
+ "cusolverDnZungbr_bufferSize",
605
+ "cusolverDnZunghrHost",
606
+ "cusolverDnZunglqHost",
607
+ "cusolverDnZungqr",
608
+ "cusolverDnZungqr_ApI",
609
+ "cusolverDnZungqr_ApI_bufferSize",
610
+ "cusolverDnZungqr_bufferSize",
611
+ "cusolverDnZungtr",
612
+ "cusolverDnZungtrHost",
613
+ "cusolverDnZungtr_bufferSize",
614
+ "cusolverDnZunmqr",
615
+ "cusolverDnZunmqrHost",
616
+ "cusolverDnZunmqr_bufferSize",
617
+ "cusolverDnZunmtr",
618
+ "cusolverDnZunmtrHost",
619
+ "cusolverDnZunmtr_bufferSize",
620
+ "cusolverGetProperty",
621
+ "cusolverGetVersion",
622
+ "cusolverIidentityHost",
623
+ "cusolverRfAccessBundledFactorsDevice",
624
+ "cusolverRfAnalyze",
625
+ "cusolverRfBatchAnalyze",
626
+ "cusolverRfBatchRefactor",
627
+ "cusolverRfBatchResetValues",
628
+ "cusolverRfBatchSetupHost",
629
+ "cusolverRfBatchSolve",
630
+ "cusolverRfBatchZeroPivot",
631
+ "cusolverRfCreate",
632
+ "cusolverRfDestroy",
633
+ "cusolverRfExtractBundledFactorsHost",
634
+ "cusolverRfExtractSplitFactorsHost",
635
+ "cusolverRfGetAlgs",
636
+ "cusolverRfGetMatrixFormat",
637
+ "cusolverRfGetNumericBoostReport",
638
+ "cusolverRfGetNumericProperties",
639
+ "cusolverRfGetResetValuesFastMode",
640
+ "cusolverRfRefactor",
641
+ "cusolverRfResetValues",
642
+ "cusolverRfSetAlgs",
643
+ "cusolverRfSetMatrixFormat",
644
+ "cusolverRfSetNumericProperties",
645
+ "cusolverRfSetResetValuesFastMode",
646
+ "cusolverRfSetupDevice",
647
+ "cusolverRfSetupHost",
648
+ "cusolverRfSetupM",
649
+ "cusolverRfSolve",
650
+ "cusolverSpCcsrbtfHost",
651
+ "cusolverSpCcsrcholBufferInfo",
652
+ "cusolverSpCcsrcholBufferInfoHost",
653
+ "cusolverSpCcsrcholDiag",
654
+ "cusolverSpCcsrcholFactor",
655
+ "cusolverSpCcsrcholFactorHost",
656
+ "cusolverSpCcsrcholSolve",
657
+ "cusolverSpCcsrcholSolveHost",
658
+ "cusolverSpCcsrcholZeroPivot",
659
+ "cusolverSpCcsrcholZeroPivotHost",
660
+ "cusolverSpCcsreigsHost",
661
+ "cusolverSpCcsreigvsi",
662
+ "cusolverSpCcsreigvsiHost",
663
+ "cusolverSpCcsrlsqvqrHost",
664
+ "cusolverSpCcsrlsvchol",
665
+ "cusolverSpCcsrlsvcholHost",
666
+ "cusolverSpCcsrlsvluHost",
667
+ "cusolverSpCcsrlsvqr",
668
+ "cusolverSpCcsrlsvqrHost",
669
+ "cusolverSpCcsrluAnalysisHost",
670
+ "cusolverSpCcsrluBufferInfoHost",
671
+ "cusolverSpCcsrluExtractBTFHost",
672
+ "cusolverSpCcsrluExtractHost",
673
+ "cusolverSpCcsrluExtractMHost",
674
+ "cusolverSpCcsrluFactorHost",
675
+ "cusolverSpCcsrluSolveHost",
676
+ "cusolverSpCcsrluZeroPivotHost",
677
+ "cusolverSpCcsrlucondHost",
678
+ "cusolverSpCcsrqrBufferInfo",
679
+ "cusolverSpCcsrqrBufferInfoBatched",
680
+ "cusolverSpCcsrqrBufferInfoHost",
681
+ "cusolverSpCcsrqrFactor",
682
+ "cusolverSpCcsrqrFactorHost",
683
+ "cusolverSpCcsrqrSetup",
684
+ "cusolverSpCcsrqrSetupHost",
685
+ "cusolverSpCcsrqrSolve",
686
+ "cusolverSpCcsrqrSolveHost",
687
+ "cusolverSpCcsrqrZeroPivot",
688
+ "cusolverSpCcsrqrZeroPivotHost",
689
+ "cusolverSpCcsrqrrcond",
690
+ "cusolverSpCcsrqrsvBatched",
691
+ "cusolverSpCcsrsubm2denseHost",
692
+ "cusolverSpCcsrzfdHost",
693
+ "cusolverSpCreate",
694
+ "cusolverSpCreateCsrcholInfo",
695
+ "cusolverSpCreateCsrcholInfoHost",
696
+ "cusolverSpCreateCsrluInfoHost",
697
+ "cusolverSpCreateCsrqrInfo",
698
+ "cusolverSpCreateCsrqrInfoHost",
699
+ "cusolverSpCreateGluInfo",
700
+ "cusolverSpCreateSnluInfo",
701
+ "cusolverSpCsnluBuffersize",
702
+ "cusolverSpCsnluFactor",
703
+ "cusolverSpCsnluSolve",
704
+ "cusolverSpCsymgthr",
705
+ "cusolverSpCsymgthrHost",
706
+ "cusolverSpDcsrbtfHost",
707
+ "cusolverSpDcsrcholBufferInfo",
708
+ "cusolverSpDcsrcholBufferInfoHost",
709
+ "cusolverSpDcsrcholDiag",
710
+ "cusolverSpDcsrcholFactor",
711
+ "cusolverSpDcsrcholFactorHost",
712
+ "cusolverSpDcsrcholSolve",
713
+ "cusolverSpDcsrcholSolveHost",
714
+ "cusolverSpDcsrcholZeroPivot",
715
+ "cusolverSpDcsrcholZeroPivotHost",
716
+ "cusolverSpDcsreigsHost",
717
+ "cusolverSpDcsreigvsi",
718
+ "cusolverSpDcsreigvsiHost",
719
+ "cusolverSpDcsrlsqvqrHost",
720
+ "cusolverSpDcsrlsvchol",
721
+ "cusolverSpDcsrlsvcholHost",
722
+ "cusolverSpDcsrlsvluHost",
723
+ "cusolverSpDcsrlsvqr",
724
+ "cusolverSpDcsrlsvqrHost",
725
+ "cusolverSpDcsrluAnalysisHost",
726
+ "cusolverSpDcsrluBufferInfoHost",
727
+ "cusolverSpDcsrluExtractBTFHost",
728
+ "cusolverSpDcsrluExtractHost",
729
+ "cusolverSpDcsrluExtractMHost",
730
+ "cusolverSpDcsrluFactorHost",
731
+ "cusolverSpDcsrluSolveHost",
732
+ "cusolverSpDcsrluZeroPivotHost",
733
+ "cusolverSpDcsrlucondHost",
734
+ "cusolverSpDcsrqrBufferInfo",
735
+ "cusolverSpDcsrqrBufferInfoBatched",
736
+ "cusolverSpDcsrqrBufferInfoHost",
737
+ "cusolverSpDcsrqrFactor",
738
+ "cusolverSpDcsrqrFactorHost",
739
+ "cusolverSpDcsrqrSetup",
740
+ "cusolverSpDcsrqrSetupHost",
741
+ "cusolverSpDcsrqrSolve",
742
+ "cusolverSpDcsrqrSolveHost",
743
+ "cusolverSpDcsrqrZeroPivot",
744
+ "cusolverSpDcsrqrZeroPivotHost",
745
+ "cusolverSpDcsrqrrcond",
746
+ "cusolverSpDcsrqrsvBatched",
747
+ "cusolverSpDcsrsubm2denseHost",
748
+ "cusolverSpDcsrzfdHost",
749
+ "cusolverSpDestroy",
750
+ "cusolverSpDestroyCsrcholInfo",
751
+ "cusolverSpDestroyCsrcholInfoHost",
752
+ "cusolverSpDestroyCsrluInfoHost",
753
+ "cusolverSpDestroyCsrqrInfo",
754
+ "cusolverSpDestroyCsrqrInfoHost",
755
+ "cusolverSpDestroyGluInfo",
756
+ "cusolverSpDestroySnluInfo",
757
+ "cusolverSpDgluAnalysis",
758
+ "cusolverSpDgluBufferSize",
759
+ "cusolverSpDgluExtractMHost",
760
+ "cusolverSpDgluFactor",
761
+ "cusolverSpDgluNumericBoost",
762
+ "cusolverSpDgluReset",
763
+ "cusolverSpDgluSetup",
764
+ "cusolverSpDgluSetupByTile",
765
+ "cusolverSpDgluSolve",
766
+ "cusolverSpDnrminf",
767
+ "cusolverSpDsnluBuffersize",
768
+ "cusolverSpDsnluFactor",
769
+ "cusolverSpDsnluSolve",
770
+ "cusolverSpDsymgthr",
771
+ "cusolverSpDsymgthrHost",
772
+ "cusolverSpGetStream",
773
+ "cusolverSpLcsrqrBufferInfo",
774
+ "cusolverSpLcsrqrFactor",
775
+ "cusolverSpLcsrqrSetup",
776
+ "cusolverSpLcsrqrSolve",
777
+ "cusolverSpLcsrqrSolveRefine",
778
+ "cusolverSpLcsrqrZeroPivot",
779
+ "cusolverSpLcsrqrrcond",
780
+ "cusolverSpQcsrqrBufferInfo",
781
+ "cusolverSpQcsrqrFactor",
782
+ "cusolverSpQcsrqrSetup",
783
+ "cusolverSpQcsrqrSolve",
784
+ "cusolverSpQcsrqrSolveRefine",
785
+ "cusolverSpQcsrqrZeroPivot",
786
+ "cusolverSpQcsrqrrcond",
787
+ "cusolverSpScsrbtfHost",
788
+ "cusolverSpScsrcholBufferInfo",
789
+ "cusolverSpScsrcholBufferInfoHost",
790
+ "cusolverSpScsrcholDiag",
791
+ "cusolverSpScsrcholFactor",
792
+ "cusolverSpScsrcholFactorHost",
793
+ "cusolverSpScsrcholSolve",
794
+ "cusolverSpScsrcholSolveHost",
795
+ "cusolverSpScsrcholZeroPivot",
796
+ "cusolverSpScsrcholZeroPivotHost",
797
+ "cusolverSpScsreigsHost",
798
+ "cusolverSpScsreigvsi",
799
+ "cusolverSpScsreigvsiHost",
800
+ "cusolverSpScsrlsqvqrHost",
801
+ "cusolverSpScsrlsvchol",
802
+ "cusolverSpScsrlsvcholHost",
803
+ "cusolverSpScsrlsvluHost",
804
+ "cusolverSpScsrlsvqr",
805
+ "cusolverSpScsrlsvqrHost",
806
+ "cusolverSpScsrluAnalysisHost",
807
+ "cusolverSpScsrluBufferInfoHost",
808
+ "cusolverSpScsrluExtractBTFHost",
809
+ "cusolverSpScsrluExtractHost",
810
+ "cusolverSpScsrluExtractMHost",
811
+ "cusolverSpScsrluFactorHost",
812
+ "cusolverSpScsrluSolveHost",
813
+ "cusolverSpScsrluZeroPivotHost",
814
+ "cusolverSpScsrlucondHost",
815
+ "cusolverSpScsrqrBufferInfo",
816
+ "cusolverSpScsrqrBufferInfoBatched",
817
+ "cusolverSpScsrqrBufferInfoHost",
818
+ "cusolverSpScsrqrFactor",
819
+ "cusolverSpScsrqrFactorHost",
820
+ "cusolverSpScsrqrSetup",
821
+ "cusolverSpScsrqrSetupHost",
822
+ "cusolverSpScsrqrSolve",
823
+ "cusolverSpScsrqrSolveHost",
824
+ "cusolverSpScsrqrZeroPivot",
825
+ "cusolverSpScsrqrZeroPivotHost",
826
+ "cusolverSpScsrqrrcond",
827
+ "cusolverSpScsrqrsvBatched",
828
+ "cusolverSpScsrsubm2denseHost",
829
+ "cusolverSpScsrzfdHost",
830
+ "cusolverSpSetStream",
831
+ "cusolverSpSsnluBuffersize",
832
+ "cusolverSpSsnluFactor",
833
+ "cusolverSpSsnluSolve",
834
+ "cusolverSpSsymgthr",
835
+ "cusolverSpSsymgthrHost",
836
+ "cusolverSpXcsr2cscHost",
837
+ "cusolverSpXcsr2csc_bufferSizeHost",
838
+ "cusolverSpXcsrcholAnalysis",
839
+ "cusolverSpXcsrcholAnalysisHost",
840
+ "cusolverSpXcsrissymHost",
841
+ "cusolverSpXcsrluAnalysisHost",
842
+ "cusolverSpXcsrluConfigHost",
843
+ "cusolverSpXcsrluNnzHost",
844
+ "cusolverSpXcsrluNnzMHost",
845
+ "cusolverSpXcsrmetisndHost",
846
+ "cusolverSpXcsrnsepHost",
847
+ "cusolverSpXcsrpermHost",
848
+ "cusolverSpXcsrperm_bufferSizeHost",
849
+ "cusolverSpXcsrqrAnalysis",
850
+ "cusolverSpXcsrqrAnalysisBatched",
851
+ "cusolverSpXcsrqrAnalysisHost",
852
+ "cusolverSpXcsrqrConfigInfo",
853
+ "cusolverSpXcsrsubmHost",
854
+ "cusolverSpXcsrsubmNnzHost",
855
+ "cusolverSpXcsrsymamdHost",
856
+ "cusolverSpXcsrsymmdqHost",
857
+ "cusolverSpXcsrsympermHost",
858
+ "cusolverSpXcsrsymperm_bufferSizeHost",
859
+ "cusolverSpXcsrsymrcmHost",
860
+ "cusolverSpXgluZeroPivot",
861
+ "cusolverSpXsnluAnalysis",
862
+ "cusolverSpXsnluFlops",
863
+ "cusolverSpXsnluReport",
864
+ "cusolverSpXsnluResizeSupernodeBy",
865
+ "cusolverSpXsnluSetReorder",
866
+ "cusolverSpZcsrbtfHost",
867
+ "cusolverSpZcsrcholBufferInfo",
868
+ "cusolverSpZcsrcholBufferInfoHost",
869
+ "cusolverSpZcsrcholDiag",
870
+ "cusolverSpZcsrcholFactor",
871
+ "cusolverSpZcsrcholFactorHost",
872
+ "cusolverSpZcsrcholSolve",
873
+ "cusolverSpZcsrcholSolveHost",
874
+ "cusolverSpZcsrcholZeroPivot",
875
+ "cusolverSpZcsrcholZeroPivotHost",
876
+ "cusolverSpZcsreigsHost",
877
+ "cusolverSpZcsreigvsi",
878
+ "cusolverSpZcsreigvsiHost",
879
+ "cusolverSpZcsrlsqvqrHost",
880
+ "cusolverSpZcsrlsvchol",
881
+ "cusolverSpZcsrlsvcholHost",
882
+ "cusolverSpZcsrlsvluHost",
883
+ "cusolverSpZcsrlsvqr",
884
+ "cusolverSpZcsrlsvqrHost",
885
+ "cusolverSpZcsrluAnalysisHost",
886
+ "cusolverSpZcsrluBufferInfoHost",
887
+ "cusolverSpZcsrluExtractBTFHost",
888
+ "cusolverSpZcsrluExtractHost",
889
+ "cusolverSpZcsrluExtractMHost",
890
+ "cusolverSpZcsrluFactorHost",
891
+ "cusolverSpZcsrluSolveHost",
892
+ "cusolverSpZcsrluZeroPivotHost",
893
+ "cusolverSpZcsrlucondHost",
894
+ "cusolverSpZcsrqrBufferInfo",
895
+ "cusolverSpZcsrqrBufferInfoBatched",
896
+ "cusolverSpZcsrqrBufferInfoHost",
897
+ "cusolverSpZcsrqrFactor",
898
+ "cusolverSpZcsrqrFactorHost",
899
+ "cusolverSpZcsrqrSetup",
900
+ "cusolverSpZcsrqrSetupHost",
901
+ "cusolverSpZcsrqrSolve",
902
+ "cusolverSpZcsrqrSolveHost",
903
+ "cusolverSpZcsrqrZeroPivot",
904
+ "cusolverSpZcsrqrZeroPivotHost",
905
+ "cusolverSpZcsrqrrcond",
906
+ "cusolverSpZcsrqrsvBatched",
907
+ "cusolverSpZcsrsubm2denseHost",
908
+ "cusolverSpZcsrzfdHost",
909
+ "cusolverSpZsnluBuffersize",
910
+ "cusolverSpZsnluFactor",
911
+ "cusolverSpZsnluSolve",
912
+ "cusolverSpZsymgthr",
913
+ "cusolverSpZsymgthrHost",
914
+ "cusolverXcsrqr_dump",
915
+ "pegasusCcsr2dense",
916
+ "pegasusCcsrmvHost",
917
+ "pegasusDcsr2dense",
918
+ "pegasusDcsrmvHost",
919
+ "pegasusScsr2dense",
920
+ "pegasusScsrmvHost",
921
+ "pegasusXcoo2csr",
922
+ "pegasusXcooStableSortByRow",
923
+ "pegasusXcooStableSort_bufferSizeExt",
924
+ "pegasusXcsr2coo",
925
+ "pegasusZcsr2dense",
926
+ "pegasusZcsrmvHost",
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/cuda/cusparse.inc ADDED
@@ -0,0 +1,421 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "cusparseAxpby",
2
+ "cusparseBlockedEllGet",
3
+ "cusparseBsrSetStridedBatch",
4
+ "cusparseCbsr2csr",
5
+ "cusparseCbsric02",
6
+ "cusparseCbsric02_analysis",
7
+ "cusparseCbsric02_bufferSize",
8
+ "cusparseCbsrilu02",
9
+ "cusparseCbsrilu02_analysis",
10
+ "cusparseCbsrilu02_bufferSize",
11
+ "cusparseCbsrilu02_numericBoost",
12
+ "cusparseCbsrmm",
13
+ "cusparseCbsrmv",
14
+ "cusparseCbsrsm2_analysis",
15
+ "cusparseCbsrsm2_bufferSize",
16
+ "cusparseCbsrsm2_solve",
17
+ "cusparseCbsrsv2_analysis",
18
+ "cusparseCbsrsv2_bufferSize",
19
+ "cusparseCbsrsv2_solve",
20
+ "cusparseCbsrxmv",
21
+ "cusparseCcsr2bsr",
22
+ "cusparseCcsr2csr_compress",
23
+ "cusparseCcsr2csru",
24
+ "cusparseCcsr2gebsr",
25
+ "cusparseCcsr2gebsr_bufferSize",
26
+ "cusparseCcsrcolor",
27
+ "cusparseCcsrgeam2",
28
+ "cusparseCcsrgeam2_bufferSizeExt",
29
+ "cusparseCcsric02",
30
+ "cusparseCcsric02_analysis",
31
+ "cusparseCcsric02_bufferSize",
32
+ "cusparseCcsrilu02",
33
+ "cusparseCcsrilu02_analysis",
34
+ "cusparseCcsrilu02_bufferSize",
35
+ "cusparseCcsrilu02_numericBoost",
36
+ "cusparseCcsru2csr",
37
+ "cusparseCcsru2csr_bufferSizeExt",
38
+ "cusparseCgebsr2csr",
39
+ "cusparseCgebsr2gebsc",
40
+ "cusparseCgebsr2gebsc_bufferSize",
41
+ "cusparseCgebsr2gebsr",
42
+ "cusparseCgebsr2gebsr_bufferSize",
43
+ "cusparseCgemvi",
44
+ "cusparseCgemvi_bufferSize",
45
+ "cusparseCgpsvInterleavedBatch",
46
+ "cusparseCgpsvInterleavedBatch_bufferSizeExt",
47
+ "cusparseCgtsv2",
48
+ "cusparseCgtsv2StridedBatch",
49
+ "cusparseCgtsv2StridedBatch_bufferSizeExt",
50
+ "cusparseCgtsv2_bufferSizeExt",
51
+ "cusparseCgtsv2_nopivot",
52
+ "cusparseCgtsv2_nopivot_bufferSizeExt",
53
+ "cusparseCgtsvInterleavedBatch",
54
+ "cusparseCgtsvInterleavedBatch_bufferSizeExt",
55
+ "cusparseCnnz",
56
+ "cusparseCnnz_compress",
57
+ "cusparseConstBlockedEllGet",
58
+ "cusparseConstCooGet",
59
+ "cusparseConstCscGet",
60
+ "cusparseConstCsrGet",
61
+ "cusparseConstDnMatGet",
62
+ "cusparseConstDnMatGetValues",
63
+ "cusparseConstDnVecGet",
64
+ "cusparseConstDnVecGetValues",
65
+ "cusparseConstSpMatGetValues",
66
+ "cusparseConstSpVecGet",
67
+ "cusparseConstSpVecGetValues",
68
+ "cusparseCooGet",
69
+ "cusparseCooSetPointers",
70
+ "cusparseCooSetStridedBatch",
71
+ "cusparseCreate",
72
+ "cusparseCreateBlockedEll",
73
+ "cusparseCreateBsr",
74
+ "cusparseCreateBsric02Info",
75
+ "cusparseCreateBsrilu02Info",
76
+ "cusparseCreateBsrsm2Info",
77
+ "cusparseCreateBsrsv2Info",
78
+ "cusparseCreateColorInfo",
79
+ "cusparseCreateConstBlockedEll",
80
+ "cusparseCreateConstBsr",
81
+ "cusparseCreateConstCoo",
82
+ "cusparseCreateConstCsc",
83
+ "cusparseCreateConstCsr",
84
+ "cusparseCreateConstDnMat",
85
+ "cusparseCreateConstDnVec",
86
+ "cusparseCreateConstSlicedEll",
87
+ "cusparseCreateConstSpVec",
88
+ "cusparseCreateCoo",
89
+ "cusparseCreateCsc",
90
+ "cusparseCreateCsr",
91
+ "cusparseCreateCsric02Info",
92
+ "cusparseCreateCsrilu02Info",
93
+ "cusparseCreateCsru2csrInfo",
94
+ "cusparseCreateDnMat",
95
+ "cusparseCreateDnVec",
96
+ "cusparseCreateIdentityPermutation",
97
+ "cusparseCreateMatDescr",
98
+ "cusparseCreatePruneInfo",
99
+ "cusparseCreateSlicedEll",
100
+ "cusparseCreateSpVec",
101
+ "cusparseCscGet",
102
+ "cusparseCscSetPointers",
103
+ "cusparseCsr2cscEx2",
104
+ "cusparseCsr2cscEx2_bufferSize",
105
+ "cusparseCsrGet",
106
+ "cusparseCsrSetPointers",
107
+ "cusparseCsrSetStridedBatch",
108
+ "cusparseDbsr2csr",
109
+ "cusparseDbsric02",
110
+ "cusparseDbsric02_analysis",
111
+ "cusparseDbsric02_bufferSize",
112
+ "cusparseDbsrilu02",
113
+ "cusparseDbsrilu02_analysis",
114
+ "cusparseDbsrilu02_bufferSize",
115
+ "cusparseDbsrilu02_numericBoost",
116
+ "cusparseDbsrmm",
117
+ "cusparseDbsrmv",
118
+ "cusparseDbsrsm2_analysis",
119
+ "cusparseDbsrsm2_bufferSize",
120
+ "cusparseDbsrsm2_solve",
121
+ "cusparseDbsrsv2_analysis",
122
+ "cusparseDbsrsv2_bufferSize",
123
+ "cusparseDbsrsv2_solve",
124
+ "cusparseDbsrxmv",
125
+ "cusparseDcsr2bsr",
126
+ "cusparseDcsr2csr_compress",
127
+ "cusparseDcsr2csru",
128
+ "cusparseDcsr2gebsr",
129
+ "cusparseDcsr2gebsr_bufferSize",
130
+ "cusparseDcsrcolor",
131
+ "cusparseDcsrgeam2",
132
+ "cusparseDcsrgeam2_bufferSizeExt",
133
+ "cusparseDcsric02",
134
+ "cusparseDcsric02_analysis",
135
+ "cusparseDcsric02_bufferSize",
136
+ "cusparseDcsrilu02",
137
+ "cusparseDcsrilu02_analysis",
138
+ "cusparseDcsrilu02_bufferSize",
139
+ "cusparseDcsrilu02_numericBoost",
140
+ "cusparseDcsru2csr",
141
+ "cusparseDcsru2csr_bufferSizeExt",
142
+ "cusparseDenseToSparse_analysis",
143
+ "cusparseDenseToSparse_bufferSize",
144
+ "cusparseDenseToSparse_convert",
145
+ "cusparseDestroy",
146
+ "cusparseDestroyBsric02Info",
147
+ "cusparseDestroyBsrilu02Info",
148
+ "cusparseDestroyBsrsm2Info",
149
+ "cusparseDestroyBsrsv2Info",
150
+ "cusparseDestroyColorInfo",
151
+ "cusparseDestroyCsric02Info",
152
+ "cusparseDestroyCsrilu02Info",
153
+ "cusparseDestroyCsru2csrInfo",
154
+ "cusparseDestroyDnMat",
155
+ "cusparseDestroyDnVec",
156
+ "cusparseDestroyMatDescr",
157
+ "cusparseDestroyPruneInfo",
158
+ "cusparseDestroySpMat",
159
+ "cusparseDestroySpVec",
160
+ "cusparseDgebsr2csr",
161
+ "cusparseDgebsr2gebsc",
162
+ "cusparseDgebsr2gebsc_bufferSize",
163
+ "cusparseDgebsr2gebsr",
164
+ "cusparseDgebsr2gebsr_bufferSize",
165
+ "cusparseDgemvi",
166
+ "cusparseDgemvi_bufferSize",
167
+ "cusparseDgpsvInterleavedBatch",
168
+ "cusparseDgpsvInterleavedBatch_bufferSizeExt",
169
+ "cusparseDgtsv2",
170
+ "cusparseDgtsv2StridedBatch",
171
+ "cusparseDgtsv2StridedBatch_bufferSizeExt",
172
+ "cusparseDgtsv2_bufferSizeExt",
173
+ "cusparseDgtsv2_nopivot",
174
+ "cusparseDgtsv2_nopivot_bufferSizeExt",
175
+ "cusparseDgtsvInterleavedBatch",
176
+ "cusparseDgtsvInterleavedBatch_bufferSizeExt",
177
+ "cusparseDnMatGet",
178
+ "cusparseDnMatGetStridedBatch",
179
+ "cusparseDnMatGetValues",
180
+ "cusparseDnMatSetStridedBatch",
181
+ "cusparseDnMatSetValues",
182
+ "cusparseDnVecGet",
183
+ "cusparseDnVecGetValues",
184
+ "cusparseDnVecSetValues",
185
+ "cusparseDnnz",
186
+ "cusparseDnnz_compress",
187
+ "cusparseDpruneCsr2csr",
188
+ "cusparseDpruneCsr2csrByPercentage",
189
+ "cusparseDpruneCsr2csrByPercentage_bufferSizeExt",
190
+ "cusparseDpruneCsr2csrNnz",
191
+ "cusparseDpruneCsr2csrNnzByPercentage",
192
+ "cusparseDpruneCsr2csr_bufferSizeExt",
193
+ "cusparseDpruneDense2csr",
194
+ "cusparseDpruneDense2csrByPercentage",
195
+ "cusparseDpruneDense2csrByPercentage_bufferSizeExt",
196
+ "cusparseDpruneDense2csrNnz",
197
+ "cusparseDpruneDense2csrNnzByPercentage",
198
+ "cusparseDpruneDense2csr_bufferSizeExt",
199
+ "cusparseGather",
200
+ "cusparseGetErrorName",
201
+ "cusparseGetErrorString",
202
+ "cusparseGetMatDiagType",
203
+ "cusparseGetMatFillMode",
204
+ "cusparseGetMatIndexBase",
205
+ "cusparseGetMatType",
206
+ "cusparseGetPointerMode",
207
+ "cusparseGetProperty",
208
+ "cusparseGetStream",
209
+ "cusparseGetVersion",
210
+ "cusparseHpruneCsr2csr",
211
+ "cusparseHpruneCsr2csrByPercentage",
212
+ "cusparseHpruneCsr2csrByPercentage_bufferSizeExt",
213
+ "cusparseHpruneCsr2csrNnz",
214
+ "cusparseHpruneCsr2csrNnzByPercentage",
215
+ "cusparseHpruneCsr2csr_bufferSizeExt",
216
+ "cusparseHpruneDense2csr",
217
+ "cusparseHpruneDense2csrByPercentage",
218
+ "cusparseHpruneDense2csrByPercentage_bufferSizeExt",
219
+ "cusparseHpruneDense2csrNnz",
220
+ "cusparseHpruneDense2csrNnzByPercentage",
221
+ "cusparseHpruneDense2csr_bufferSizeExt",
222
+ "cusparseLoggerForceDisable",
223
+ "cusparseLoggerOpenFile",
224
+ "cusparseLoggerSetCallback",
225
+ "cusparseLoggerSetFile",
226
+ "cusparseLoggerSetLevel",
227
+ "cusparseLoggerSetMask",
228
+ "cusparseRot",
229
+ "cusparseSDDMM",
230
+ "cusparseSDDMM_bufferSize",
231
+ "cusparseSDDMM_preprocess",
232
+ "cusparseSbsr2csr",
233
+ "cusparseSbsric02",
234
+ "cusparseSbsric02_analysis",
235
+ "cusparseSbsric02_bufferSize",
236
+ "cusparseSbsrilu02",
237
+ "cusparseSbsrilu02_analysis",
238
+ "cusparseSbsrilu02_bufferSize",
239
+ "cusparseSbsrilu02_numericBoost",
240
+ "cusparseSbsrmm",
241
+ "cusparseSbsrmv",
242
+ "cusparseSbsrsm2_analysis",
243
+ "cusparseSbsrsm2_bufferSize",
244
+ "cusparseSbsrsm2_solve",
245
+ "cusparseSbsrsv2_analysis",
246
+ "cusparseSbsrsv2_bufferSize",
247
+ "cusparseSbsrsv2_solve",
248
+ "cusparseSbsrxmv",
249
+ "cusparseScatter",
250
+ "cusparseScsr2bsr",
251
+ "cusparseScsr2csr_compress",
252
+ "cusparseScsr2csru",
253
+ "cusparseScsr2gebsr",
254
+ "cusparseScsr2gebsr_bufferSize",
255
+ "cusparseScsrcolor",
256
+ "cusparseScsrgeam2",
257
+ "cusparseScsrgeam2_bufferSizeExt",
258
+ "cusparseScsric02",
259
+ "cusparseScsric02_analysis",
260
+ "cusparseScsric02_bufferSize",
261
+ "cusparseScsrilu02",
262
+ "cusparseScsrilu02_analysis",
263
+ "cusparseScsrilu02_bufferSize",
264
+ "cusparseScsrilu02_numericBoost",
265
+ "cusparseScsru2csr",
266
+ "cusparseScsru2csr_bufferSizeExt",
267
+ "cusparseSetMatDiagType",
268
+ "cusparseSetMatFillMode",
269
+ "cusparseSetMatIndexBase",
270
+ "cusparseSetMatType",
271
+ "cusparseSetPointerMode",
272
+ "cusparseSetStream",
273
+ "cusparseSgebsr2csr",
274
+ "cusparseSgebsr2gebsc",
275
+ "cusparseSgebsr2gebsc_bufferSize",
276
+ "cusparseSgebsr2gebsr",
277
+ "cusparseSgebsr2gebsr_bufferSize",
278
+ "cusparseSgemvi",
279
+ "cusparseSgemvi_bufferSize",
280
+ "cusparseSgpsvInterleavedBatch",
281
+ "cusparseSgpsvInterleavedBatch_bufferSizeExt",
282
+ "cusparseSgtsv2",
283
+ "cusparseSgtsv2StridedBatch",
284
+ "cusparseSgtsv2StridedBatch_bufferSizeExt",
285
+ "cusparseSgtsv2_bufferSizeExt",
286
+ "cusparseSgtsv2_nopivot",
287
+ "cusparseSgtsv2_nopivot_bufferSizeExt",
288
+ "cusparseSgtsvInterleavedBatch",
289
+ "cusparseSgtsvInterleavedBatch_bufferSizeExt",
290
+ "cusparseSnnz",
291
+ "cusparseSnnz_compress",
292
+ "cusparseSpGEMM_compute",
293
+ "cusparseSpGEMM_copy",
294
+ "cusparseSpGEMM_createDescr",
295
+ "cusparseSpGEMM_destroyDescr",
296
+ "cusparseSpGEMM_estimateMemory",
297
+ "cusparseSpGEMM_getNumProducts",
298
+ "cusparseSpGEMM_workEstimation",
299
+ "cusparseSpGEMMreuse_compute",
300
+ "cusparseSpGEMMreuse_copy",
301
+ "cusparseSpGEMMreuse_nnz",
302
+ "cusparseSpGEMMreuse_workEstimation",
303
+ "cusparseSpMM",
304
+ "cusparseSpMMOp",
305
+ "cusparseSpMMOp_createPlan",
306
+ "cusparseSpMMOp_destroyPlan",
307
+ "cusparseSpMM_bufferSize",
308
+ "cusparseSpMM_preprocess",
309
+ "cusparseSpMV",
310
+ "cusparseSpMV_bufferSize",
311
+ "cusparseSpMatGetAttribute",
312
+ "cusparseSpMatGetFormat",
313
+ "cusparseSpMatGetIndexBase",
314
+ "cusparseSpMatGetSize",
315
+ "cusparseSpMatGetStridedBatch",
316
+ "cusparseSpMatGetValues",
317
+ "cusparseSpMatSetAttribute",
318
+ "cusparseSpMatSetValues",
319
+ "cusparseSpSM_analysis",
320
+ "cusparseSpSM_bufferSize",
321
+ "cusparseSpSM_createDescr",
322
+ "cusparseSpSM_destroyDescr",
323
+ "cusparseSpSM_solve",
324
+ "cusparseSpSV_analysis",
325
+ "cusparseSpSV_bufferSize",
326
+ "cusparseSpSV_createDescr",
327
+ "cusparseSpSV_destroyDescr",
328
+ "cusparseSpSV_solve",
329
+ "cusparseSpSV_updateMatrix",
330
+ "cusparseSpVV",
331
+ "cusparseSpVV_bufferSize",
332
+ "cusparseSpVecGet",
333
+ "cusparseSpVecGetIndexBase",
334
+ "cusparseSpVecGetValues",
335
+ "cusparseSpVecSetValues",
336
+ "cusparseSparseToDense",
337
+ "cusparseSparseToDense_bufferSize",
338
+ "cusparseSpruneCsr2csr",
339
+ "cusparseSpruneCsr2csrByPercentage",
340
+ "cusparseSpruneCsr2csrByPercentage_bufferSizeExt",
341
+ "cusparseSpruneCsr2csrNnz",
342
+ "cusparseSpruneCsr2csrNnzByPercentage",
343
+ "cusparseSpruneCsr2csr_bufferSizeExt",
344
+ "cusparseSpruneDense2csr",
345
+ "cusparseSpruneDense2csrByPercentage",
346
+ "cusparseSpruneDense2csrByPercentage_bufferSizeExt",
347
+ "cusparseSpruneDense2csrNnz",
348
+ "cusparseSpruneDense2csrNnzByPercentage",
349
+ "cusparseSpruneDense2csr_bufferSizeExt",
350
+ "cusparseXbsric02_zeroPivot",
351
+ "cusparseXbsrilu02_zeroPivot",
352
+ "cusparseXbsrsm2_zeroPivot",
353
+ "cusparseXbsrsv2_zeroPivot",
354
+ "cusparseXcoo2csr",
355
+ "cusparseXcoosortByColumn",
356
+ "cusparseXcoosortByRow",
357
+ "cusparseXcoosort_bufferSizeExt",
358
+ "cusparseXcscsort",
359
+ "cusparseXcscsort_bufferSizeExt",
360
+ "cusparseXcsr2bsrNnz",
361
+ "cusparseXcsr2coo",
362
+ "cusparseXcsr2gebsrNnz",
363
+ "cusparseXcsrgeam2Nnz",
364
+ "cusparseXcsric02_zeroPivot",
365
+ "cusparseXcsrilu02_zeroPivot",
366
+ "cusparseXcsrsort",
367
+ "cusparseXcsrsort_bufferSizeExt",
368
+ "cusparseXgebsr2gebsrNnz",
369
+ "cusparseZbsr2csr",
370
+ "cusparseZbsric02",
371
+ "cusparseZbsric02_analysis",
372
+ "cusparseZbsric02_bufferSize",
373
+ "cusparseZbsrilu02",
374
+ "cusparseZbsrilu02_analysis",
375
+ "cusparseZbsrilu02_bufferSize",
376
+ "cusparseZbsrilu02_numericBoost",
377
+ "cusparseZbsrmm",
378
+ "cusparseZbsrmv",
379
+ "cusparseZbsrsm2_analysis",
380
+ "cusparseZbsrsm2_bufferSize",
381
+ "cusparseZbsrsm2_solve",
382
+ "cusparseZbsrsv2_analysis",
383
+ "cusparseZbsrsv2_bufferSize",
384
+ "cusparseZbsrsv2_solve",
385
+ "cusparseZbsrxmv",
386
+ "cusparseZcsr2bsr",
387
+ "cusparseZcsr2csr_compress",
388
+ "cusparseZcsr2csru",
389
+ "cusparseZcsr2gebsr",
390
+ "cusparseZcsr2gebsr_bufferSize",
391
+ "cusparseZcsrcolor",
392
+ "cusparseZcsrgeam2",
393
+ "cusparseZcsrgeam2_bufferSizeExt",
394
+ "cusparseZcsric02",
395
+ "cusparseZcsric02_analysis",
396
+ "cusparseZcsric02_bufferSize",
397
+ "cusparseZcsrilu02",
398
+ "cusparseZcsrilu02_analysis",
399
+ "cusparseZcsrilu02_bufferSize",
400
+ "cusparseZcsrilu02_numericBoost",
401
+ "cusparseZcsru2csr",
402
+ "cusparseZcsru2csr_bufferSizeExt",
403
+ "cusparseZgebsr2csr",
404
+ "cusparseZgebsr2gebsc",
405
+ "cusparseZgebsr2gebsc_bufferSize",
406
+ "cusparseZgebsr2gebsr",
407
+ "cusparseZgebsr2gebsr_bufferSize",
408
+ "cusparseZgemvi",
409
+ "cusparseZgemvi_bufferSize",
410
+ "cusparseZgpsvInterleavedBatch",
411
+ "cusparseZgpsvInterleavedBatch_bufferSizeExt",
412
+ "cusparseZgtsv2",
413
+ "cusparseZgtsv2StridedBatch",
414
+ "cusparseZgtsv2StridedBatch_bufferSizeExt",
415
+ "cusparseZgtsv2_bufferSizeExt",
416
+ "cusparseZgtsv2_nopivot",
417
+ "cusparseZgtsv2_nopivot_bufferSizeExt",
418
+ "cusparseZgtsvInterleavedBatch",
419
+ "cusparseZgtsvInterleavedBatch_bufferSizeExt",
420
+ "cusparseZnnz",
421
+ "cusparseZnnz_compress",
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/core/bitmap.h ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_CORE_BITMAP_H_
17
+ #define TENSORFLOW_TSL_LIB_CORE_BITMAP_H_
18
+
19
+ #include <string>
20
+
21
+ #include "tsl/platform/logging.h"
22
+
23
+ namespace tsl {
24
+ namespace core {
25
+
26
+ class Bitmap {
27
+ public:
28
+ // Create a bitmap that holds 0 bits.
29
+ Bitmap();
30
+
31
+ // Create a bitmap that holds n bits, all initially zero.
32
+ explicit Bitmap(size_t n);
33
+
34
+ ~Bitmap();
35
+
36
+ Bitmap(const Bitmap&) = delete;
37
+ Bitmap& operator=(const Bitmap&) = delete;
38
+
39
+ // Return the number of bits that the bitmap can hold.
40
+ size_t bits() const;
41
+
42
+ // Replace contents of *this with a bitmap of n bits, all set to zero.
43
+ void Reset(size_t n);
44
+
45
+ // Return the contents of the ith bit.
46
+ // REQUIRES: i < bits()
47
+ bool get(size_t i) const;
48
+
49
+ // Set the contents of the ith bit to true.
50
+ // REQUIRES: i < bits()
51
+ void set(size_t i);
52
+
53
+ // Set the contents of the ith bit to false.
54
+ // REQUIRES: i < bits()
55
+ void clear(size_t i);
56
+
57
+ // Return the smallest i such that i >= start and !get(i).
58
+ // Returns bits() if no such i exists.
59
+ size_t FirstUnset(size_t start) const;
60
+
61
+ // Returns the bitmap as an ascii string of '0' and '1' characters, bits()
62
+ // characters in length.
63
+ std::string ToString() const;
64
+
65
+ private:
66
+ typedef uint32_t Word;
67
+ static constexpr size_t kBits = 32;
68
+
69
+ // Return the number of words needed to store n bits.
70
+ static size_t NumWords(size_t n) { return (n + kBits - 1) / kBits; }
71
+
72
+ // Return the mask to use for the ith bit in a word.
73
+ static Word Mask(size_t i) { return 1ull << i; }
74
+
75
+ size_t nbits_; // Length of bitmap in bits.
76
+ Word* word_;
77
+ };
78
+
79
+ // Implementation details follow. Clients should ignore.
80
+
81
+ inline Bitmap::Bitmap() : nbits_(0), word_(nullptr) {}
82
+
83
+ inline Bitmap::Bitmap(size_t n) : Bitmap() { Reset(n); }
84
+
85
+ inline Bitmap::~Bitmap() { delete[] word_; }
86
+
87
+ inline size_t Bitmap::bits() const { return nbits_; }
88
+
89
+ inline bool Bitmap::get(size_t i) const {
90
+ DCHECK_LT(i, nbits_);
91
+ return word_[i / kBits] & Mask(i % kBits);
92
+ }
93
+
94
+ inline void Bitmap::set(size_t i) {
95
+ DCHECK_LT(i, nbits_);
96
+ word_[i / kBits] |= Mask(i % kBits);
97
+ }
98
+
99
+ inline void Bitmap::clear(size_t i) {
100
+ DCHECK_LT(i, nbits_);
101
+ word_[i / kBits] &= ~Mask(i % kBits);
102
+ }
103
+
104
+ } // namespace core
105
+ } // namespace tsl
106
+
107
+ #endif // TENSORFLOW_TSL_LIB_CORE_BITMAP_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/core/bits.h ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_CORE_BITS_H_
17
+ #define TENSORFLOW_TSL_LIB_CORE_BITS_H_
18
+
19
+ #include <cstdint>
20
+
21
+ #include "absl/numeric/bits.h"
22
+ #include "tsl/platform/logging.h"
23
+ #include "tsl/platform/types.h"
24
+
25
+ namespace tsl {
26
+
27
+ // Return floor(log2(n)) for positive integer n. Returns -1 iff n == 0.
28
+ int Log2Floor(uint32 n);
29
+ int Log2Floor64(uint64 n);
30
+
31
+ // Return ceiling(log2(n)) for positive integer n. Returns -1 iff n == 0.
32
+ int Log2Ceiling(uint32 n);
33
+ int Log2Ceiling64(uint64 n);
34
+
35
+ // ------------------------------------------------------------------------
36
+ // Implementation details follow
37
+ // ------------------------------------------------------------------------
38
+
39
+ #if defined(__GNUC__)
40
+
41
+ // Return floor(log2(n)) for positive integer n. Returns -1 iff n == 0.
42
+ inline int Log2Floor(uint32 n) { return n == 0 ? -1 : 31 ^ __builtin_clz(n); }
43
+
44
+ // Return floor(log2(n)) for positive integer n. Returns -1 iff n == 0.
45
+ inline int Log2Floor64(uint64 n) {
46
+ return n == 0 ? -1 : 63 ^ __builtin_clzll(n);
47
+ }
48
+
49
+ #else
50
+
51
+ // Return floor(log2(n)) for positive integer n. Returns -1 iff n == 0.
52
+ inline int Log2Floor(uint32 n) {
53
+ if (n == 0) return -1;
54
+ int log = 0;
55
+ uint32 value = n;
56
+ for (int i = 4; i >= 0; --i) {
57
+ int shift = (1 << i);
58
+ uint32 x = value >> shift;
59
+ if (x != 0) {
60
+ value = x;
61
+ log += shift;
62
+ }
63
+ }
64
+ assert(value == 1);
65
+ return log;
66
+ }
67
+
68
+ // Return floor(log2(n)) for positive integer n. Returns -1 iff n == 0.
69
+ // Log2Floor64() is defined in terms of Log2Floor32()
70
+ inline int Log2Floor64(uint64 n) {
71
+ const uint32 topbits = static_cast<uint32>(n >> 32);
72
+ if (topbits == 0) {
73
+ // Top bits are zero, so scan in bottom bits
74
+ return Log2Floor(static_cast<uint32>(n));
75
+ } else {
76
+ return 32 + Log2Floor(topbits);
77
+ }
78
+ }
79
+
80
+ #endif
81
+
82
+ inline int Log2Ceiling(uint32 n) {
83
+ int floor = Log2Floor(n);
84
+ if (n == (n & ~(n - 1))) // zero or a power of two
85
+ return floor;
86
+ else
87
+ return floor + 1;
88
+ }
89
+
90
+ inline int Log2Ceiling64(uint64 n) {
91
+ int floor = Log2Floor64(n);
92
+ if (n == (n & ~(n - 1))) // zero or a power of two
93
+ return floor;
94
+ else
95
+ return floor + 1;
96
+ }
97
+
98
+ inline uint32 NextPowerOfTwo(uint32 value) {
99
+ int exponent = Log2Ceiling(value);
100
+ DCHECK_LT(exponent, std::numeric_limits<uint32>::digits);
101
+ return 1 << exponent;
102
+ }
103
+
104
+ inline uint64 NextPowerOfTwo64(uint64 value) {
105
+ int exponent = Log2Ceiling(value);
106
+ DCHECK_LT(exponent, std::numeric_limits<uint64>::digits);
107
+ return 1LL << exponent;
108
+ }
109
+
110
+ inline int64_t NextPowerOfTwoS64(int64_t value) {
111
+ constexpr int64_t kMaxRepresentablePowerOfTwo =
112
+ static_cast<int64_t>(uint64_t{1} << 62);
113
+ DCHECK_GE(value, 0);
114
+ DCHECK_LE(value, kMaxRepresentablePowerOfTwo);
115
+ return static_cast<int64_t>(absl::bit_ceil(static_cast<uint64_t>(value)));
116
+ }
117
+
118
+ } // namespace tsl
119
+
120
+ #endif // TENSORFLOW_TSL_LIB_CORE_BITS_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/core/status_test_util.h ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_CORE_STATUS_TEST_UTIL_H_
17
+ #define TENSORFLOW_TSL_LIB_CORE_STATUS_TEST_UTIL_H_
18
+
19
+ #include "tsl/platform/status.h"
20
+ #include "tsl/platform/test.h"
21
+
22
+ // Macros for testing the results of functions that return tensorflow::Status.
23
+ #define TF_EXPECT_OK(statement) EXPECT_EQ(::tsl::OkStatus(), (statement))
24
+ #define TF_ASSERT_OK(statement) ASSERT_EQ(::tsl::OkStatus(), (statement))
25
+
26
+ // There are no EXPECT_NOT_OK/ASSERT_NOT_OK macros since they would not
27
+ // provide much value (when they fail, they would just print the OK status
28
+ // which conveys no more information than EXPECT_FALSE(status.ok());
29
+ // If you want to check for particular errors, a better alternative is with
30
+ // status matchers:
31
+ // EXPECT_THAT(s, tensorflow::testing::StatusIs(status.code(), "message"));
32
+
33
+ #endif // TENSORFLOW_TSL_LIB_CORE_STATUS_TEST_UTIL_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/gtl/flatmap.h ADDED
@@ -0,0 +1,396 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_GTL_FLATMAP_H_
17
+ #define TENSORFLOW_TSL_LIB_GTL_FLATMAP_H_
18
+
19
+ #include <stddef.h>
20
+
21
+ #include <functional>
22
+ #include <initializer_list>
23
+ #include <iterator>
24
+ #include <utility>
25
+
26
+ #include "tsl/lib/gtl/flatrep.h"
27
+ #include "tsl/platform/hash.h"
28
+ #include "tsl/platform/logging.h"
29
+ #include "tsl/platform/types.h"
30
+
31
+ namespace tsl {
32
+ namespace gtl {
33
+
34
+ // FlatMap<K,V,...> provides a map from K to V.
35
+ //
36
+ // The map is implemented using an open-addressed hash table. A
37
+ // single array holds entire map contents and collisions are resolved
38
+ // by probing at a sequence of locations in the array.
39
+ template <typename Key, typename Val, class Hash = hash<Key>,
40
+ class Eq = std::equal_to<Key>>
41
+ class FlatMap {
42
+ private:
43
+ // Forward declare some internal types needed in public section.
44
+ struct Bucket;
45
+
46
+ // We cannot use std::pair<> since internal representation stores
47
+ // keys and values in separate arrays, so we make a custom struct
48
+ // that holds references to the internal key, value elements.
49
+ //
50
+ // We define the struct as private ValueType, and typedef it as public
51
+ // value_type, to work around a gcc bug when compiling the iterators.
52
+ struct ValueType {
53
+ typedef Key first_type;
54
+ typedef Val second_type;
55
+
56
+ const Key& first;
57
+ Val& second;
58
+ ValueType(const Key& k, Val& v) : first(k), second(v) {}
59
+ };
60
+
61
+ public:
62
+ typedef Key key_type;
63
+ typedef Val mapped_type;
64
+ typedef Hash hasher;
65
+ typedef Eq key_equal;
66
+ typedef size_t size_type;
67
+ typedef ptrdiff_t difference_type;
68
+ typedef ValueType value_type;
69
+ typedef value_type* pointer;
70
+ typedef const value_type* const_pointer;
71
+ typedef value_type& reference;
72
+ typedef const value_type& const_reference;
73
+
74
+ FlatMap() : FlatMap(1) {}
75
+
76
+ explicit FlatMap(size_t N, const Hash& hf = Hash(), const Eq& eq = Eq())
77
+ : rep_(N, hf, eq) {}
78
+
79
+ FlatMap(const FlatMap& src) : rep_(src.rep_) {}
80
+
81
+ // Move constructor leaves src in a valid but unspecified state (same as
82
+ // std::unordered_map).
83
+ FlatMap(FlatMap&& src) : rep_(std::move(src.rep_)) {}
84
+
85
+ template <typename InputIter>
86
+ FlatMap(InputIter first, InputIter last, size_t N = 1,
87
+ const Hash& hf = Hash(), const Eq& eq = Eq())
88
+ : FlatMap(N, hf, eq) {
89
+ insert(first, last);
90
+ }
91
+
92
+ FlatMap(std::initializer_list<std::pair<const Key, Val>> init, size_t N = 1,
93
+ const Hash& hf = Hash(), const Eq& eq = Eq())
94
+ : FlatMap(init.begin(), init.end(), N, hf, eq) {}
95
+
96
+ FlatMap& operator=(const FlatMap& src) {
97
+ rep_.CopyFrom(src.rep_);
98
+ return *this;
99
+ }
100
+
101
+ // Move-assignment operator leaves src in a valid but unspecified state (same
102
+ // as std::unordered_map).
103
+ FlatMap& operator=(FlatMap&& src) {
104
+ rep_.MoveFrom(std::move(src.rep_));
105
+ return *this;
106
+ }
107
+
108
+ ~FlatMap() {}
109
+
110
+ void swap(FlatMap& x) { rep_.swap(x.rep_); }
111
+ void clear_no_resize() { rep_.clear_no_resize(); }
112
+ void clear() { rep_.clear(); }
113
+ void reserve(size_t N) { rep_.Resize(std::max(N, size())); }
114
+ void rehash(size_t N) { rep_.Resize(std::max(N, size())); }
115
+ void resize(size_t N) { rep_.Resize(std::max(N, size())); }
116
+ size_t size() const { return rep_.size(); }
117
+ bool empty() const { return size() == 0; }
118
+ size_t bucket_count() const { return rep_.bucket_count(); }
119
+ hasher hash_function() const { return rep_.hash_function(); }
120
+ key_equal key_eq() const { return rep_.key_eq(); }
121
+
122
+ class iterator {
123
+ public:
124
+ typedef typename FlatMap::difference_type difference_type;
125
+ typedef typename FlatMap::value_type value_type;
126
+ typedef typename FlatMap::pointer pointer;
127
+ typedef typename FlatMap::reference reference;
128
+ typedef ::std::forward_iterator_tag iterator_category;
129
+
130
+ iterator() : b_(nullptr), end_(nullptr), i_(0) {}
131
+
132
+ // Make iterator pointing at first element at or after b.
133
+ iterator(Bucket* b, Bucket* end) : b_(b), end_(end), i_(0) { SkipUnused(); }
134
+
135
+ // Make iterator pointing exactly at ith element in b, which must exist.
136
+ iterator(Bucket* b, Bucket* end, uint32 i) : b_(b), end_(end), i_(i) {
137
+ FillValue();
138
+ }
139
+
140
+ reference operator*() { return *val(); }
141
+ pointer operator->() { return val(); }
142
+ bool operator==(const iterator& x) const {
143
+ return b_ == x.b_ && i_ == x.i_;
144
+ }
145
+ bool operator!=(const iterator& x) const { return !(*this == x); }
146
+ iterator& operator++() {
147
+ DCHECK(b_ != end_);
148
+ i_++;
149
+ SkipUnused();
150
+ return *this;
151
+ }
152
+ iterator operator++(int /*indicates postfix*/) {
153
+ iterator tmp(*this);
154
+ ++*this;
155
+ return tmp;
156
+ }
157
+
158
+ private:
159
+ friend class FlatMap;
160
+ Bucket* b_;
161
+ Bucket* end_;
162
+ char space_ alignas(value_type)[sizeof(value_type)];
163
+ uint32 i_;
164
+
165
+ pointer val() { return reinterpret_cast<pointer>(space_); }
166
+ void FillValue() { new (space_) value_type(b_->key(i_), b_->val(i_)); }
167
+ void SkipUnused() {
168
+ while (b_ < end_) {
169
+ if (i_ >= Rep::kWidth) {
170
+ i_ = 0;
171
+ b_++;
172
+ } else if (b_->marker[i_] < 2) {
173
+ i_++;
174
+ } else {
175
+ FillValue();
176
+ break;
177
+ }
178
+ }
179
+ }
180
+ };
181
+
182
+ class const_iterator {
183
+ private:
184
+ mutable iterator rep_; // Share state and logic with non-const iterator.
185
+
186
+ public:
187
+ typedef typename FlatMap::difference_type difference_type;
188
+ typedef typename FlatMap::value_type value_type;
189
+ typedef typename FlatMap::const_pointer pointer;
190
+ typedef typename FlatMap::const_reference reference;
191
+ typedef ::std::forward_iterator_tag iterator_category;
192
+
193
+ const_iterator() : rep_() {}
194
+ const_iterator(Bucket* start, Bucket* end) : rep_(start, end) {}
195
+ const_iterator(Bucket* b, Bucket* end, uint32 i) : rep_(b, end, i) {}
196
+
197
+ reference operator*() const { return *rep_.val(); }
198
+ pointer operator->() const { return rep_.val(); }
199
+ bool operator==(const const_iterator& x) const { return rep_ == x.rep_; }
200
+ bool operator!=(const const_iterator& x) const { return rep_ != x.rep_; }
201
+ const_iterator& operator++() {
202
+ ++rep_;
203
+ return *this;
204
+ }
205
+ const_iterator operator++(int /*indicates postfix*/) {
206
+ const_iterator tmp(*this);
207
+ ++*this;
208
+ return tmp;
209
+ }
210
+ };
211
+
212
+ iterator begin() { return iterator(rep_.start(), rep_.limit()); }
213
+ iterator end() { return iterator(rep_.limit(), rep_.limit()); }
214
+ const_iterator begin() const {
215
+ return const_iterator(rep_.start(), rep_.limit());
216
+ }
217
+ const_iterator end() const {
218
+ return const_iterator(rep_.limit(), rep_.limit());
219
+ }
220
+
221
+ size_t count(const Key& k) const { return rep_.Find(k).found ? 1 : 0; }
222
+ iterator find(const Key& k) {
223
+ auto r = rep_.Find(k);
224
+ return r.found ? iterator(r.b, rep_.limit(), r.index) : end();
225
+ }
226
+ const_iterator find(const Key& k) const {
227
+ auto r = rep_.Find(k);
228
+ return r.found ? const_iterator(r.b, rep_.limit(), r.index) : end();
229
+ }
230
+
231
+ Val& at(const Key& k) {
232
+ auto r = rep_.Find(k);
233
+ DCHECK(r.found);
234
+ return r.b->val(r.index);
235
+ }
236
+ const Val& at(const Key& k) const {
237
+ auto r = rep_.Find(k);
238
+ DCHECK(r.found);
239
+ return r.b->val(r.index);
240
+ }
241
+
242
+ template <typename P>
243
+ std::pair<iterator, bool> insert(const P& p) {
244
+ return Insert(p.first, p.second);
245
+ }
246
+ std::pair<iterator, bool> insert(const std::pair<const Key, Val>& p) {
247
+ return Insert(p.first, p.second);
248
+ }
249
+ template <typename InputIter>
250
+ void insert(InputIter first, InputIter last) {
251
+ for (; first != last; ++first) {
252
+ insert(*first);
253
+ }
254
+ }
255
+
256
+ Val& operator[](const Key& k) { return IndexOp(k); }
257
+ Val& operator[](Key&& k) { return IndexOp(std::forward<Key>(k)); }
258
+
259
+ template <typename... Args>
260
+ std::pair<iterator, bool> emplace(Args&&... args) {
261
+ return InsertPair(std::make_pair(std::forward<Args>(args)...));
262
+ }
263
+
264
+ size_t erase(const Key& k) {
265
+ auto r = rep_.Find(k);
266
+ if (!r.found) return 0;
267
+ rep_.Erase(r.b, r.index);
268
+ return 1;
269
+ }
270
+ iterator erase(iterator pos) {
271
+ rep_.Erase(pos.b_, pos.i_);
272
+ ++pos;
273
+ return pos;
274
+ }
275
+ iterator erase(iterator pos, iterator last) {
276
+ for (; pos != last; ++pos) {
277
+ rep_.Erase(pos.b_, pos.i_);
278
+ }
279
+ return pos;
280
+ }
281
+
282
+ std::pair<iterator, iterator> equal_range(const Key& k) {
283
+ auto pos = find(k);
284
+ if (pos == end()) {
285
+ return std::make_pair(pos, pos);
286
+ } else {
287
+ auto next = pos;
288
+ ++next;
289
+ return std::make_pair(pos, next);
290
+ }
291
+ }
292
+ std::pair<const_iterator, const_iterator> equal_range(const Key& k) const {
293
+ auto pos = find(k);
294
+ if (pos == end()) {
295
+ return std::make_pair(pos, pos);
296
+ } else {
297
+ auto next = pos;
298
+ ++next;
299
+ return std::make_pair(pos, next);
300
+ }
301
+ }
302
+
303
+ bool operator==(const FlatMap& x) const {
304
+ if (size() != x.size()) return false;
305
+ for (auto& p : x) {
306
+ auto i = find(p.first);
307
+ if (i == end()) return false;
308
+ if (i->second != p.second) return false;
309
+ }
310
+ return true;
311
+ }
312
+ bool operator!=(const FlatMap& x) const { return !(*this == x); }
313
+
314
+ // If key exists in the table, prefetch the associated value. This
315
+ // is a hint, and may have no effect.
316
+ void prefetch_value(const Key& key) const { rep_.Prefetch(key); }
317
+
318
+ private:
319
+ using Rep = internal::FlatRep<Key, Bucket, Hash, Eq>;
320
+
321
+ // Bucket stores kWidth <marker, key, value> triples.
322
+ // The data is organized as three parallel arrays to reduce padding.
323
+ struct Bucket {
324
+ uint8 marker[Rep::kWidth];
325
+
326
+ // Wrap keys and values in union to control construction and destruction.
327
+ union Storage {
328
+ struct {
329
+ Key key[Rep::kWidth];
330
+ Val val[Rep::kWidth];
331
+ };
332
+ Storage() {}
333
+ ~Storage() {}
334
+ } storage;
335
+
336
+ Key& key(uint32 i) {
337
+ DCHECK_GE(marker[i], 2);
338
+ return storage.key[i];
339
+ }
340
+ Val& val(uint32 i) {
341
+ DCHECK_GE(marker[i], 2);
342
+ return storage.val[i];
343
+ }
344
+ template <typename V>
345
+ void InitVal(uint32 i, V&& v) {
346
+ new (&storage.val[i]) Val(std::forward<V>(v));
347
+ }
348
+ void Destroy(uint32 i) {
349
+ storage.key[i].Key::~Key();
350
+ storage.val[i].Val::~Val();
351
+ }
352
+ void MoveFrom(uint32 i, Bucket* src, uint32 src_index) {
353
+ new (&storage.key[i]) Key(std::move(src->storage.key[src_index]));
354
+ new (&storage.val[i]) Val(std::move(src->storage.val[src_index]));
355
+ }
356
+ void CopyFrom(uint32 i, Bucket* src, uint32 src_index) {
357
+ new (&storage.key[i]) Key(src->storage.key[src_index]);
358
+ new (&storage.val[i]) Val(src->storage.val[src_index]);
359
+ }
360
+ };
361
+
362
+ template <typename Pair>
363
+ std::pair<iterator, bool> InsertPair(Pair&& p) {
364
+ return Insert(std::forward<decltype(p.first)>(p.first),
365
+ std::forward<decltype(p.second)>(p.second));
366
+ }
367
+
368
+ template <typename K, typename V>
369
+ std::pair<iterator, bool> Insert(K&& k, V&& v) {
370
+ rep_.MaybeResize();
371
+ auto r = rep_.FindOrInsert(std::forward<K>(k));
372
+ const bool inserted = !r.found;
373
+ if (inserted) {
374
+ r.b->InitVal(r.index, std::forward<V>(v));
375
+ }
376
+ return {iterator(r.b, rep_.limit(), r.index), inserted};
377
+ }
378
+
379
+ template <typename K>
380
+ Val& IndexOp(K&& k) {
381
+ rep_.MaybeResize();
382
+ auto r = rep_.FindOrInsert(std::forward<K>(k));
383
+ Val* vptr = &r.b->val(r.index);
384
+ if (!r.found) {
385
+ new (vptr) Val(); // Initialize value in new slot.
386
+ }
387
+ return *vptr;
388
+ }
389
+
390
+ Rep rep_;
391
+ };
392
+
393
+ } // namespace gtl
394
+ } // namespace tsl
395
+
396
+ #endif // TENSORFLOW_TSL_LIB_GTL_FLATMAP_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/gtl/flatrep.h ADDED
@@ -0,0 +1,352 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_GTL_FLATREP_H_
17
+ #define TENSORFLOW_TSL_LIB_GTL_FLATREP_H_
18
+
19
+ #include <string.h>
20
+
21
+ #include <utility>
22
+
23
+ #include "absl/base/prefetch.h"
24
+ #include "tsl/platform/types.h"
25
+
26
+ namespace tsl {
27
+ namespace gtl {
28
+ namespace internal {
29
+
30
+ // Internal representation for FlatMap and FlatSet.
31
+ //
32
+ // The representation is an open-addressed hash table. Conceptually,
33
+ // the representation is a flat array of entries. However we
34
+ // structure it as an array of buckets where each bucket holds
35
+ // kWidth entries along with metadata for the kWidth entries. The
36
+ // metadata marker is
37
+ //
38
+ // (a) kEmpty: the entry is empty
39
+ // (b) kDeleted: the entry has been deleted
40
+ // (c) other: the entry is occupied and has low-8 bits of its hash.
41
+ // These hash bits can be used to avoid potentially expensive
42
+ // key comparisons.
43
+ //
44
+ // FlatMap passes in a bucket that contains keys and values, FlatSet
45
+ // passes in a bucket that does not contain values.
46
+ template <typename Key, typename Bucket, class Hash, class Eq>
47
+ class FlatRep {
48
+ public:
49
+ // kWidth is the number of entries stored in a bucket.
50
+ static constexpr uint32 kBase = 3;
51
+ static constexpr uint32 kWidth = (1 << kBase);
52
+
53
+ FlatRep(size_t N, const Hash& hf, const Eq& eq) : hash_(hf), equal_(eq) {
54
+ Init(N);
55
+ }
56
+ FlatRep(const FlatRep& src) : hash_(src.hash_), equal_(src.equal_) {
57
+ Init(src.size());
58
+ CopyEntries(src.array_, src.end_, CopyEntry());
59
+ }
60
+
61
+ FlatRep(FlatRep&& src)
62
+ // Copy rather than move src.hash_ and src.equal_. This is necessary to
63
+ // leave src in a valid state -- otherwise e.g. if hash_ is an
64
+ // std::function, moving it would null it out.
65
+ : hash_(src.hash_), equal_(src.equal_) {
66
+ // TODO(jlebar): Init(1) still allocates some memory, so this isn't as cheap
67
+ // as it could be. The fundamental problem is that we need to leave src in
68
+ // a valid state, and FlatRep *always* owns a nonzero amount of memory.
69
+ Init(1);
70
+ swap(src);
71
+ }
72
+
73
+ ~FlatRep() {
74
+ clear_no_resize();
75
+ delete[] array_;
76
+ }
77
+
78
+ // Simple accessors.
79
+ size_t size() const { return not_empty_ - deleted_; }
80
+ size_t bucket_count() const { return mask_ + 1; }
81
+ Bucket* start() const { return array_; }
82
+ Bucket* limit() const { return end_; }
83
+ const Hash& hash_function() const { return hash_; }
84
+ const Eq& key_eq() const { return equal_; }
85
+
86
+ // Overwrite contents of *this with contents of src.
87
+ void CopyFrom(const FlatRep& src) {
88
+ if (this != &src) {
89
+ clear_no_resize();
90
+ delete[] array_;
91
+ Init(src.size());
92
+ CopyEntries(src.array_, src.end_, CopyEntry());
93
+ }
94
+ }
95
+
96
+ void MoveFrom(FlatRep&& src) {
97
+ if (this != &src) {
98
+ swap(src);
99
+ }
100
+ }
101
+
102
+ void clear_no_resize() {
103
+ for (Bucket* b = array_; b != end_; b++) {
104
+ for (uint32 i = 0; i < kWidth; i++) {
105
+ if (b->marker[i] >= 2) {
106
+ b->Destroy(i);
107
+ b->marker[i] = kEmpty;
108
+ }
109
+ }
110
+ }
111
+ not_empty_ = 0;
112
+ deleted_ = 0;
113
+ }
114
+
115
+ void clear() {
116
+ clear_no_resize();
117
+ grow_ = 0; // Consider shrinking in MaybeResize()
118
+ MaybeResize();
119
+ }
120
+
121
+ void swap(FlatRep& x) {
122
+ using std::swap;
123
+ swap(array_, x.array_);
124
+ swap(end_, x.end_);
125
+ swap(lglen_, x.lglen_);
126
+ swap(mask_, x.mask_);
127
+ swap(not_empty_, x.not_empty_);
128
+ swap(deleted_, x.deleted_);
129
+ swap(grow_, x.grow_);
130
+ swap(shrink_, x.shrink_);
131
+ }
132
+
133
+ struct SearchResult {
134
+ bool found;
135
+ Bucket* b;
136
+ uint32 index;
137
+ };
138
+
139
+ // Hash value is partitioned as follows:
140
+ // 1. Bottom 8 bits are stored in bucket to help speed up comparisons.
141
+ // 2. Next 3 bits give index inside bucket.
142
+ // 3. Remaining bits give bucket number.
143
+
144
+ // Find bucket/index for key k.
145
+ SearchResult Find(const Key& k) const {
146
+ size_t h = hash_(k);
147
+ const uint32 marker = Marker(h & 0xff);
148
+ size_t index = (h >> 8) & mask_; // Holds bucket num and index-in-bucket
149
+ uint32 num_probes = 1; // Needed for quadratic probing
150
+ while (true) {
151
+ uint32 bi = index & (kWidth - 1);
152
+ Bucket* b = &array_[index >> kBase];
153
+ const uint32 x = b->marker[bi];
154
+ if (x == marker && equal_(b->key(bi), k)) {
155
+ return {true, b, bi};
156
+ } else if (x == kEmpty) {
157
+ return {false, nullptr, 0};
158
+ }
159
+ index = NextIndex(index, num_probes);
160
+ num_probes++;
161
+ }
162
+ }
163
+
164
+ // Find bucket/index for key k, creating a new one if necessary.
165
+ //
166
+ // KeyType is a template parameter so that k's type is deduced and it
167
+ // becomes a universal reference which allows the key initialization
168
+ // below to use an rvalue constructor if available.
169
+ template <typename KeyType>
170
+ SearchResult FindOrInsert(KeyType&& k) {
171
+ size_t h = hash_(k);
172
+ const uint32 marker = Marker(h & 0xff);
173
+ size_t index = (h >> 8) & mask_; // Holds bucket num and index-in-bucket
174
+ uint32 num_probes = 1; // Needed for quadratic probing
175
+ Bucket* del = nullptr; // First encountered deletion for kInsert
176
+ uint32 di = 0;
177
+ while (true) {
178
+ uint32 bi = index & (kWidth - 1);
179
+ Bucket* b = &array_[index >> kBase];
180
+ const uint32 x = b->marker[bi];
181
+ if (x == marker && equal_(b->key(bi), k)) {
182
+ return {true, b, bi};
183
+ } else if (!del && x == kDeleted) {
184
+ // Remember deleted index to use for insertion.
185
+ del = b;
186
+ di = bi;
187
+ } else if (x == kEmpty) {
188
+ if (del) {
189
+ // Store in the first deleted slot we encountered
190
+ b = del;
191
+ bi = di;
192
+ deleted_--; // not_empty_ does not change
193
+ } else {
194
+ not_empty_++;
195
+ }
196
+ b->marker[bi] = marker;
197
+ new (&b->key(bi)) Key(std::forward<KeyType>(k));
198
+ return {false, b, bi};
199
+ }
200
+ index = NextIndex(index, num_probes);
201
+ num_probes++;
202
+ }
203
+ }
204
+
205
+ void Erase(Bucket* b, uint32 i) {
206
+ b->Destroy(i);
207
+ b->marker[i] = kDeleted;
208
+ deleted_++;
209
+ grow_ = 0; // Consider shrinking on next insert
210
+ }
211
+
212
+ void Prefetch(const Key& k) const {
213
+ size_t h = hash_(k);
214
+ size_t index = (h >> 8) & mask_; // Holds bucket num and index-in-bucket
215
+ uint32 bi = index & (kWidth - 1);
216
+ Bucket* b = &array_[index >> kBase];
217
+ absl::PrefetchToLocalCache(&b->marker[bi]);
218
+ absl::PrefetchToLocalCache(&b->storage.key[bi]);
219
+ }
220
+
221
+ inline void MaybeResize() {
222
+ if (not_empty_ < grow_) {
223
+ return; // Nothing to do
224
+ }
225
+ if (grow_ == 0) {
226
+ // Special value set by erase to cause shrink on next insert.
227
+ if (size() >= shrink_) {
228
+ // Not small enough to shrink.
229
+ grow_ = static_cast<size_t>(bucket_count() * 0.8);
230
+ if (not_empty_ < grow_) return;
231
+ }
232
+ }
233
+ Resize(size() + 1);
234
+ }
235
+
236
+ void Resize(size_t N) {
237
+ Bucket* old = array_;
238
+ Bucket* old_end = end_;
239
+ Init(N);
240
+ CopyEntries(old, old_end, MoveEntry());
241
+ delete[] old;
242
+ }
243
+
244
+ private:
245
+ enum { kEmpty = 0, kDeleted = 1 }; // Special markers for an entry.
246
+
247
+ Hash hash_; // User-supplied hasher
248
+ Eq equal_; // User-supplied comparator
249
+ uint8 lglen_; // lg(#buckets)
250
+ Bucket* array_; // array of length (1 << lglen_)
251
+ Bucket* end_; // Points just past last bucket in array_
252
+ size_t mask_; // (# of entries in table) - 1
253
+ size_t not_empty_; // Count of entries with marker != kEmpty
254
+ size_t deleted_; // Count of entries with marker == kDeleted
255
+ size_t grow_; // Grow array when not_empty_ >= grow_
256
+ size_t shrink_; // Shrink array when size() < shrink_
257
+
258
+ // Avoid kEmpty and kDeleted markers when computing hash values to
259
+ // store in Bucket::marker[].
260
+ static uint32 Marker(uint32 hb) { return hb + (hb < 2 ? 2 : 0); }
261
+
262
+ void Init(size_t N) {
263
+ // Make enough room for N elements.
264
+ size_t lg = 0; // Smallest table is just one bucket.
265
+ while (N >= 0.8 * ((1 << lg) * kWidth)) {
266
+ lg++;
267
+ }
268
+ const size_t n = (1 << lg);
269
+ Bucket* array = new Bucket[n];
270
+ for (size_t i = 0; i < n; i++) {
271
+ Bucket* b = &array[i];
272
+ memset(b->marker, kEmpty, kWidth);
273
+ }
274
+ const size_t capacity = (1 << lg) * kWidth;
275
+ lglen_ = lg;
276
+ mask_ = capacity - 1;
277
+ array_ = array;
278
+ end_ = array + n;
279
+ not_empty_ = 0;
280
+ deleted_ = 0;
281
+ grow_ = static_cast<size_t>(capacity * 0.8);
282
+ if (lg == 0) {
283
+ // Already down to one bucket; no more shrinking.
284
+ shrink_ = 0;
285
+ } else {
286
+ shrink_ = static_cast<size_t>(grow_ * 0.4); // Must be less than 0.5
287
+ }
288
+ }
289
+
290
+ // Used by FreshInsert when we should copy from source.
291
+ struct CopyEntry {
292
+ inline void operator()(Bucket* dst, uint32 dsti, Bucket* src, uint32 srci) {
293
+ dst->CopyFrom(dsti, src, srci);
294
+ }
295
+ };
296
+
297
+ // Used by FreshInsert when we should move from source.
298
+ struct MoveEntry {
299
+ inline void operator()(Bucket* dst, uint32 dsti, Bucket* src, uint32 srci) {
300
+ dst->MoveFrom(dsti, src, srci);
301
+ src->Destroy(srci);
302
+ src->marker[srci] = kDeleted;
303
+ }
304
+ };
305
+
306
+ template <typename Copier>
307
+ void CopyEntries(Bucket* start, Bucket* end, Copier copier) {
308
+ for (Bucket* b = start; b != end; b++) {
309
+ for (uint32 i = 0; i < kWidth; i++) {
310
+ if (b->marker[i] >= 2) {
311
+ FreshInsert(b, i, copier);
312
+ }
313
+ }
314
+ }
315
+ }
316
+
317
+ // Create an entry for the key numbered src_index in *src and return
318
+ // its bucket/index. Used for insertion into a fresh table. We
319
+ // assume that there are no deletions, and k does not already exist
320
+ // in the table.
321
+ template <typename Copier>
322
+ void FreshInsert(Bucket* src, uint32 src_index, Copier copier) {
323
+ size_t h = hash_(src->key(src_index));
324
+ const uint32 marker = Marker(h & 0xff);
325
+ size_t index = (h >> 8) & mask_; // Holds bucket num and index-in-bucket
326
+ uint32 num_probes = 1; // Needed for quadratic probing
327
+ while (true) {
328
+ uint32 bi = index & (kWidth - 1);
329
+ Bucket* b = &array_[index >> kBase];
330
+ const uint32 x = b->marker[bi];
331
+ if (x == 0) {
332
+ b->marker[bi] = marker;
333
+ not_empty_++;
334
+ copier(b, bi, src, src_index);
335
+ return;
336
+ }
337
+ index = NextIndex(index, num_probes);
338
+ num_probes++;
339
+ }
340
+ }
341
+
342
+ inline size_t NextIndex(size_t i, uint32 num_probes) const {
343
+ // Quadratic probing.
344
+ return (i + num_probes) & mask_;
345
+ }
346
+ };
347
+
348
+ } // namespace internal
349
+ } // namespace gtl
350
+ } // namespace tsl
351
+
352
+ #endif // TENSORFLOW_TSL_LIB_GTL_FLATREP_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/gtl/flatset.h ADDED
@@ -0,0 +1,296 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_GTL_FLATSET_H_
17
+ #define TENSORFLOW_TSL_LIB_GTL_FLATSET_H_
18
+
19
+ #include <stddef.h>
20
+
21
+ #include <functional>
22
+ #include <initializer_list>
23
+ #include <iterator>
24
+ #include <utility>
25
+
26
+ #include "tsl/lib/gtl/flatrep.h"
27
+ #include "tsl/platform/hash.h"
28
+ #include "tsl/platform/logging.h"
29
+ #include "tsl/platform/types.h"
30
+
31
+ namespace tsl {
32
+ namespace gtl {
33
+
34
+ // FlatSet<K,...> provides a set of K.
35
+ //
36
+ // The map is implemented using an open-addressed hash table. A
37
+ // single array holds entire map contents and collisions are resolved
38
+ // by probing at a sequence of locations in the array.
39
+ template <typename Key, class Hash = hash<Key>, class Eq = std::equal_to<Key>>
40
+ class FlatSet {
41
+ private:
42
+ // Forward declare some internal types needed in public section.
43
+ struct Bucket;
44
+
45
+ public:
46
+ typedef Key key_type;
47
+ typedef Key value_type;
48
+ typedef Hash hasher;
49
+ typedef Eq key_equal;
50
+ typedef size_t size_type;
51
+ typedef ptrdiff_t difference_type;
52
+ typedef value_type* pointer;
53
+ typedef const value_type* const_pointer;
54
+ typedef value_type& reference;
55
+ typedef const value_type& const_reference;
56
+
57
+ FlatSet() : FlatSet(1) {}
58
+
59
+ explicit FlatSet(size_t N, const Hash& hf = Hash(), const Eq& eq = Eq())
60
+ : rep_(N, hf, eq) {}
61
+
62
+ FlatSet(const FlatSet& src) : rep_(src.rep_) {}
63
+
64
+ // Move constructor leaves src in a valid but unspecified state (same as
65
+ // std::unordered_set).
66
+ FlatSet(FlatSet&& src) : rep_(std::move(src.rep_)) {}
67
+
68
+ template <typename InputIter>
69
+ FlatSet(InputIter first, InputIter last, size_t N = 1,
70
+ const Hash& hf = Hash(), const Eq& eq = Eq())
71
+ : FlatSet(N, hf, eq) {
72
+ insert(first, last);
73
+ }
74
+
75
+ FlatSet(std::initializer_list<value_type> init, size_t N = 1,
76
+ const Hash& hf = Hash(), const Eq& eq = Eq())
77
+ : FlatSet(init.begin(), init.end(), N, hf, eq) {}
78
+
79
+ FlatSet& operator=(const FlatSet& src) {
80
+ rep_.CopyFrom(src.rep_);
81
+ return *this;
82
+ }
83
+
84
+ // Move-assignment operator leaves src in a valid but unspecified state (same
85
+ // as std::unordered_set).
86
+ FlatSet& operator=(FlatSet&& src) {
87
+ rep_.MoveFrom(std::move(src.rep_));
88
+ return *this;
89
+ }
90
+
91
+ ~FlatSet() {}
92
+
93
+ void swap(FlatSet& x) { rep_.swap(x.rep_); }
94
+ void clear_no_resize() { rep_.clear_no_resize(); }
95
+ void clear() { rep_.clear(); }
96
+ void reserve(size_t N) { rep_.Resize(std::max(N, size())); }
97
+ void rehash(size_t N) { rep_.Resize(std::max(N, size())); }
98
+ void resize(size_t N) { rep_.Resize(std::max(N, size())); }
99
+ size_t size() const { return rep_.size(); }
100
+ bool empty() const { return size() == 0; }
101
+ size_t bucket_count() const { return rep_.bucket_count(); }
102
+ hasher hash_function() const { return rep_.hash_function(); }
103
+ key_equal key_eq() const { return rep_.key_eq(); }
104
+
105
+ class const_iterator {
106
+ public:
107
+ typedef typename FlatSet::difference_type difference_type;
108
+ typedef typename FlatSet::value_type value_type;
109
+ typedef typename FlatSet::const_pointer pointer;
110
+ typedef typename FlatSet::const_reference reference;
111
+ typedef ::std::forward_iterator_tag iterator_category;
112
+
113
+ const_iterator() : b_(nullptr), end_(nullptr), i_(0) {}
114
+
115
+ // Make iterator pointing at first element at or after b.
116
+ const_iterator(Bucket* b, Bucket* end) : b_(b), end_(end), i_(0) {
117
+ SkipUnused();
118
+ }
119
+
120
+ // Make iterator pointing exactly at ith element in b, which must exist.
121
+ const_iterator(Bucket* b, Bucket* end, uint32 i)
122
+ : b_(b), end_(end), i_(i) {}
123
+
124
+ reference operator*() const { return key(); }
125
+ pointer operator->() const { return &key(); }
126
+ bool operator==(const const_iterator& x) const {
127
+ return b_ == x.b_ && i_ == x.i_;
128
+ }
129
+ bool operator!=(const const_iterator& x) const { return !(*this == x); }
130
+ const_iterator& operator++() {
131
+ DCHECK(b_ != end_);
132
+ i_++;
133
+ SkipUnused();
134
+ return *this;
135
+ }
136
+ const_iterator operator++(int /*indicates postfix*/) {
137
+ const_iterator tmp(*this);
138
+ ++*this;
139
+ return tmp;
140
+ }
141
+
142
+ private:
143
+ friend class FlatSet;
144
+ Bucket* b_;
145
+ Bucket* end_;
146
+ uint32 i_;
147
+
148
+ reference key() const { return b_->key(i_); }
149
+ void SkipUnused() {
150
+ while (b_ < end_) {
151
+ if (i_ >= Rep::kWidth) {
152
+ i_ = 0;
153
+ b_++;
154
+ } else if (b_->marker[i_] < 2) {
155
+ i_++;
156
+ } else {
157
+ break;
158
+ }
159
+ }
160
+ }
161
+ };
162
+
163
+ typedef const_iterator iterator;
164
+
165
+ iterator begin() { return iterator(rep_.start(), rep_.limit()); }
166
+ iterator end() { return iterator(rep_.limit(), rep_.limit()); }
167
+ const_iterator begin() const {
168
+ return const_iterator(rep_.start(), rep_.limit());
169
+ }
170
+ const_iterator end() const {
171
+ return const_iterator(rep_.limit(), rep_.limit());
172
+ }
173
+
174
+ size_t count(const Key& k) const { return rep_.Find(k).found ? 1 : 0; }
175
+ iterator find(const Key& k) {
176
+ auto r = rep_.Find(k);
177
+ return r.found ? iterator(r.b, rep_.limit(), r.index) : end();
178
+ }
179
+ const_iterator find(const Key& k) const {
180
+ auto r = rep_.Find(k);
181
+ return r.found ? const_iterator(r.b, rep_.limit(), r.index) : end();
182
+ }
183
+
184
+ std::pair<iterator, bool> insert(const Key& k) { return Insert(k); }
185
+ std::pair<iterator, bool> insert(Key&& k) { return Insert(std::move(k)); }
186
+ template <typename InputIter>
187
+ void insert(InputIter first, InputIter last) {
188
+ for (; first != last; ++first) {
189
+ insert(*first);
190
+ }
191
+ }
192
+
193
+ template <typename... Args>
194
+ std::pair<iterator, bool> emplace(Args&&... args) {
195
+ rep_.MaybeResize();
196
+ auto r = rep_.FindOrInsert(std::forward<Args>(args)...);
197
+ const bool inserted = !r.found;
198
+ return {iterator(r.b, rep_.limit(), r.index), inserted};
199
+ }
200
+
201
+ size_t erase(const Key& k) {
202
+ auto r = rep_.Find(k);
203
+ if (!r.found) return 0;
204
+ rep_.Erase(r.b, r.index);
205
+ return 1;
206
+ }
207
+ iterator erase(iterator pos) {
208
+ rep_.Erase(pos.b_, pos.i_);
209
+ ++pos;
210
+ return pos;
211
+ }
212
+ iterator erase(iterator pos, iterator last) {
213
+ for (; pos != last; ++pos) {
214
+ rep_.Erase(pos.b_, pos.i_);
215
+ }
216
+ return pos;
217
+ }
218
+
219
+ std::pair<iterator, iterator> equal_range(const Key& k) {
220
+ auto pos = find(k);
221
+ if (pos == end()) {
222
+ return std::make_pair(pos, pos);
223
+ } else {
224
+ auto next = pos;
225
+ ++next;
226
+ return std::make_pair(pos, next);
227
+ }
228
+ }
229
+ std::pair<const_iterator, const_iterator> equal_range(const Key& k) const {
230
+ auto pos = find(k);
231
+ if (pos == end()) {
232
+ return std::make_pair(pos, pos);
233
+ } else {
234
+ auto next = pos;
235
+ ++next;
236
+ return std::make_pair(pos, next);
237
+ }
238
+ }
239
+
240
+ bool operator==(const FlatSet& x) const {
241
+ if (size() != x.size()) return false;
242
+ for (const auto& elem : x) {
243
+ auto i = find(elem);
244
+ if (i == end()) return false;
245
+ }
246
+ return true;
247
+ }
248
+ bool operator!=(const FlatSet& x) const { return !(*this == x); }
249
+
250
+ // If key exists in the table, prefetch it. This is a hint, and may
251
+ // have no effect.
252
+ void prefetch_value(const Key& key) const { rep_.Prefetch(key); }
253
+
254
+ private:
255
+ using Rep = internal::FlatRep<Key, Bucket, Hash, Eq>;
256
+
257
+ // Bucket stores kWidth <marker, key, value> triples.
258
+ // The data is organized as three parallel arrays to reduce padding.
259
+ struct Bucket {
260
+ uint8 marker[Rep::kWidth];
261
+
262
+ // Wrap keys in union to control construction and destruction.
263
+ union Storage {
264
+ Key key[Rep::kWidth];
265
+ Storage() {}
266
+ ~Storage() {}
267
+ } storage;
268
+
269
+ Key& key(uint32 i) {
270
+ DCHECK_GE(marker[i], 2);
271
+ return storage.key[i];
272
+ }
273
+ void Destroy(uint32 i) { storage.key[i].Key::~Key(); }
274
+ void MoveFrom(uint32 i, Bucket* src, uint32 src_index) {
275
+ new (&storage.key[i]) Key(std::move(src->storage.key[src_index]));
276
+ }
277
+ void CopyFrom(uint32 i, Bucket* src, uint32 src_index) {
278
+ new (&storage.key[i]) Key(src->storage.key[src_index]);
279
+ }
280
+ };
281
+
282
+ template <typename K>
283
+ std::pair<iterator, bool> Insert(K&& k) {
284
+ rep_.MaybeResize();
285
+ auto r = rep_.FindOrInsert(std::forward<K>(k));
286
+ const bool inserted = !r.found;
287
+ return {iterator(r.b, rep_.limit(), r.index), inserted};
288
+ }
289
+
290
+ Rep rep_;
291
+ };
292
+
293
+ } // namespace gtl
294
+ } // namespace tsl
295
+
296
+ #endif // TENSORFLOW_TSL_LIB_GTL_FLATSET_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/gtl/inlined_vector.h ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_GTL_INLINED_VECTOR_H_
17
+ #define TENSORFLOW_TSL_LIB_GTL_INLINED_VECTOR_H_
18
+
19
+ #include "absl/container/inlined_vector.h" // IWYU pragma: export
20
+ // TODO(kramerb): This is kept only because lots of targets transitively depend
21
+ // on it. Remove all targets' dependencies.
22
+ #include "tsl/platform/macros.h"
23
+ #include "tsl/platform/types.h"
24
+
25
+ namespace tsl {
26
+ namespace gtl {
27
+
28
+ using absl::InlinedVector;
29
+
30
+ } // namespace gtl
31
+ } // namespace tsl
32
+
33
+ #endif // TENSORFLOW_TSL_LIB_GTL_INLINED_VECTOR_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/gtl/int_type.h ADDED
@@ -0,0 +1,364 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ // #status: LEGACY
17
+ // #category: Miscellaneous
18
+ // #summary: Integral types; prefer util/intops/strong_int.h
19
+ // #bugs: Infrastructure > C++ Library Team > util
20
+ //
21
+ // IntType is a simple template class mechanism for defining "logical"
22
+ // integer-like class types that support many of the same functionalities
23
+ // as native integer types, but which prevent assignment, construction, and
24
+ // other operations from other similar integer-like types. Essentially, the
25
+ // template class IntType<IntTypeName, ValueType> (where ValueType assumes
26
+ // valid scalar types such as int, uint, int32, etc) has the additional
27
+ // property that it cannot be assigned to or constructed from other IntTypes
28
+ // or native integer types of equal or implicitly convertible type.
29
+ //
30
+ // The class is useful for preventing mingling of integer variables with
31
+ // different logical roles or units. Unfortunately, C++ provides relatively
32
+ // good type-safety for user-defined classes but not for integer types. It is
33
+ // essentially up to the user to use nice variable names and comments to prevent
34
+ // accidental mismatches, such as confusing a user-index with a group-index or a
35
+ // time-in-milliseconds with a time-in-seconds. The use of typedefs are limited
36
+ // in that regard as they do not enforce type-safety.
37
+ //
38
+ // USAGE -----------------------------------------------------------------------
39
+ //
40
+ // DEFINE_INT_TYPE(IntTypeName, ValueType);
41
+ //
42
+ // where:
43
+ // IntTypeName: is the desired (unique) name for the "logical" integer type.
44
+ // ValueType: is one of the integral types as defined by base::is_integral
45
+ // (see base/type_traits.h).
46
+ //
47
+ // DISALLOWED OPERATIONS / TYPE-SAFETY ENFORCEMENT -----------------------------
48
+ //
49
+ // Consider these definitions and variable declarations:
50
+ // DEFINE_INT_TYPE(GlobalDocID, int64);
51
+ // DEFINE_INT_TYPE(LocalDocID, int64);
52
+ // GlobalDocID global;
53
+ // LocalDocID local;
54
+ //
55
+ // The class IntType prevents:
56
+ //
57
+ // 1) Assignments of other IntTypes with different IntTypeNames.
58
+ //
59
+ // global = local; <-- Fails to compile!
60
+ // local = global; <-- Fails to compile!
61
+ //
62
+ // 2) Explicit/implicit conversion from an IntType to another IntType.
63
+ //
64
+ // LocalDocID l(global); <-- Fails to compile!
65
+ // LocalDocID l = global; <-- Fails to compile!
66
+ //
67
+ // void GetGlobalDoc(GlobalDocID global) { }
68
+ // GetGlobalDoc(global); <-- Compiles fine, types match!
69
+ // GetGlobalDoc(local); <-- Fails to compile!
70
+ //
71
+ // 3) Implicit conversion from an IntType to a native integer type.
72
+ //
73
+ // void GetGlobalDoc(int64 global) { ...
74
+ // GetGlobalDoc(global); <-- Fails to compile!
75
+ // GetGlobalDoc(local); <-- Fails to compile!
76
+ //
77
+ // void GetLocalDoc(int32 local) { ...
78
+ // GetLocalDoc(global); <-- Fails to compile!
79
+ // GetLocalDoc(local); <-- Fails to compile!
80
+ //
81
+ //
82
+ // SUPPORTED OPERATIONS --------------------------------------------------------
83
+ //
84
+ // The following operators are supported: unary: ++ (both prefix and postfix),
85
+ // +, -, ! (logical not), ~ (one's complement); comparison: ==, !=, <, <=, >,
86
+ // >=; numerical: +, -, *, /; assignment: =, +=, -=, /=, *=; stream: <<. Each
87
+ // operator allows the same IntTypeName and the ValueType to be used on
88
+ // both left- and right-hand sides.
89
+ //
90
+ // It also supports an accessor value() returning the stored value as ValueType,
91
+ // and a templatized accessor value<T>() method that serves as syntactic sugar
92
+ // for static_cast<T>(var.value()). These accessors are useful when assigning
93
+ // the stored value into protocol buffer fields and using it as printf args.
94
+ //
95
+ // The class also defines a hash functor that allows the IntType to be used
96
+ // as key to hashable containers such as std::unordered_map and
97
+ // std::unordered_set.
98
+ //
99
+ // We suggest using the IntTypeIndexedContainer wrapper around FixedArray and
100
+ // STL vector (see int-type-indexed-container.h) if an IntType is intended to
101
+ // be used as an index into these containers. These wrappers are indexed in a
102
+ // type-safe manner using IntTypes to ensure type-safety.
103
+ //
104
+ // NB: this implementation does not attempt to abide by or enforce dimensional
105
+ // analysis on these scalar types.
106
+ //
107
+ // EXAMPLES --------------------------------------------------------------------
108
+ //
109
+ // DEFINE_INT_TYPE(GlobalDocID, int64);
110
+ // GlobalDocID global = 3;
111
+ // cout << global; <-- Prints 3 to stdout.
112
+ //
113
+ // for (GlobalDocID i(0); i < global; ++i) {
114
+ // cout << i;
115
+ // } <-- Print(ln)s 0 1 2 to stdout
116
+ //
117
+ // DEFINE_INT_TYPE(LocalDocID, int64);
118
+ // LocalDocID local;
119
+ // cout << local; <-- Prints 0 to stdout it default
120
+ // initializes the value to 0.
121
+ //
122
+ // local = 5;
123
+ // local *= 2;
124
+ // LocalDocID l(local);
125
+ // cout << l + local; <-- Prints 20 to stdout.
126
+ //
127
+ // GenericSearchRequest request;
128
+ // request.set_doc_id(global.value()); <-- Uses value() to extract the value
129
+ // from the IntType class.
130
+ //
131
+ // REMARKS ---------------------------------------------------------------------
132
+ //
133
+ // The following bad usage is permissible although discouraged. Essentially, it
134
+ // involves using the value*() accessors to extract the native integer type out
135
+ // of the IntType class. Keep in mind that the primary reason for the IntType
136
+ // class is to prevent *accidental* mingling of similar logical integer types --
137
+ // and not type casting from one type to another.
138
+ //
139
+ // DEFINE_INT_TYPE(GlobalDocID, int64);
140
+ // DEFINE_INT_TYPE(LocalDocID, int64);
141
+ // GlobalDocID global;
142
+ // LocalDocID local;
143
+ //
144
+ // global = local.value(); <-- Compiles fine.
145
+ //
146
+ // void GetGlobalDoc(GlobalDocID global) { ...
147
+ // GetGlobalDoc(local.value()); <-- Compiles fine.
148
+ //
149
+ // void GetGlobalDoc(int64 global) { ...
150
+ // GetGlobalDoc(local.value()); <-- Compiles fine.
151
+
152
+ #ifndef TENSORFLOW_TSL_LIB_GTL_INT_TYPE_H_
153
+ #define TENSORFLOW_TSL_LIB_GTL_INT_TYPE_H_
154
+
155
+ #include <stddef.h>
156
+
157
+ #include <functional>
158
+ #include <iosfwd>
159
+ #include <ostream> // NOLINT
160
+ #include <unordered_map>
161
+
162
+ #include "tsl/platform/macros.h"
163
+ #include "tsl/platform/types.h"
164
+
165
+ namespace tsl {
166
+ namespace gtl {
167
+
168
+ template <typename IntTypeName, typename _ValueType>
169
+ class IntType;
170
+
171
+ // Defines the IntType using value_type and typedefs it to int_type_name.
172
+ // The struct int_type_name ## _tag_ trickery is needed to ensure that a new
173
+ // type is created per int_type_name.
174
+ #define TSL_LIB_GTL_DEFINE_INT_TYPE(int_type_name, value_type) \
175
+ struct int_type_name##_tag_ {}; \
176
+ typedef ::tsl::gtl::IntType<int_type_name##_tag_, value_type> int_type_name;
177
+
178
+ // Holds an integer value (of type ValueType) and behaves as a ValueType by
179
+ // exposing assignment, unary, comparison, and arithmetic operators.
180
+ //
181
+ // The template parameter IntTypeName defines the name for the int type and must
182
+ // be unique within a binary (the convenient DEFINE_INT_TYPE macro at the end of
183
+ // the file generates a unique IntTypeName). The parameter ValueType defines
184
+ // the integer type value (see supported list above).
185
+ //
186
+ // This class is NOT thread-safe.
187
+ template <typename IntTypeName, typename _ValueType>
188
+ class IntType {
189
+ public:
190
+ typedef _ValueType ValueType; // for non-member operators
191
+ typedef IntType<IntTypeName, ValueType> ThisType; // Syntactic sugar.
192
+
193
+ // Note that this may change from time to time without notice.
194
+ struct Hasher {
195
+ size_t operator()(const IntType& arg) const {
196
+ return static_cast<size_t>(arg.value());
197
+ }
198
+ };
199
+
200
+ template <typename H>
201
+ friend H AbslHashValue(H h, const IntType& i) {
202
+ return H::combine(std::move(h), i.value());
203
+ }
204
+
205
+ public:
206
+ // Default c'tor initializing value_ to 0.
207
+ constexpr IntType() : value_(0) {}
208
+ // C'tor explicitly initializing from a ValueType.
209
+ constexpr explicit IntType(ValueType value) : value_(value) {}
210
+
211
+ // IntType uses the default copy constructor, destructor and assign operator.
212
+ // The defaults are sufficient and omitting them allows the compiler to add
213
+ // the move constructor/assignment.
214
+
215
+ // -- ACCESSORS --------------------------------------------------------------
216
+ // The class provides a value() accessor returning the stored ValueType value_
217
+ // as well as a templatized accessor that is just a syntactic sugar for
218
+ // static_cast<T>(var.value());
219
+ constexpr ValueType value() const { return value_; }
220
+
221
+ template <typename ValType>
222
+ constexpr ValType value() const {
223
+ return static_cast<ValType>(value_);
224
+ }
225
+
226
+ // -- UNARY OPERATORS --------------------------------------------------------
227
+ ThisType& operator++() { // prefix ++
228
+ ++value_;
229
+ return *this;
230
+ }
231
+ const ThisType operator++(int v) { // postfix ++
232
+ ThisType temp(*this);
233
+ ++value_;
234
+ return temp;
235
+ }
236
+ ThisType& operator--() { // prefix --
237
+ --value_;
238
+ return *this;
239
+ }
240
+ const ThisType operator--(int v) { // postfix --
241
+ ThisType temp(*this);
242
+ --value_;
243
+ return temp;
244
+ }
245
+
246
+ constexpr bool operator!() const { return value_ == 0; }
247
+ constexpr const ThisType operator+() const { return ThisType(value_); }
248
+ constexpr const ThisType operator-() const { return ThisType(-value_); }
249
+ constexpr const ThisType operator~() const { return ThisType(~value_); }
250
+
251
+ // -- ASSIGNMENT OPERATORS ---------------------------------------------------
252
+ // We support the following assignment operators: =, +=, -=, *=, /=, <<=, >>=
253
+ // and %= for both ThisType and ValueType.
254
+ #define INT_TYPE_ASSIGNMENT_OP(op) \
255
+ ThisType& operator op(const ThisType& arg_value) { \
256
+ value_ op arg_value.value(); \
257
+ return *this; \
258
+ } \
259
+ ThisType& operator op(ValueType arg_value) { \
260
+ value_ op arg_value; \
261
+ return *this; \
262
+ }
263
+ INT_TYPE_ASSIGNMENT_OP(+=);
264
+ INT_TYPE_ASSIGNMENT_OP(-=);
265
+ INT_TYPE_ASSIGNMENT_OP(*=);
266
+ INT_TYPE_ASSIGNMENT_OP(/=);
267
+ INT_TYPE_ASSIGNMENT_OP(<<=); // NOLINT
268
+ INT_TYPE_ASSIGNMENT_OP(>>=); // NOLINT
269
+ INT_TYPE_ASSIGNMENT_OP(%=);
270
+ #undef INT_TYPE_ASSIGNMENT_OP
271
+
272
+ ThisType& operator=(ValueType arg_value) {
273
+ value_ = arg_value;
274
+ return *this;
275
+ }
276
+
277
+ private:
278
+ // The integer value of type ValueType.
279
+ ValueType value_;
280
+
281
+ static_assert(std::is_integral<ValueType>::value, "invalid integer type");
282
+ } TF_PACKED;
283
+
284
+ // -- NON-MEMBER STREAM OPERATORS ----------------------------------------------
285
+ // We provide the << operator, primarily for logging purposes. Currently, there
286
+ // seems to be no need for an >> operator.
287
+ template <typename IntTypeName, typename ValueType>
288
+ std::ostream& operator<<(std::ostream& os, // NOLINT
289
+ IntType<IntTypeName, ValueType> arg) {
290
+ return os << arg.value();
291
+ }
292
+
293
+ // -- NON-MEMBER ARITHMETIC OPERATORS ------------------------------------------
294
+ // We support only the +, -, *, and / operators with the same IntType and
295
+ // ValueType types. The reason is to allow simple manipulation on these IDs
296
+ // when used as indices in vectors and arrays.
297
+ //
298
+ // NB: Although it is possible to do IntType * IntType and IntType / IntType,
299
+ // it is probably non-sensical from a dimensionality analysis perspective.
300
+ #define INT_TYPE_ARITHMETIC_OP(op) \
301
+ template <typename IntTypeName, typename ValueType> \
302
+ static inline constexpr IntType<IntTypeName, ValueType> operator op( \
303
+ IntType<IntTypeName, ValueType> id_1, \
304
+ IntType<IntTypeName, ValueType> id_2) { \
305
+ return IntType<IntTypeName, ValueType>(id_1.value() op id_2.value()); \
306
+ } \
307
+ template <typename IntTypeName, typename ValueType> \
308
+ static inline constexpr IntType<IntTypeName, ValueType> operator op( \
309
+ IntType<IntTypeName, ValueType> id, \
310
+ typename IntType<IntTypeName, ValueType>::ValueType arg_val) { \
311
+ return IntType<IntTypeName, ValueType>(id.value() op arg_val); \
312
+ } \
313
+ template <typename IntTypeName, typename ValueType> \
314
+ static inline constexpr IntType<IntTypeName, ValueType> operator op( \
315
+ typename IntType<IntTypeName, ValueType>::ValueType arg_val, \
316
+ IntType<IntTypeName, ValueType> id) { \
317
+ return IntType<IntTypeName, ValueType>(arg_val op id.value()); \
318
+ }
319
+ INT_TYPE_ARITHMETIC_OP(+);
320
+ INT_TYPE_ARITHMETIC_OP(-);
321
+ INT_TYPE_ARITHMETIC_OP(*);
322
+ INT_TYPE_ARITHMETIC_OP(/);
323
+ INT_TYPE_ARITHMETIC_OP(<<); // NOLINT
324
+ INT_TYPE_ARITHMETIC_OP(>>); // NOLINT
325
+ INT_TYPE_ARITHMETIC_OP(%);
326
+ #undef INT_TYPE_ARITHMETIC_OP
327
+
328
+ // -- NON-MEMBER COMPARISON OPERATORS ------------------------------------------
329
+ // Static inline comparison operators. We allow all comparison operators among
330
+ // the following types (OP \in [==, !=, <, <=, >, >=]:
331
+ // IntType<IntTypeName, ValueType> OP IntType<IntTypeName, ValueType>
332
+ // IntType<IntTypeName, ValueType> OP ValueType
333
+ // ValueType OP IntType<IntTypeName, ValueType>
334
+ #define INT_TYPE_COMPARISON_OP(op) \
335
+ template <typename IntTypeName, typename ValueType> \
336
+ static inline constexpr bool operator op( \
337
+ IntType<IntTypeName, ValueType> id_1, \
338
+ IntType<IntTypeName, ValueType> id_2) { \
339
+ return id_1.value() op id_2.value(); \
340
+ } \
341
+ template <typename IntTypeName, typename ValueType> \
342
+ static inline constexpr bool operator op( \
343
+ IntType<IntTypeName, ValueType> id, \
344
+ typename IntType<IntTypeName, ValueType>::ValueType val) { \
345
+ return id.value() op val; \
346
+ } \
347
+ template <typename IntTypeName, typename ValueType> \
348
+ static inline constexpr bool operator op( \
349
+ typename IntType<IntTypeName, ValueType>::ValueType val, \
350
+ IntType<IntTypeName, ValueType> id) { \
351
+ return val op id.value(); \
352
+ }
353
+ INT_TYPE_COMPARISON_OP(==); // NOLINT
354
+ INT_TYPE_COMPARISON_OP(!=); // NOLINT
355
+ INT_TYPE_COMPARISON_OP(<); // NOLINT
356
+ INT_TYPE_COMPARISON_OP(<=); // NOLINT
357
+ INT_TYPE_COMPARISON_OP(>); // NOLINT
358
+ INT_TYPE_COMPARISON_OP(>=); // NOLINT
359
+ #undef INT_TYPE_COMPARISON_OP
360
+
361
+ } // namespace gtl
362
+ } // namespace tsl
363
+
364
+ #endif // TENSORFLOW_TSL_LIB_GTL_INT_TYPE_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/gtl/iterator_range.h ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ // This provides a very simple, boring adaptor for a begin and end iterator
17
+ // into a range type. This should be used to build range views that work well
18
+ // with range based for loops and range based constructors.
19
+ //
20
+ // Note that code here follows more standards-based coding conventions as it
21
+ // is mirroring proposed interfaces for standardization.
22
+ //
23
+ // Converted from chandlerc@'s code to Google style by joshl@.
24
+
25
+ #ifndef TENSORFLOW_TSL_LIB_GTL_ITERATOR_RANGE_H_
26
+ #define TENSORFLOW_TSL_LIB_GTL_ITERATOR_RANGE_H_
27
+
28
+ #include <utility>
29
+
30
+ namespace tsl {
31
+ namespace gtl {
32
+
33
+ // A range adaptor for a pair of iterators.
34
+ //
35
+ // This just wraps two iterators into a range-compatible interface. Nothing
36
+ // fancy at all.
37
+ template <typename IteratorT>
38
+ class iterator_range {
39
+ public:
40
+ using value_type = decltype(*std::declval<IteratorT>());
41
+ using iterator = IteratorT;
42
+ using const_iterator = IteratorT;
43
+
44
+ iterator_range() : begin_iterator_(), end_iterator_() {}
45
+ iterator_range(IteratorT begin_iterator, IteratorT end_iterator)
46
+ : begin_iterator_(std::move(begin_iterator)),
47
+ end_iterator_(std::move(end_iterator)) {}
48
+
49
+ IteratorT begin() const { return begin_iterator_; }
50
+ IteratorT end() const { return end_iterator_; }
51
+
52
+ private:
53
+ IteratorT begin_iterator_, end_iterator_;
54
+ };
55
+
56
+ // Convenience function for iterating over sub-ranges.
57
+ //
58
+ // This provides a bit of syntactic sugar to make using sub-ranges
59
+ // in for loops a bit easier. Analogous to std::make_pair().
60
+ template <class T>
61
+ iterator_range<T> make_range(T x, T y) {
62
+ return iterator_range<T>(std::move(x), std::move(y));
63
+ }
64
+
65
+ } // namespace gtl
66
+ } // namespace tsl
67
+
68
+ #endif // TENSORFLOW_TSL_LIB_GTL_ITERATOR_RANGE_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/gtl/map_util.h ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ // This file provides utility functions for use with STL map-like data
17
+ // structures, such as std::map and hash_map. Some functions will also work with
18
+ // sets, such as ContainsKey().
19
+
20
+ #ifndef TENSORFLOW_TSL_LIB_GTL_MAP_UTIL_H_
21
+ #define TENSORFLOW_TSL_LIB_GTL_MAP_UTIL_H_
22
+
23
+ #include <stddef.h>
24
+
25
+ #include <iterator>
26
+ #include <memory>
27
+ #include <string>
28
+ #include <utility>
29
+
30
+ #include "tsl/lib/gtl/subtle/map_traits.h"
31
+
32
+ namespace tsl {
33
+ namespace gtl {
34
+
35
+ // Returns a pointer to the const value associated with the given key if it
36
+ // exists, or NULL otherwise.
37
+ template <class Collection>
38
+ const typename Collection::value_type::second_type* FindOrNull(
39
+ const Collection& collection,
40
+ const typename Collection::value_type::first_type& key) {
41
+ typename Collection::const_iterator it = collection.find(key);
42
+ if (it == collection.end()) {
43
+ return nullptr;
44
+ }
45
+ return &it->second;
46
+ }
47
+
48
+ // Same as above but returns a pointer to the non-const value.
49
+ template <class Collection>
50
+ typename Collection::value_type::second_type* FindOrNull(
51
+ Collection& collection, // NOLINT
52
+ const typename Collection::value_type::first_type& key) {
53
+ typename Collection::iterator it = collection.find(key);
54
+ if (it == collection.end()) {
55
+ return nullptr;
56
+ }
57
+ return &it->second;
58
+ }
59
+
60
+ // Returns the pointer value associated with the given key. If none is found,
61
+ // NULL is returned. The function is designed to be used with a map of keys to
62
+ // pointers.
63
+ //
64
+ // This function does not distinguish between a missing key and a key mapped
65
+ // to a NULL value.
66
+ template <class Collection>
67
+ typename Collection::value_type::second_type FindPtrOrNull(
68
+ const Collection& collection,
69
+ const typename Collection::value_type::first_type& key) {
70
+ typename Collection::const_iterator it = collection.find(key);
71
+ if (it == collection.end()) {
72
+ return typename Collection::value_type::second_type();
73
+ }
74
+ return it->second;
75
+ }
76
+
77
+ // Returns a const reference to the value associated with the given key if it
78
+ // exists, otherwise returns a const reference to the provided default value.
79
+ //
80
+ // WARNING: If a temporary object is passed as the default "value,"
81
+ // this function will return a reference to that temporary object,
82
+ // which will be destroyed at the end of the statement. A common
83
+ // example: if you have a map with string values, and you pass a char*
84
+ // as the default "value," either use the returned value immediately
85
+ // or store it in a string (not string&).
86
+ template <class Collection>
87
+ const typename Collection::value_type::second_type& FindWithDefault(
88
+ const Collection& collection,
89
+ const typename Collection::value_type::first_type& key,
90
+ const typename Collection::value_type::second_type& value) {
91
+ typename Collection::const_iterator it = collection.find(key);
92
+ if (it == collection.end()) {
93
+ return value;
94
+ }
95
+ return it->second;
96
+ }
97
+
98
+ // Inserts the given key-value pair into the collection. Returns true if and
99
+ // only if the key from the given pair didn't previously exist. Otherwise, the
100
+ // value in the map is replaced with the value from the given pair.
101
+ template <class Collection>
102
+ bool InsertOrUpdate(Collection* const collection,
103
+ const typename Collection::value_type& vt) {
104
+ std::pair<typename Collection::iterator, bool> ret = collection->insert(vt);
105
+ if (!ret.second) {
106
+ // update
107
+ ret.first->second = vt.second;
108
+ return false;
109
+ }
110
+ return true;
111
+ }
112
+
113
+ // Same as above, except that the key and value are passed separately.
114
+ template <class Collection>
115
+ bool InsertOrUpdate(Collection* const collection,
116
+ const typename Collection::value_type::first_type& key,
117
+ const typename Collection::value_type::second_type& value) {
118
+ return InsertOrUpdate(collection,
119
+ typename Collection::value_type(key, value));
120
+ }
121
+
122
+ // Inserts the given key and value into the given collection if and only if the
123
+ // given key did NOT already exist in the collection. If the key previously
124
+ // existed in the collection, the value is not changed. Returns true if the
125
+ // key-value pair was inserted; returns false if the key was already present.
126
+ template <class Collection>
127
+ bool InsertIfNotPresent(Collection* const collection,
128
+ const typename Collection::value_type& vt) {
129
+ return collection->insert(vt).second;
130
+ }
131
+
132
+ // Same as above except the key and value are passed separately.
133
+ template <class Collection>
134
+ bool InsertIfNotPresent(
135
+ Collection* const collection,
136
+ const typename Collection::value_type::first_type& key,
137
+ const typename Collection::value_type::second_type& value) {
138
+ return InsertIfNotPresent(collection,
139
+ typename Collection::value_type(key, value));
140
+ }
141
+
142
+ // Looks up a given key and value pair in a collection and inserts the key-value
143
+ // pair if it's not already present. Returns a reference to the value associated
144
+ // with the key.
145
+ template <class Collection>
146
+ typename Collection::value_type::second_type& LookupOrInsert(
147
+ Collection* const collection, const typename Collection::value_type& vt) {
148
+ return collection->insert(vt).first->second;
149
+ }
150
+
151
+ // Same as above except the key-value are passed separately.
152
+ template <class Collection>
153
+ typename Collection::value_type::second_type& LookupOrInsert(
154
+ Collection* const collection,
155
+ const typename Collection::value_type::first_type& key,
156
+ const typename Collection::value_type::second_type& value) {
157
+ return LookupOrInsert(collection,
158
+ typename Collection::value_type(key, value));
159
+ }
160
+
161
+ // Saves the reverse mapping into reverse. Returns true if values could all be
162
+ // inserted.
163
+ template <typename M, typename ReverseM>
164
+ bool ReverseMap(const M& m, ReverseM* reverse) {
165
+ bool all_unique = true;
166
+ for (const auto& kv : m) {
167
+ if (!InsertOrUpdate(reverse, kv.second, kv.first)) {
168
+ all_unique = false;
169
+ }
170
+ }
171
+ return all_unique;
172
+ }
173
+
174
+ // Like ReverseMap above, but returns its output m. Return type has to
175
+ // be specified explicitly. Example:
176
+ // M::M(...) : m_(...), r_(ReverseMap<decltype(r_)>(m_)) {}
177
+ template <typename ReverseM, typename M>
178
+ ReverseM ReverseMap(const M& m) {
179
+ typename std::remove_const<ReverseM>::type reverse;
180
+ ReverseMap(m, &reverse);
181
+ return reverse;
182
+ }
183
+
184
+ // Erases the m item identified by the given key, and returns the value
185
+ // associated with that key. It is assumed that the value (i.e., the
186
+ // mapped_type) is a pointer. Returns null if the key was not found in the
187
+ // m.
188
+ //
189
+ // Examples:
190
+ // std::map<string, MyType*> my_map;
191
+ //
192
+ // One line cleanup:
193
+ // delete EraseKeyReturnValuePtr(&my_map, "abc");
194
+ //
195
+ // Use returned value:
196
+ // std::unique_ptr<MyType> value_ptr(
197
+ // EraseKeyReturnValuePtr(&my_map, "abc"));
198
+ // if (value_ptr.get())
199
+ // value_ptr->DoSomething();
200
+ //
201
+ template <typename Collection>
202
+ typename Collection::value_type::second_type EraseKeyReturnValuePtr(
203
+ Collection* collection,
204
+ const typename Collection::value_type::first_type& key) {
205
+ auto it = collection->find(key);
206
+ if (it == collection->end()) return nullptr;
207
+ auto v = gtl::subtle::GetMapped(*it);
208
+ collection->erase(it);
209
+ return v;
210
+ }
211
+
212
+ } // namespace gtl
213
+ } // namespace tsl
214
+
215
+ #endif // TENSORFLOW_TSL_LIB_GTL_MAP_UTIL_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/gtl/subtle/map_traits.h ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ /* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ ==============================================================================*/
13
+ // Traits classes for performing uniform lookup on different map value types.
14
+ //
15
+ // The access is computed as follows:
16
+ //
17
+ // 1. If T has a `first` or `second` field, use them.
18
+ // 2. Otherwise if it has `key()` or `value()` methods, use them.
19
+ // 3. Otherwise the program is ill-formed.
20
+ #ifndef TENSORFLOW_TSL_LIB_GTL_SUBTLE_MAP_TRAITS_H_
21
+ #define TENSORFLOW_TSL_LIB_GTL_SUBTLE_MAP_TRAITS_H_
22
+ #include <utility>
23
+ namespace tsl {
24
+ namespace gtl {
25
+ namespace subtle {
26
+ namespace internal_map_traits {
27
+ struct Rank1 {};
28
+ struct Rank0 : Rank1 {};
29
+ template <class V>
30
+ auto GetKey(V&& v, Rank0) -> decltype((std::forward<V>(v).first)) {
31
+ return std::forward<V>(v).first;
32
+ }
33
+ template <class V>
34
+ auto GetKey(V&& v, Rank1) -> decltype(std::forward<V>(v).key()) {
35
+ return std::forward<V>(v).key();
36
+ }
37
+ template <class V>
38
+ auto GetMapped(V&& v, Rank0) -> decltype((std::forward<V>(v).second)) {
39
+ return std::forward<V>(v).second;
40
+ }
41
+ template <class V>
42
+ auto GetMapped(V&& v, Rank1) -> decltype(std::forward<V>(v).value()) {
43
+ return std::forward<V>(v).value();
44
+ }
45
+ } // namespace internal_map_traits
46
+ // Accesses the `key_type` from a `value_type`.
47
+ template <typename V>
48
+ auto GetKey(V&& v)
49
+ -> decltype(internal_map_traits::GetKey(std::forward<V>(v),
50
+ internal_map_traits::Rank0())) {
51
+ return internal_map_traits::GetKey(std::forward<V>(v),
52
+ internal_map_traits::Rank0());
53
+ }
54
+ // Accesses the `mapped_type` from a `value_type`.
55
+ template <typename V>
56
+ auto GetMapped(V&& v)
57
+ -> decltype(internal_map_traits::GetMapped(std::forward<V>(v),
58
+ internal_map_traits::Rank0())) {
59
+ return internal_map_traits::GetMapped(std::forward<V>(v),
60
+ internal_map_traits::Rank0());
61
+ }
62
+ } // namespace subtle
63
+ } // namespace gtl
64
+ } // namespace tsl
65
+ #endif // TENSORFLOW_TSL_LIB_GTL_SUBTLE_MAP_TRAITS_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/hash/crc32c.h ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_HASH_CRC32C_H_
17
+ #define TENSORFLOW_TSL_LIB_HASH_CRC32C_H_
18
+
19
+ #include <stddef.h>
20
+
21
+ #include "absl/crc/crc32c.h"
22
+ #include "tsl/platform/cord.h"
23
+ #include "tsl/platform/platform.h"
24
+ #include "tsl/platform/types.h"
25
+
26
+ namespace tsl {
27
+ namespace crc32c {
28
+
29
+ // Return the crc32c of concat(A, buf[0,size-1]) where init_crc is the
30
+ // crc32c of some string A. Extend() is often used to maintain the
31
+ // crc32c of a stream of data.
32
+ inline uint32 Extend(uint32 init_crc, const char* buf, size_t size) {
33
+ return static_cast<uint32>(absl::ExtendCrc32c(
34
+ static_cast<absl::crc32c_t>(init_crc), absl::string_view(buf, size)));
35
+ }
36
+
37
+ #if defined(TF_CORD_SUPPORT)
38
+ extern uint32 Extend(uint32 init_crc, const absl::Cord& cord);
39
+ #endif
40
+
41
+ // Return the crc32c of data[0,n-1]
42
+ inline uint32 Value(const char* data, size_t n) { return Extend(0, data, n); }
43
+
44
+ #if defined(TF_CORD_SUPPORT)
45
+ inline uint32 Value(const absl::Cord& cord) { return Extend(0, cord); }
46
+ #endif
47
+
48
+ static const uint32 kMaskDelta = 0xa282ead8ul;
49
+
50
+ // Return a masked representation of crc.
51
+ //
52
+ // Motivation: it is problematic to compute the CRC of a string that
53
+ // contains embedded CRCs. Therefore we recommend that CRCs stored
54
+ // somewhere (e.g., in files) should be masked before being stored.
55
+ inline uint32 Mask(uint32 crc) {
56
+ // Rotate right by 15 bits and add a constant.
57
+ return ((crc >> 15) | (crc << 17)) + kMaskDelta;
58
+ }
59
+
60
+ // Return the crc whose masked representation is masked_crc.
61
+ inline uint32 Unmask(uint32 masked_crc) {
62
+ uint32 rot = masked_crc - kMaskDelta;
63
+ return ((rot >> 17) | (rot << 15));
64
+ }
65
+
66
+ } // namespace crc32c
67
+ } // namespace tsl
68
+
69
+ #endif // TENSORFLOW_TSL_LIB_HASH_CRC32C_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/histogram/histogram.h ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_HISTOGRAM_HISTOGRAM_H_
17
+ #define TENSORFLOW_TSL_LIB_HISTOGRAM_HISTOGRAM_H_
18
+
19
+ #include <string>
20
+ #include <vector>
21
+
22
+ #include "tsl/platform/macros.h"
23
+ #include "tsl/platform/mutex.h"
24
+ #include "tsl/platform/thread_annotations.h"
25
+ #include "tsl/platform/types.h"
26
+
27
+ namespace tensorflow {
28
+ class HistogramProto;
29
+ }
30
+
31
+ namespace tsl {
32
+ using tensorflow::HistogramProto;
33
+
34
+ namespace histogram {
35
+
36
+ class Histogram {
37
+ public:
38
+ // Create a histogram with a default set of bucket boundaries.
39
+ // Buckets near zero cover very small ranges (e.g. 10^-12), and each
40
+ // bucket range grows by ~10% as we head away from zero. The
41
+ // buckets cover the range from -DBL_MAX to DBL_MAX.
42
+ Histogram();
43
+
44
+ // Create a histogram with a custom set of bucket boundaries,
45
+ // specified in "custom_bucket_limits[0..custom_bucket_limits.size()-1]"
46
+ // REQUIRES: custom_bucket_limits[i] values are monotonically increasing.
47
+ // REQUIRES: custom_bucket_limits is not empty()
48
+ explicit Histogram(absl::Span<const double> custom_bucket_limits);
49
+
50
+ // Restore the state of a histogram that was previously encoded
51
+ // via Histogram::EncodeToProto. Note that only the bucket boundaries
52
+ // generated by EncodeToProto will be restored.
53
+ bool DecodeFromProto(const HistogramProto& proto);
54
+
55
+ ~Histogram() {}
56
+
57
+ void Clear();
58
+ void Add(double value);
59
+
60
+ // Save the current state of the histogram to "*proto". If
61
+ // "preserve_zero_buckets" is false, only non-zero bucket values and
62
+ // ranges are saved, and the bucket boundaries of zero-valued buckets
63
+ // are lost.
64
+ void EncodeToProto(HistogramProto* proto, bool preserve_zero_buckets) const;
65
+
66
+ // Return the median of the values in the histogram
67
+ double Median() const;
68
+
69
+ // Return the "p"th percentile [0.0..100.0] of the values in the
70
+ // distribution
71
+ double Percentile(double p) const;
72
+
73
+ // Return the average value of the distribution
74
+ double Average() const;
75
+
76
+ // Return the standard deviation of values in the distribution
77
+ double StandardDeviation() const;
78
+
79
+ // Returns a multi-line human-readable string representing the histogram
80
+ // contents. Example output:
81
+ // Count: 4 Average: 251.7475 StdDev: 432.02
82
+ // Min: -3.0000 Median: 5.0000 Max: 1000.0000
83
+ // ------------------------------------------------------
84
+ // [ -5, 0 ) 1 25.000% 25.000% #####
85
+ // [ 0, 5 ) 1 25.000% 50.000% #####
86
+ // [ 5, 10 ) 1 25.000% 75.000% #####
87
+ // [ 1000, 10000 ) 1 25.000% 100.000% #####
88
+ std::string ToString() const;
89
+
90
+ private:
91
+ double min_;
92
+ double max_;
93
+ double num_;
94
+ double sum_;
95
+ double sum_squares_;
96
+
97
+ std::vector<double> custom_bucket_limits_;
98
+ absl::Span<const double> bucket_limits_;
99
+ std::vector<double> buckets_;
100
+
101
+ double Remap(double x, double x0, double x1, double y0, double y1) const;
102
+
103
+ Histogram(const Histogram&) = delete;
104
+ void operator=(const Histogram&) = delete;
105
+ };
106
+
107
+ // Wrapper around a Histogram object that is thread safe.
108
+ //
109
+ // All methods hold a lock while delegating to a Histogram object owned by the
110
+ // ThreadSafeHistogram instance.
111
+ //
112
+ // See Histogram for documentation of the methods.
113
+ class ThreadSafeHistogram {
114
+ public:
115
+ ThreadSafeHistogram() {}
116
+ explicit ThreadSafeHistogram(absl::Span<const double> custom_bucket_limits)
117
+ : histogram_(custom_bucket_limits) {}
118
+ bool DecodeFromProto(const HistogramProto& proto);
119
+
120
+ ~ThreadSafeHistogram() {}
121
+
122
+ void Clear();
123
+
124
+ // TODO(touts): It might be a good idea to provide a AddN(<many values>)
125
+ // method to avoid grabbing/releasing the lock when adding many values.
126
+ void Add(double value);
127
+
128
+ void EncodeToProto(HistogramProto* proto, bool preserve_zero_buckets) const;
129
+ double Median() const;
130
+ double Percentile(double p) const;
131
+ double Average() const;
132
+ double StandardDeviation() const;
133
+ std::string ToString() const;
134
+
135
+ private:
136
+ mutable mutex mu_;
137
+ Histogram histogram_ TF_GUARDED_BY(mu_);
138
+ };
139
+
140
+ } // namespace histogram
141
+ } // namespace tsl
142
+
143
+ #endif // TENSORFLOW_TSL_LIB_HISTOGRAM_HISTOGRAM_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/block.h ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_IO_BLOCK_H_
17
+ #define TENSORFLOW_TSL_LIB_IO_BLOCK_H_
18
+
19
+ #include <stddef.h>
20
+ #include <stdint.h>
21
+
22
+ #include "tsl/lib/io/iterator.h"
23
+
24
+ namespace tsl {
25
+ namespace table {
26
+
27
+ struct BlockContents;
28
+
29
+ class Block {
30
+ public:
31
+ // Initialize the block with the specified contents.
32
+ explicit Block(const BlockContents& contents);
33
+
34
+ ~Block();
35
+
36
+ size_t size() const { return size_; }
37
+ Iterator* NewIterator();
38
+
39
+ private:
40
+ uint32 NumRestarts() const;
41
+
42
+ const char* data_;
43
+ size_t size_;
44
+ uint32 restart_offset_; // Offset in data_ of restart array
45
+ bool owned_; // Block owns data_[]
46
+
47
+ // No copying allowed
48
+ Block(const Block&);
49
+ void operator=(const Block&);
50
+
51
+ class Iter;
52
+ };
53
+
54
+ } // namespace table
55
+ } // namespace tsl
56
+
57
+ #endif // TENSORFLOW_TSL_LIB_IO_BLOCK_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/block_builder.h ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_IO_BLOCK_BUILDER_H_
17
+ #define TENSORFLOW_TSL_LIB_IO_BLOCK_BUILDER_H_
18
+
19
+ #include <stdint.h>
20
+
21
+ #include <vector>
22
+
23
+ #include "tsl/platform/stringpiece.h"
24
+ #include "tsl/platform/types.h"
25
+
26
+ namespace tsl {
27
+ namespace table {
28
+
29
+ struct Options;
30
+
31
+ class BlockBuilder {
32
+ public:
33
+ explicit BlockBuilder(const Options* options);
34
+
35
+ // Reset the contents as if the BlockBuilder was just constructed.
36
+ void Reset();
37
+
38
+ // REQUIRES: Finish() has not been called since the last call to Reset().
39
+ // REQUIRES: key is larger than any previously added key
40
+ void Add(const StringPiece& key, const StringPiece& value);
41
+
42
+ // Finish building the block and return a slice that refers to the
43
+ // block contents. The returned slice will remain valid for the
44
+ // lifetime of this builder or until Reset() is called.
45
+ StringPiece Finish();
46
+
47
+ // Returns an estimate of the current (uncompressed) size of the block
48
+ // we are building.
49
+ size_t CurrentSizeEstimate() const;
50
+
51
+ // Return true iff no entries have been added since the last Reset()
52
+ bool empty() const { return buffer_.empty(); }
53
+
54
+ private:
55
+ const Options* options_;
56
+ string buffer_; // Destination buffer
57
+ std::vector<uint32> restarts_; // Restart points
58
+ int counter_; // Number of entries emitted since restart
59
+ bool finished_; // Has Finish() been called?
60
+ string last_key_;
61
+
62
+ // No copying allowed
63
+ BlockBuilder(const BlockBuilder&);
64
+ void operator=(const BlockBuilder&);
65
+ };
66
+
67
+ } // namespace table
68
+ } // namespace tsl
69
+
70
+ #endif // TENSORFLOW_TSL_LIB_IO_BLOCK_BUILDER_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/buffered_file.h ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_IO_BUFFERED_FILE_H_
17
+ #define TENSORFLOW_TSL_LIB_IO_BUFFERED_FILE_H_
18
+
19
+ #include <algorithm>
20
+ #include <memory>
21
+ #include <string>
22
+ #include <utility>
23
+
24
+ #include "tsl/lib/hash/crc32c.h"
25
+ #include "tsl/platform/cord.h"
26
+ #include "tsl/platform/file_system.h"
27
+ #include "tsl/platform/status.h"
28
+
29
+ namespace tsl {
30
+ class BufferedWritableFile : public WritableFile {
31
+ public:
32
+ explicit BufferedWritableFile(std::unique_ptr<WritableFile> file,
33
+ int64_t buffer_size = kDefaultBufferSize)
34
+ : file_(std::move(file)) {
35
+ buffer_.resize(buffer_size);
36
+ }
37
+ ~BufferedWritableFile() override { Close().IgnoreError(); }
38
+
39
+ Status Append(StringPiece str_data) override {
40
+ int64_t bytes_left = str_data.size();
41
+ const char* data = str_data.data();
42
+
43
+ while (bytes_left > 0) {
44
+ int64_t append_bytes = std::min(
45
+ static_cast<int64_t>(buffer_.size() - buffer_pos_), bytes_left);
46
+
47
+ // Create a copy of the current segment and compute the checksum. We
48
+ // compute the checksum on the copied section in case the underlying
49
+ // `data` buffer changes while we are writing.
50
+ std::copy_n(data, append_bytes, buffer_.begin() + buffer_pos_);
51
+ crc32_ = crc32c::Extend(crc32_, &buffer_[buffer_pos_], append_bytes);
52
+ buffer_pos_ += append_bytes;
53
+ if (buffer_pos_ == buffer_.size()) {
54
+ TF_RETURN_IF_ERROR(file_->Append(buffer_));
55
+ buffer_pos_ = 0;
56
+ }
57
+ data = data + append_bytes;
58
+ bytes_left -= append_bytes;
59
+ }
60
+
61
+ return OkStatus();
62
+ }
63
+
64
+ Status Append(const absl::Cord& data) override {
65
+ for (absl::string_view fragment : data.Chunks()) {
66
+ TF_RETURN_IF_ERROR(Append(fragment));
67
+ }
68
+ return OkStatus();
69
+ }
70
+
71
+ Status Close() override {
72
+ TF_RETURN_IF_ERROR(Flush());
73
+ return file_->Close();
74
+ }
75
+
76
+ Status Flush() override {
77
+ if (buffer_pos_ > 0) {
78
+ TF_RETURN_IF_ERROR(file_->Append(StringPiece(&buffer_[0], buffer_pos_)));
79
+ buffer_pos_ = 0;
80
+ }
81
+ return file_->Flush();
82
+ }
83
+
84
+ tsl::Status Tell(int64_t* position) override {
85
+ int64_t bytes_written;
86
+ tsl::Status status = file_->Tell(&bytes_written);
87
+ if (status.ok()) {
88
+ *position = bytes_written + buffer_pos_;
89
+ return OkStatus();
90
+ } else {
91
+ return status;
92
+ }
93
+ }
94
+
95
+ Status Sync() override { return file_->Sync(); }
96
+
97
+ // For compatibilty with the TensorBundle writer, we expose CRC32 checksums.
98
+ uint32_t crc32() const { return crc32_; }
99
+ void reset_crc32() { crc32_ = 0; }
100
+
101
+ private:
102
+ static constexpr int64_t kDefaultBufferSize = 1048576;
103
+
104
+ std::string buffer_;
105
+ int64_t buffer_pos_ = 0;
106
+
107
+ std::unique_ptr<WritableFile> file_;
108
+ uint32_t crc32_ = 0;
109
+
110
+ BufferedWritableFile(const BufferedWritableFile&) = delete;
111
+ void operator=(const BufferedWritableFile&) = delete;
112
+ };
113
+
114
+ } // namespace tsl
115
+ #endif // TENSORFLOW_TSL_LIB_IO_BUFFERED_FILE_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/buffered_inputstream.h ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_IO_BUFFERED_INPUTSTREAM_H_
17
+ #define TENSORFLOW_TSL_LIB_IO_BUFFERED_INPUTSTREAM_H_
18
+
19
+ #include <string>
20
+
21
+ #include "tsl/lib/io/inputstream_interface.h"
22
+ #include "tsl/platform/file_system.h"
23
+
24
+ namespace tsl {
25
+ namespace io {
26
+
27
+ // Provides a buffer on top of an InputStreamInterface. A single instance of
28
+ // BufferedInputStream is NOT safe for concurrent use by multiple threads.
29
+ class BufferedInputStream : public InputStreamInterface {
30
+ public:
31
+ // Does not take ownership of input_stream unless owns_input_stream is set
32
+ // to true. input_stream must outlive *this then.
33
+ // TODO(rohanj): Remove owns_input_stream once the constructor below is
34
+ // removed.
35
+ BufferedInputStream(InputStreamInterface* input_stream, size_t buffer_bytes,
36
+ bool owns_input_stream = false);
37
+
38
+ // For backwards compatibility, expose an interface that is similar to what
39
+ // InputBuffer exposes. Does not take ownership of file. file must outlive
40
+ // *this. This will be removed once we migrate all uses of this class to the
41
+ // constructor above.
42
+ BufferedInputStream(RandomAccessFile* file, size_t buffer_bytes);
43
+
44
+ ~BufferedInputStream() override;
45
+
46
+ Status ReadNBytes(int64_t bytes_to_read, tstring* result) override;
47
+
48
+ Status SkipNBytes(int64_t bytes_to_skip) override;
49
+
50
+ int64_t Tell() const override;
51
+
52
+ // Seek to this offset within the file.
53
+ //
54
+ // If we seek to somewhere within our pre-buffered data, we will re-use what
55
+ // data we can. Otherwise, Seek() throws out the current buffer and the next
56
+ // read will trigger an underlying read.
57
+ //
58
+ // Note: When seeking backwards in a stream, this implementation uses
59
+ // Reset() + SkipNBytes(), so its performance will be dependent
60
+ // largely on the performance of SkipNBytes().
61
+ Status Seek(int64_t position);
62
+
63
+ // Read one text line of data into "*result" until end-of-file or a
64
+ // \n is read. (The \n is not included in the result.) Overwrites
65
+ // any existing data in *result.
66
+ //
67
+ // If successful, returns OK. If we are already at the end of the
68
+ // file, we return an OUT_OF_RANGE error. Otherwise, we return
69
+ // some other non-OK status.
70
+ Status ReadLine(std::string* result);
71
+ Status ReadLine(tstring* result);
72
+
73
+ // Returns one text line of data until end-of-file or a '\n' is read. The '\n'
74
+ // is included in the result.
75
+ // This method is a substitute for ReadLine() when called from Python which is
76
+ // the expectation in the python File::readline() API.
77
+ // Also, '\0's are treated like any other character within the line and given
78
+ // no special treatment.
79
+ std::string ReadLineAsString();
80
+
81
+ // Skip one text line of data.
82
+ //
83
+ // If successful, returns OK. If we are already at the end of the
84
+ // file, we return an OUT_OF_RANGE error. Otherwise, we return
85
+ // some other non-OK status.
86
+ Status SkipLine();
87
+
88
+ // Reads the entire contents of the file into *result.
89
+ //
90
+ // Note: the amount of memory used by this function call is unbounded, so only
91
+ // use in ops that expect that behavior.
92
+ template <typename T>
93
+ Status ReadAll(T* result);
94
+
95
+ Status Reset() override;
96
+
97
+ private:
98
+ Status FillBuffer();
99
+ template <typename StringType>
100
+ Status ReadLineHelper(StringType* result, bool include_eol);
101
+
102
+ InputStreamInterface* input_stream_; // not owned.
103
+ size_t size_; // buffer size.
104
+ tstring buf_; // the buffer itself.
105
+ // buf_[pos_, limit_) holds the valid "read ahead" data in the file.
106
+ size_t pos_ = 0; // current position in buf_.
107
+ size_t limit_ = 0; // just past the end of valid data in buf_.
108
+ bool owns_input_stream_ = false;
109
+ // When EoF is reached, file_status_ contains the status to skip unnecessary
110
+ // buffer allocations.
111
+ Status file_status_ = OkStatus();
112
+
113
+ BufferedInputStream(const BufferedInputStream&) = delete;
114
+ void operator=(const BufferedInputStream&) = delete;
115
+ };
116
+
117
+ // Explicit instantiations defined in buffered_inputstream.cc.
118
+ #ifndef SWIG
119
+ extern template Status BufferedInputStream::ReadAll<std::string>(
120
+ std::string* result);
121
+ extern template Status BufferedInputStream::ReadAll<tstring>(tstring* result);
122
+ #endif // SWIG
123
+
124
+ } // namespace io
125
+ } // namespace tsl
126
+
127
+ #endif // TENSORFLOW_TSL_LIB_IO_BUFFERED_INPUTSTREAM_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/cache.h ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_IO_CACHE_H_
17
+ #define TENSORFLOW_TSL_LIB_IO_CACHE_H_
18
+
19
+ #include <cstdint>
20
+
21
+ #include "tsl/platform/stringpiece.h"
22
+
23
+ // A Cache is an interface that maps keys to values. It has internal
24
+ // synchronization and may be safely accessed concurrently from
25
+ // multiple threads. It may automatically evict entries to make room
26
+ // for new entries. Values have a specified charge against the cache
27
+ // capacity. For example, a cache where the values are variable
28
+ // length strings, may use the length of the string as the charge for
29
+ // the string.
30
+ //
31
+ // A builtin cache implementation with a least-recently-used eviction
32
+ // policy is provided. Clients may use their own implementations if
33
+ // they want something more sophisticated (like scan-resistance, a
34
+ // custom eviction policy, variable cache sizing, etc.)
35
+
36
+ namespace tsl {
37
+
38
+ using Slice = StringPiece;
39
+
40
+ namespace table {
41
+
42
+ class Cache;
43
+
44
+ // Create a new cache with a fixed size capacity. This implementation
45
+ // of Cache uses a least-recently-used eviction policy.
46
+ Cache* NewLRUCache(size_t capacity);
47
+
48
+ class Cache {
49
+ public:
50
+ Cache() = default;
51
+
52
+ Cache(const Cache&) = delete;
53
+ Cache& operator=(const Cache&) = delete;
54
+
55
+ // Destroys all existing entries by calling the "deleter"
56
+ // function that was passed to the constructor.
57
+ virtual ~Cache();
58
+
59
+ // Opaque handle to an entry stored in the cache.
60
+ struct Handle {};
61
+
62
+ // Insert a mapping from key->value into the cache and assign it
63
+ // the specified charge against the total cache capacity.
64
+ //
65
+ // Returns a handle that corresponds to the mapping. The caller
66
+ // must call this->Release(handle) when the returned mapping is no
67
+ // longer needed.
68
+ //
69
+ // When the inserted entry is no longer needed, the key and
70
+ // value will be passed to "deleter".
71
+ virtual Handle* Insert(const Slice& key, void* value, size_t charge,
72
+ void (*deleter)(const Slice& key, void* value)) = 0;
73
+
74
+ // If the cache has no mapping for "key", returns nullptr.
75
+ //
76
+ // Else return a handle that corresponds to the mapping. The caller
77
+ // must call this->Release(handle) when the returned mapping is no
78
+ // longer needed.
79
+ virtual Handle* Lookup(const Slice& key) = 0;
80
+
81
+ // Release a mapping returned by a previous Lookup().
82
+ // REQUIRES: handle must not have been released yet.
83
+ // REQUIRES: handle must have been returned by a method on *this.
84
+ virtual void Release(Handle* handle) = 0;
85
+
86
+ // Return the value encapsulated in a handle returned by a
87
+ // successful Lookup().
88
+ // REQUIRES: handle must not have been released yet.
89
+ // REQUIRES: handle must have been returned by a method on *this.
90
+ virtual void* Value(Handle* handle) = 0;
91
+
92
+ // If the cache contains entry for key, erase it. Note that the
93
+ // underlying entry will be kept around until all existing handles
94
+ // to it have been released.
95
+ virtual void Erase(const Slice& key) = 0;
96
+
97
+ // Return a new numeric id. May be used by multiple clients who are
98
+ // sharing the same cache to partition the key space. Typically the
99
+ // client will allocate a new id at startup and prepend the id to
100
+ // its cache keys.
101
+ virtual uint64_t NewId() = 0;
102
+
103
+ // Remove all cache entries that are not actively in use. Memory-constrained
104
+ // applications may wish to call this method to reduce memory usage.
105
+ // Default implementation of Prune() does nothing. Subclasses are strongly
106
+ // encouraged to override the default implementation. A future release of
107
+ // leveldb may change Prune() to a pure abstract method.
108
+ virtual void Prune() {}
109
+
110
+ // Return an estimate of the combined charges of all elements stored in the
111
+ // cache.
112
+ virtual size_t TotalCharge() const = 0;
113
+
114
+ private:
115
+ void LRU_Remove(Handle* e);
116
+ void LRU_Append(Handle* e);
117
+ void Unref(Handle* e);
118
+
119
+ struct Rep;
120
+ Rep* rep_;
121
+ };
122
+
123
+ } // namespace table
124
+
125
+ } // namespace tsl
126
+
127
+ #endif // TENSORFLOW_TSL_LIB_IO_CACHE_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/compression.h ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_IO_COMPRESSION_H_
17
+ #define TENSORFLOW_TSL_LIB_IO_COMPRESSION_H_
18
+
19
+ namespace tsl {
20
+ namespace io {
21
+ namespace compression {
22
+
23
+ extern const char kNone[];
24
+ extern const char kGzip[];
25
+ extern const char kSnappy[];
26
+ extern const char kZlib[];
27
+
28
+ } // namespace compression
29
+ } // namespace io
30
+ } // namespace tsl
31
+
32
+ #endif // TENSORFLOW_TSL_LIB_IO_COMPRESSION_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/format.h ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_IO_FORMAT_H_
17
+ #define TENSORFLOW_TSL_LIB_IO_FORMAT_H_
18
+
19
+ #include <stdint.h>
20
+
21
+ #include <string>
22
+
23
+ #include "tsl/lib/io/table_builder.h"
24
+ #include "tsl/platform/status.h"
25
+ #include "tsl/platform/stringpiece.h"
26
+
27
+ namespace tsl {
28
+ class RandomAccessFile;
29
+
30
+ namespace table {
31
+
32
+ class Block;
33
+
34
+ // BlockHandle is a pointer to the extent of a file that stores a data
35
+ // block or a meta block.
36
+ class BlockHandle {
37
+ public:
38
+ BlockHandle();
39
+
40
+ // The offset of the block in the file.
41
+ uint64 offset() const { return offset_; }
42
+ void set_offset(uint64 offset) { offset_ = offset; }
43
+
44
+ // The size of the stored block
45
+ uint64 size() const { return size_; }
46
+ void set_size(uint64 size) { size_ = size; }
47
+
48
+ void EncodeTo(string* dst) const;
49
+ Status DecodeFrom(StringPiece* input);
50
+
51
+ // Maximum encoding length of a BlockHandle
52
+ enum { kMaxEncodedLength = 10 + 10 };
53
+
54
+ private:
55
+ uint64 offset_;
56
+ uint64 size_;
57
+ };
58
+
59
+ // Footer encapsulates the fixed information stored at the tail
60
+ // end of every table file.
61
+ class Footer {
62
+ public:
63
+ Footer() {}
64
+
65
+ // The block handle for the metaindex block of the table
66
+ const BlockHandle& metaindex_handle() const { return metaindex_handle_; }
67
+ void set_metaindex_handle(const BlockHandle& h) { metaindex_handle_ = h; }
68
+
69
+ // The block handle for the index block of the table
70
+ const BlockHandle& index_handle() const { return index_handle_; }
71
+ void set_index_handle(const BlockHandle& h) { index_handle_ = h; }
72
+
73
+ void EncodeTo(string* dst) const;
74
+ Status DecodeFrom(StringPiece* input);
75
+
76
+ // Encoded length of a Footer. Note that the serialization of a
77
+ // Footer will always occupy exactly this many bytes. It consists
78
+ // of two block handles and a magic number.
79
+ enum { kEncodedLength = 2 * BlockHandle::kMaxEncodedLength + 8 };
80
+
81
+ private:
82
+ BlockHandle metaindex_handle_;
83
+ BlockHandle index_handle_;
84
+ };
85
+
86
+ // kTableMagicNumber was picked by running
87
+ // echo http://code.google.com/p/leveldb/ | sha1sum
88
+ // and taking the leading 64 bits.
89
+ static const uint64 kTableMagicNumber = 0xdb4775248b80fb57ull;
90
+
91
+ // 1-byte type + 32-bit crc
92
+ static const size_t kBlockTrailerSize = 5;
93
+
94
+ struct BlockContents {
95
+ StringPiece data; // Actual contents of data
96
+ bool cacheable; // True iff data can be cached
97
+ bool heap_allocated; // True iff caller should delete[] data.data()
98
+ };
99
+
100
+ // Read the block identified by "handle" from "file". On failure
101
+ // return non-OK. On success fill *result and return OK.
102
+ extern Status ReadBlock(RandomAccessFile* file, const BlockHandle& handle,
103
+ BlockContents* result);
104
+
105
+ // Implementation details follow. Clients should ignore,
106
+
107
+ inline BlockHandle::BlockHandle()
108
+ : offset_(~static_cast<uint64>(0)), size_(~static_cast<uint64>(0)) {}
109
+
110
+ } // namespace table
111
+ } // namespace tsl
112
+
113
+ #endif // TENSORFLOW_TSL_LIB_IO_FORMAT_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/inputbuffer.h ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_IO_INPUTBUFFER_H_
17
+ #define TENSORFLOW_TSL_LIB_IO_INPUTBUFFER_H_
18
+
19
+ #include <string>
20
+
21
+ #include "tsl/platform/coding.h"
22
+ #include "tsl/platform/env.h"
23
+ #include "tsl/platform/macros.h"
24
+ #include "tsl/platform/status.h"
25
+ #include "tsl/platform/types.h"
26
+
27
+ namespace tsl {
28
+ namespace io {
29
+
30
+ // An InputBuffer provides a buffer on top of a RandomAccessFile.
31
+ // A given instance of an InputBuffer is NOT safe for concurrent use
32
+ // by multiple threads
33
+ class InputBuffer {
34
+ public:
35
+ // Create an InputBuffer for "file" with a buffer size of
36
+ // "buffer_bytes" bytes. 'file' must outlive *this.
37
+ InputBuffer(RandomAccessFile* file, size_t buffer_bytes);
38
+ ~InputBuffer();
39
+
40
+ // Read one text line of data into "*result" until end-of-file or a
41
+ // \n is read. (The \n is not included in the result.) Overwrites
42
+ // any existing data in *result.
43
+ //
44
+ // If successful, returns OK. If we are already at the end of the
45
+ // file, we return an OUT_OF_RANGE error. Otherwise, we return
46
+ // some other non-OK status.
47
+ template <typename T>
48
+ Status ReadLine(T* result);
49
+
50
+ // Reads bytes_to_read bytes into *result, overwriting *result.
51
+ //
52
+ // If successful, returns OK. If we there are not enough bytes to
53
+ // read before the end of the file, we return an OUT_OF_RANGE error.
54
+ // Otherwise, we return some other non-OK status.
55
+ Status ReadNBytes(int64_t bytes_to_read, std::string* result);
56
+
57
+ // An overload that writes to char*. Caller must ensure result[0,
58
+ // bytes_to_read) is valid to be overwritten. Returns OK iff "*bytes_read ==
59
+ // bytes_to_read".
60
+ Status ReadNBytes(int64_t bytes_to_read, char* result, size_t* bytes_read);
61
+
62
+ // Reads a single varint32.
63
+ Status ReadVarint32(uint32* result);
64
+
65
+ // Reads a single varint64.
66
+ Status ReadVarint64(uint64* result);
67
+
68
+ // Like ReadNBytes() without returning the bytes read.
69
+ Status SkipNBytes(int64_t bytes_to_skip);
70
+
71
+ // Seek to this offset within the file.
72
+ //
73
+ // If we seek to somewhere within our pre-buffered data, we will re-use what
74
+ // data we can. Otherwise, Seek() throws out the current buffer and the next
75
+ // read will trigger a File::Read().
76
+ Status Seek(int64_t position);
77
+
78
+ // Provides a hint about future reads, which may improve their performance.
79
+ Status Hint(int64_t bytes_to_read);
80
+
81
+ // Returns the position in the file.
82
+ int64_t Tell() const { return file_pos_ - (limit_ - pos_); }
83
+
84
+ // Returns the underlying RandomAccessFile.
85
+ RandomAccessFile* file() const { return file_; }
86
+
87
+ private:
88
+ Status FillBuffer();
89
+
90
+ // Internal slow-path routine used by ReadVarint32().
91
+ Status ReadVarint32Fallback(uint32* result);
92
+
93
+ // Internal slow-path routine used by ReadVarint64().
94
+ Status ReadVarint64Fallback(uint64* result);
95
+
96
+ // Helper method for reading a varint which can span at max `max_bytes`.
97
+ // If the varint is longer, a DataLoss error status is returned.
98
+ // If end of file is reached while reading, OutOfRange error is returned.
99
+ template <typename T>
100
+ Status ReadVarintFallback(T* result, int max_bytes);
101
+
102
+ RandomAccessFile* file_; // Not owned
103
+ int64_t file_pos_; // Next position to read from in "file_"
104
+ size_t size_; // Size of "buf_"
105
+ char* buf_; // The buffer itself
106
+ // [pos_,limit_) hold the "limit_ - pos_" bytes just before "file_pos_"
107
+ char* pos_; // Current position in "buf"
108
+ char* limit_; // Just past end of valid data in "buf"
109
+
110
+ InputBuffer(const InputBuffer&) = delete;
111
+ void operator=(const InputBuffer&) = delete;
112
+ };
113
+
114
+ // Implementation details.
115
+
116
+ // Explicit instantiations defined in inputbuffer.cc.
117
+ extern template Status InputBuffer::ReadLine<std::string>(std::string* result);
118
+ extern template Status InputBuffer::ReadLine<tstring>(tstring* result);
119
+
120
+ // Inlined for performance.
121
+ inline Status InputBuffer::ReadVarint32(uint32* result) {
122
+ if (pos_ + core::kMaxVarint32Bytes <= limit_) {
123
+ // Fast path: directly parse from buffered data.
124
+ // Reads strictly from the range [pos_, limit_).
125
+ const char* offset = core::GetVarint32Ptr(pos_, limit_, result);
126
+ if (offset == nullptr) return errors::OutOfRange("Parsed past limit.");
127
+ pos_ = const_cast<char*>(offset);
128
+ return OkStatus();
129
+ } else {
130
+ return ReadVarint32Fallback(result);
131
+ }
132
+ }
133
+
134
+ // Inlined for performance.
135
+ inline Status InputBuffer::ReadVarint64(uint64* result) {
136
+ if (pos_ + core::kMaxVarint64Bytes <= limit_) {
137
+ // Fast path: directly parse from buffered data.
138
+ // Reads strictly from the range [pos_, limit_).
139
+ const char* offset = core::GetVarint64Ptr(pos_, limit_, result);
140
+ if (offset == nullptr) return errors::OutOfRange("Parsed past limit.");
141
+ pos_ = const_cast<char*>(offset);
142
+ return OkStatus();
143
+ } else {
144
+ return ReadVarint64Fallback(result);
145
+ }
146
+ }
147
+
148
+ } // namespace io
149
+ } // namespace tsl
150
+
151
+ #endif // TENSORFLOW_TSL_LIB_IO_INPUTBUFFER_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/inputstream_interface.h ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_IO_INPUTSTREAM_INTERFACE_H_
17
+ #define TENSORFLOW_TSL_LIB_IO_INPUTSTREAM_INTERFACE_H_
18
+
19
+ #include <string>
20
+
21
+ #include "tsl/platform/cord.h"
22
+ #include "tsl/platform/errors.h"
23
+ #include "tsl/platform/status.h"
24
+ #include "tsl/platform/types.h"
25
+
26
+ namespace tsl {
27
+ namespace io {
28
+
29
+ // An interface that defines input streaming operations.
30
+ class InputStreamInterface {
31
+ public:
32
+ InputStreamInterface() {}
33
+ virtual ~InputStreamInterface() {}
34
+
35
+ // Reads the next bytes_to_read from the file. Typical return codes:
36
+ // * OK - in case of success.
37
+ // * OUT_OF_RANGE - not enough bytes remaining before end of file.
38
+ virtual Status ReadNBytes(int64_t bytes_to_read, tstring* result) = 0;
39
+
40
+ #if defined(TF_CORD_SUPPORT)
41
+ // Reads the next bytes_to_read from the file. Typical return codes:
42
+ // * OK - in case of success.
43
+ // * OUT_OF_RANGE - not enough bytes remaining before end of file.
44
+ virtual Status ReadNBytes(int64_t bytes_to_read, absl::Cord* cord) {
45
+ return errors::Unimplemented(
46
+ "ReadNBytes(int64, absl::Cord*) is not implemented.");
47
+ }
48
+ #endif
49
+
50
+ // Skips bytes_to_skip before next ReadNBytes. bytes_to_skip should be >= 0.
51
+ // Typical return codes:
52
+ // * OK - in case of success.
53
+ // * OUT_OF_RANGE - not enough bytes remaining before end of file.
54
+ virtual Status SkipNBytes(int64_t bytes_to_skip);
55
+
56
+ // Return the offset of the current byte relative to the beginning of the
57
+ // file.
58
+ // If we Skip / Read beyond the end of the file, this should return the length
59
+ // of the file.
60
+ // If there are any errors, this must return -1.
61
+ virtual int64_t Tell() const = 0;
62
+
63
+ // Resets the stream to the beginning.
64
+ virtual Status Reset() = 0;
65
+ };
66
+
67
+ } // namespace io
68
+ } // namespace tsl
69
+
70
+ #endif // TENSORFLOW_TSL_LIB_IO_INPUTSTREAM_INTERFACE_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/iterator.h ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ // An iterator yields a sequence of key/value pairs from a source.
17
+ // The following class defines the interface. Multiple implementations
18
+ // are provided by this library. In particular, iterators are provided
19
+ // to access the contents of a Table or a DB.
20
+ //
21
+ // Multiple threads can invoke const methods on an Iterator without
22
+ // external synchronization, but if any of the threads may call a
23
+ // non-const method, all threads accessing the same Iterator must use
24
+ // external synchronization.
25
+
26
+ #ifndef TENSORFLOW_TSL_LIB_IO_ITERATOR_H_
27
+ #define TENSORFLOW_TSL_LIB_IO_ITERATOR_H_
28
+
29
+ #include "tsl/platform/status.h"
30
+ #include "tsl/platform/stringpiece.h"
31
+
32
+ namespace tsl {
33
+ namespace table {
34
+
35
+ class Iterator {
36
+ public:
37
+ Iterator();
38
+ virtual ~Iterator();
39
+
40
+ // An iterator is either positioned at a key/value pair, or
41
+ // not valid. This method returns true iff the iterator is valid.
42
+ virtual bool Valid() const = 0;
43
+
44
+ // Position at the first key in the source. The iterator is Valid()
45
+ // after this call iff the source is not empty.
46
+ virtual void SeekToFirst() = 0;
47
+
48
+ // Position at the first key in the source that is at or past target.
49
+ // The iterator is Valid() after this call iff the source contains
50
+ // an entry that comes at or past target.
51
+ virtual void Seek(const StringPiece& target) = 0;
52
+
53
+ // Moves to the next entry in the source. After this call, Valid() is
54
+ // true iff the iterator was not positioned at the last entry in the source.
55
+ // REQUIRES: Valid()
56
+ virtual void Next() = 0;
57
+
58
+ // Return the key for the current entry. The underlying storage for
59
+ // the returned slice is valid only until the next modification of
60
+ // the iterator.
61
+ // REQUIRES: Valid()
62
+ virtual StringPiece key() const = 0;
63
+
64
+ // Return the value for the current entry. The underlying storage for
65
+ // the returned slice is valid only until the next modification of
66
+ // the iterator.
67
+ // REQUIRES: Valid()
68
+ virtual StringPiece value() const = 0;
69
+
70
+ // If an error has occurred, return it. Else return an ok status.
71
+ virtual Status status() const = 0;
72
+
73
+ // Clients are allowed to register function/arg1/arg2 triples that
74
+ // will be invoked when this iterator is destroyed.
75
+ //
76
+ // Note that unlike all of the preceding methods, this method is
77
+ // not abstract and therefore clients should not override it.
78
+ typedef void (*CleanupFunction)(void* arg1, void* arg2);
79
+ void RegisterCleanup(CleanupFunction function, void* arg1, void* arg2);
80
+
81
+ private:
82
+ struct Cleanup {
83
+ CleanupFunction function;
84
+ void* arg1;
85
+ void* arg2;
86
+ Cleanup* next;
87
+ };
88
+ Cleanup cleanup_;
89
+
90
+ // No copying allowed
91
+ Iterator(const Iterator&);
92
+ void operator=(const Iterator&);
93
+ };
94
+
95
+ // Return an empty iterator (yields nothing).
96
+ extern Iterator* NewEmptyIterator();
97
+
98
+ // Return an empty iterator with the specified status.
99
+ extern Iterator* NewErrorIterator(const Status& status);
100
+
101
+ } // namespace table
102
+ } // namespace tsl
103
+
104
+ #endif // TENSORFLOW_TSL_LIB_IO_ITERATOR_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/proto_encode_helper.h ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_IO_PROTO_ENCODE_HELPER_H_
17
+ #define TENSORFLOW_TSL_LIB_IO_PROTO_ENCODE_HELPER_H_
18
+
19
+ #include "tsl/platform/coding.h"
20
+ #include "tsl/platform/logging.h"
21
+ #include "tsl/platform/protobuf.h"
22
+ #include "tsl/platform/stringpiece.h"
23
+
24
+ // A helper class for appending various kinds of values in protocol
25
+ // buffer encoding format to a buffer. The client gives a pointer to
26
+ // a buffer and a maximum size guarantee for the number of bytes they
27
+ // will add to this buffer.
28
+ namespace tsl {
29
+ namespace io {
30
+
31
+ class ProtoEncodeHelper {
32
+ public:
33
+ ProtoEncodeHelper(char* buf, int max_size)
34
+ : base_(buf), p_(buf), limit_(base_ + max_size) {}
35
+
36
+ ~ProtoEncodeHelper() {
37
+ // Make sure callers didn't do operations that went over max_size promised
38
+ DCHECK_LE(p_, limit_);
39
+ }
40
+
41
+ const char* data() const { return base_; }
42
+ size_t size() const { return p_ - base_; }
43
+
44
+ void WriteUint64(int tag, uint64 v) {
45
+ Encode32(combine(tag, WIRETYPE_VARINT));
46
+ Encode64(v);
47
+ }
48
+ void WriteBool(int tag, bool v) {
49
+ Encode32(combine(tag, WIRETYPE_VARINT));
50
+ EncodeBool(v);
51
+ }
52
+ void WriteString(int tag, StringPiece v) {
53
+ Encode32(combine(tag, WIRETYPE_LENGTH_DELIMITED));
54
+ Encode32(v.size());
55
+ EncodeBytes(v.data(), v.size());
56
+ }
57
+ void WriteVarlengthBeginning(int tag, uint32 len) {
58
+ Encode32(combine(tag, WIRETYPE_LENGTH_DELIMITED));
59
+ Encode32(len);
60
+ }
61
+ void WriteRawBytes(StringPiece v) { EncodeBytes(v.data(), v.size()); }
62
+
63
+ private:
64
+ // Note: this module's behavior must match the protocol buffer wire encoding
65
+ // format.
66
+ enum {
67
+ WIRETYPE_VARINT = 0,
68
+ WIRETYPE_LENGTH_DELIMITED = 2,
69
+ };
70
+ static uint32 combine(uint32 tag, uint32 type) { return ((tag << 3) | type); }
71
+ inline void Encode32(uint32 v) {
72
+ if (v < 128) {
73
+ // Fast path for single-byte values. Many of the calls will use a
74
+ // constant value for v, so the comparison will get optimized away
75
+ // when Encode32 is inlined into the caller.
76
+ *p_ = v;
77
+ p_++;
78
+ } else {
79
+ p_ = core::EncodeVarint32(p_, v);
80
+ }
81
+ }
82
+ void Encode64(uint64 v) { p_ = core::EncodeVarint64(p_, v); }
83
+ void EncodeBool(bool v) {
84
+ *p_ = (v ? 1 : 0); // Equal to varint32 encoding of 0 or 1
85
+ p_++;
86
+ }
87
+ void EncodeBytes(const char* bytes, int N) {
88
+ memcpy(p_, bytes, N);
89
+ p_ += N;
90
+ }
91
+
92
+ char* base_;
93
+ char* p_;
94
+ char* limit_; // Just for CHECKs
95
+ };
96
+ } // namespace io
97
+ } // namespace tsl
98
+
99
+ #endif // TENSORFLOW_TSL_LIB_IO_PROTO_ENCODE_HELPER_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/random_inputstream.h ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_IO_RANDOM_INPUTSTREAM_H_
17
+ #define TENSORFLOW_TSL_LIB_IO_RANDOM_INPUTSTREAM_H_
18
+
19
+ #include "tsl/lib/io/inputstream_interface.h"
20
+ #include "tsl/platform/cord.h"
21
+ #include "tsl/platform/file_system.h"
22
+
23
+ namespace tsl {
24
+ namespace io {
25
+
26
+ // Wraps a RandomAccessFile in an InputStreamInterface. A given instance of
27
+ // RandomAccessInputStream is NOT safe for concurrent use by multiple threads.
28
+ class RandomAccessInputStream : public InputStreamInterface {
29
+ public:
30
+ // Does not take ownership of 'file' unless owns_file is set to true. 'file'
31
+ // must outlive *this.
32
+ RandomAccessInputStream(RandomAccessFile* file, bool owns_file = false);
33
+
34
+ ~RandomAccessInputStream();
35
+
36
+ Status ReadNBytes(int64_t bytes_to_read, tstring* result) override;
37
+
38
+ #if defined(TF_CORD_SUPPORT)
39
+ Status ReadNBytes(int64_t bytes_to_read, absl::Cord* result) override;
40
+ #endif
41
+
42
+ Status SkipNBytes(int64_t bytes_to_skip) override;
43
+
44
+ int64_t Tell() const override;
45
+
46
+ Status Seek(int64_t position) {
47
+ pos_ = position;
48
+ return OkStatus();
49
+ }
50
+
51
+ Status Reset() override { return Seek(0); }
52
+
53
+ private:
54
+ RandomAccessFile* file_; // Not owned.
55
+ int64_t pos_ = 0; // Tracks where we are in the file.
56
+ bool owns_file_ = false;
57
+ };
58
+
59
+ } // namespace io
60
+ } // namespace tsl
61
+
62
+ #endif // TENSORFLOW_TSL_LIB_IO_RANDOM_INPUTSTREAM_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/record_reader.h ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_IO_RECORD_READER_H_
17
+ #define TENSORFLOW_TSL_LIB_IO_RECORD_READER_H_
18
+
19
+ #include "tsl/lib/io/inputstream_interface.h"
20
+ #include "tsl/platform/errors.h"
21
+ #include "tsl/platform/stringpiece.h"
22
+ #if !defined(IS_SLIM_BUILD)
23
+ #include "tsl/lib/io/snappy/snappy_compression_options.h"
24
+ #include "tsl/lib/io/snappy/snappy_inputstream.h"
25
+ #include "tsl/lib/io/zlib_compression_options.h"
26
+ #include "tsl/lib/io/zlib_inputstream.h"
27
+ #endif // IS_SLIM_BUILD
28
+ #include "tsl/platform/macros.h"
29
+ #include "tsl/platform/types.h"
30
+
31
+ namespace tsl {
32
+ class RandomAccessFile;
33
+
34
+ namespace io {
35
+
36
+ struct RecordReaderOptions {
37
+ enum CompressionType {
38
+ NONE = 0,
39
+ ZLIB_COMPRESSION = 1,
40
+ SNAPPY_COMPRESSION = 2
41
+ };
42
+ CompressionType compression_type = NONE;
43
+
44
+ // If buffer_size is non-zero, then all reads must be sequential, and no
45
+ // skipping around is permitted. (Note: this is the same behavior as reading
46
+ // compressed files.) Consider using SequentialRecordReader.
47
+ int64_t buffer_size = 0;
48
+
49
+ static RecordReaderOptions CreateRecordReaderOptions(
50
+ const string& compression_type);
51
+
52
+ #if !defined(IS_SLIM_BUILD)
53
+ // Options specific to compression.
54
+ ZlibCompressionOptions zlib_options;
55
+ SnappyCompressionOptions snappy_options;
56
+ #endif // IS_SLIM_BUILD
57
+ };
58
+
59
+ // Low-level interface to read TFRecord files.
60
+ //
61
+ // If using compression or buffering, consider using SequentialRecordReader.
62
+ //
63
+ // Note: this class is not thread safe; external synchronization required.
64
+ class RecordReader {
65
+ public:
66
+ // Format of a single record:
67
+ // uint64 length
68
+ // uint32 masked crc of length
69
+ // byte data[length]
70
+ // uint32 masked crc of data
71
+ static constexpr size_t kHeaderSize = sizeof(uint64) + sizeof(uint32);
72
+ static constexpr size_t kFooterSize = sizeof(uint32);
73
+
74
+ // Statistics (sizes are in units of bytes)
75
+ struct Stats {
76
+ int64_t file_size = -1;
77
+ int64_t data_size = -1;
78
+ int64_t entries = -1; // Number of values
79
+ };
80
+
81
+ // Metadata for the TFRecord file.
82
+ struct Metadata {
83
+ Stats stats;
84
+ };
85
+
86
+ // Create a reader that will return log records from "*file".
87
+ // "*file" must remain live while this Reader is in use.
88
+ explicit RecordReader(
89
+ tsl::RandomAccessFile* file,
90
+ const RecordReaderOptions& options = RecordReaderOptions());
91
+
92
+ virtual ~RecordReader() = default;
93
+
94
+ // Read the record at "*offset" into *record and update *offset to
95
+ // point to the offset of the next record. Returns OK on success,
96
+ // OUT_OF_RANGE for end of file, or something else for an error.
97
+ Status ReadRecord(uint64* offset, tstring* record);
98
+
99
+ // Skip num_to_skip record starting at "*offset" and update *offset
100
+ // to point to the offset of the next num_to_skip + 1 record.
101
+ // Return OK on success, OUT_OF_RANGE for end of file, or something
102
+ // else for an error. "*num_skipped" records the number of records that
103
+ // are actually skipped. It should be equal to num_to_skip on success.
104
+ Status SkipRecords(uint64* offset, int num_to_skip, int* num_skipped);
105
+
106
+ // Return the metadata of the Record file.
107
+ //
108
+ // The current implementation scans the file to completion,
109
+ // skipping over the data regions, to extract the metadata once
110
+ // on the first call to GetStats(). An improved implementation
111
+ // would change RecordWriter to write the metadata into TFRecord
112
+ // so that GetMetadata() could be a const method.
113
+ //
114
+ // 'metadata' must not be nullptr.
115
+ Status GetMetadata(Metadata* md);
116
+
117
+ private:
118
+ Status ReadChecksummed(uint64 offset, size_t n, tstring* result);
119
+ Status PositionInputStream(uint64 offset);
120
+
121
+ RecordReaderOptions options_;
122
+ std::unique_ptr<InputStreamInterface> input_stream_;
123
+ bool last_read_failed_;
124
+
125
+ std::unique_ptr<Metadata> cached_metadata_;
126
+
127
+ RecordReader(const RecordReader&) = delete;
128
+ void operator=(const RecordReader&) = delete;
129
+ };
130
+
131
+ // High-level interface to read TFRecord files.
132
+ //
133
+ // Note: this class is not thread safe; external synchronization required.
134
+ class SequentialRecordReader {
135
+ public:
136
+ // Create a reader that will return log records from "*file".
137
+ // "*file" must remain live while this Reader is in use.
138
+ explicit SequentialRecordReader(
139
+ tsl::RandomAccessFile* file,
140
+ const RecordReaderOptions& options = RecordReaderOptions());
141
+
142
+ virtual ~SequentialRecordReader() = default;
143
+
144
+ // Read the next record in the file into *record. Returns OK on success,
145
+ // OUT_OF_RANGE for end of file, or something else for an error.
146
+ Status ReadRecord(tstring* record) {
147
+ return underlying_.ReadRecord(&offset_, record);
148
+ }
149
+
150
+ // Skip the next num_to_skip record in the file. Return OK on success,
151
+ // OUT_OF_RANGE for end of file, or something else for an error.
152
+ // "*num_skipped" records the number of records that are actually skipped.
153
+ // It should be equal to num_to_skip on success.
154
+ Status SkipRecords(int num_to_skip, int* num_skipped) {
155
+ return underlying_.SkipRecords(&offset_, num_to_skip, num_skipped);
156
+ }
157
+
158
+ // Return the current offset in the file.
159
+ uint64 TellOffset() { return offset_; }
160
+
161
+ // Seek to this offset within the file and set this offset as the current
162
+ // offset. Trying to seek backward will throw error.
163
+ Status SeekOffset(uint64 offset) {
164
+ if (offset < offset_)
165
+ return errors::InvalidArgument(
166
+ "Trying to seek offset: ", offset,
167
+ " which is less than the current offset: ", offset_);
168
+ offset_ = offset;
169
+ return OkStatus();
170
+ }
171
+
172
+ private:
173
+ RecordReader underlying_;
174
+ uint64 offset_ = 0;
175
+ };
176
+
177
+ } // namespace io
178
+ } // namespace tsl
179
+
180
+ #endif // TENSORFLOW_TSL_LIB_IO_RECORD_READER_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/record_writer.h ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_IO_RECORD_WRITER_H_
17
+ #define TENSORFLOW_TSL_LIB_IO_RECORD_WRITER_H_
18
+
19
+ #include "tsl/lib/hash/crc32c.h"
20
+ #include "tsl/platform/coding.h"
21
+ #include "tsl/platform/status.h"
22
+ #include "tsl/platform/stringpiece.h"
23
+ #if !defined(IS_SLIM_BUILD)
24
+ #include "tsl/lib/io/snappy/snappy_compression_options.h"
25
+ #include "tsl/lib/io/snappy/snappy_outputbuffer.h"
26
+ #include "tsl/lib/io/zlib_compression_options.h"
27
+ #include "tsl/lib/io/zlib_outputbuffer.h"
28
+ #endif // IS_SLIM_BUILD
29
+ #include "tsl/platform/cord.h"
30
+ #include "tsl/platform/macros.h"
31
+ #include "tsl/platform/types.h"
32
+
33
+ namespace tsl {
34
+
35
+ class WritableFile;
36
+
37
+ namespace io {
38
+
39
+ struct RecordWriterOptions {
40
+ public:
41
+ enum CompressionType {
42
+ NONE = 0,
43
+ ZLIB_COMPRESSION = 1,
44
+ SNAPPY_COMPRESSION = 2
45
+ };
46
+ CompressionType compression_type = NONE;
47
+
48
+ static RecordWriterOptions CreateRecordWriterOptions(
49
+ const string& compression_type);
50
+
51
+ #if !defined(IS_SLIM_BUILD)
52
+ // Options specific to compression.
53
+ io::ZlibCompressionOptions zlib_options;
54
+ io::SnappyCompressionOptions snappy_options;
55
+ #endif // IS_SLIM_BUILD
56
+ };
57
+
58
+ class RecordWriter {
59
+ public:
60
+ // Format of a single record:
61
+ // uint64 length
62
+ // uint32 masked crc of length
63
+ // byte data[length]
64
+ // uint32 masked crc of data
65
+ static constexpr size_t kHeaderSize = sizeof(uint64) + sizeof(uint32);
66
+ static constexpr size_t kFooterSize = sizeof(uint32);
67
+
68
+ // Create a writer that will append data to "*dest".
69
+ // "*dest" must be initially empty.
70
+ // "*dest" must remain live while this Writer is in use.
71
+ explicit RecordWriter(WritableFile* dest, const RecordWriterOptions& options =
72
+ RecordWriterOptions());
73
+
74
+ // Calls Close() and logs if an error occurs.
75
+ //
76
+ // TODO(jhseu): Require that callers explicitly call Close() and remove the
77
+ // implicit Close() call in the destructor.
78
+ ~RecordWriter();
79
+
80
+ Status WriteRecord(StringPiece data);
81
+
82
+ #if defined(TF_CORD_SUPPORT)
83
+ Status WriteRecord(const absl::Cord& data);
84
+ #endif
85
+
86
+ // Flushes any buffered data held by underlying containers of the
87
+ // RecordWriter to the WritableFile. Does *not* flush the
88
+ // WritableFile.
89
+ Status Flush();
90
+
91
+ // Writes all output to the file. Does *not* close the WritableFile.
92
+ //
93
+ // After calling Close(), any further calls to `WriteRecord()` or `Flush()`
94
+ // are invalid.
95
+ Status Close();
96
+
97
+ // Utility method to populate TFRecord headers. Populates record-header in
98
+ // "header[0,kHeaderSize-1]". The record-header is based on data[0, n-1].
99
+ inline static void PopulateHeader(char* header, const char* data, size_t n);
100
+
101
+ #if defined(TF_CORD_SUPPORT)
102
+ inline static void PopulateHeader(char* header, const absl::Cord& data);
103
+ #endif
104
+
105
+ // Utility method to populate TFRecord footers. Populates record-footer in
106
+ // "footer[0,kFooterSize-1]". The record-footer is based on data[0, n-1].
107
+ inline static void PopulateFooter(char* footer, const char* data, size_t n);
108
+
109
+ #if defined(TF_CORD_SUPPORT)
110
+ inline static void PopulateFooter(char* footer, const absl::Cord& data);
111
+ #endif
112
+
113
+ private:
114
+ WritableFile* dest_;
115
+ RecordWriterOptions options_;
116
+
117
+ inline static uint32 MaskedCrc(const char* data, size_t n) {
118
+ return crc32c::Mask(crc32c::Value(data, n));
119
+ }
120
+
121
+ #if defined(TF_CORD_SUPPORT)
122
+ inline static uint32 MaskedCrc(const absl::Cord& data) {
123
+ return crc32c::Mask(crc32c::Value(data));
124
+ }
125
+ #endif
126
+
127
+ RecordWriter(const RecordWriter&) = delete;
128
+ void operator=(const RecordWriter&) = delete;
129
+ };
130
+
131
+ void RecordWriter::PopulateHeader(char* header, const char* data, size_t n) {
132
+ core::EncodeFixed64(header + 0, n);
133
+ core::EncodeFixed32(header + sizeof(uint64),
134
+ MaskedCrc(header, sizeof(uint64)));
135
+ }
136
+
137
+ void RecordWriter::PopulateFooter(char* footer, const char* data, size_t n) {
138
+ core::EncodeFixed32(footer, MaskedCrc(data, n));
139
+ }
140
+
141
+ #if defined(TF_CORD_SUPPORT)
142
+ void RecordWriter::PopulateHeader(char* header, const absl::Cord& data) {
143
+ core::EncodeFixed64(header + 0, data.size());
144
+ core::EncodeFixed32(header + sizeof(uint64),
145
+ MaskedCrc(header, sizeof(uint64)));
146
+ }
147
+
148
+ void RecordWriter::PopulateFooter(char* footer, const absl::Cord& data) {
149
+ core::EncodeFixed32(footer, MaskedCrc(data));
150
+ }
151
+ #endif
152
+
153
+ } // namespace io
154
+ } // namespace tsl
155
+
156
+ #endif // TENSORFLOW_TSL_LIB_IO_RECORD_WRITER_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/snappy/snappy_compression_options.h ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_IO_SNAPPY_SNAPPY_COMPRESSION_OPTIONS_H_
17
+ #define TENSORFLOW_TSL_LIB_IO_SNAPPY_SNAPPY_COMPRESSION_OPTIONS_H_
18
+
19
+ #include "tsl/platform/types.h"
20
+
21
+ namespace tsl {
22
+ namespace io {
23
+
24
+ struct SnappyCompressionOptions {
25
+ // Size of the buffer used for caching the data read from source file.
26
+ int64_t input_buffer_size = 256 << 10;
27
+
28
+ // Size of the sink buffer where the compressed/decompressed data produced by
29
+ // snappy is cached.
30
+ int64_t output_buffer_size = 256 << 10;
31
+ };
32
+
33
+ } // namespace io
34
+ } // namespace tsl
35
+
36
+ #endif // TENSORFLOW_TSL_LIB_IO_SNAPPY_SNAPPY_COMPRESSION_OPTIONS_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/snappy/snappy_inputbuffer.h ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_IO_SNAPPY_SNAPPY_INPUTBUFFER_H_
17
+ #define TENSORFLOW_TSL_LIB_IO_SNAPPY_SNAPPY_INPUTBUFFER_H_
18
+
19
+ #include <memory>
20
+ #include <string>
21
+
22
+ #include "tsl/lib/io/inputstream_interface.h"
23
+ #include "tsl/platform/env.h"
24
+ #include "tsl/platform/macros.h"
25
+ #include "tsl/platform/snappy.h"
26
+ #include "tsl/platform/status.h"
27
+ #include "tsl/platform/types.h"
28
+
29
+ namespace tsl {
30
+ namespace io {
31
+
32
+ // An SnappyInputBuffer provides support for reading from a file compressed
33
+ // using snappy (https://github.com/google/snappy).
34
+ //
35
+ // A given instance of an SnappyInputBuffer is NOT safe for concurrent use
36
+ // by multiple threads
37
+ class SnappyInputBuffer : public InputStreamInterface {
38
+ public:
39
+ // Create a SnappyInputBuffer for `file` with a buffer of size
40
+ // `input_buffer_bytes` bytes for reading contents from `file` and another
41
+ // buffer with size `output_buffer_bytes` for caching decompressed contents.
42
+ // Does *not* take ownership of "file".
43
+ SnappyInputBuffer(RandomAccessFile* file, size_t input_buffer_bytes,
44
+ size_t output_buffer_bytes);
45
+
46
+ // Reads bytes_to_read bytes into *result, overwriting *result.
47
+ //
48
+ // Return Status codes:
49
+ // OK:
50
+ // If successful.
51
+ // OUT_OF_RANGE:
52
+ // If there are not enough bytes to read before the end of the file.
53
+ // DATA_LOSS:
54
+ // If uncompression failed or if the file is corrupted.
55
+ // RESOURCE_EXHAUSTED:
56
+ // If input_buffer_ is smaller in size than a compressed block.
57
+ // others:
58
+ // If reading from file failed.
59
+ Status ReadNBytes(int64_t bytes_to_read, tstring* result) override;
60
+
61
+ int64_t Tell() const override;
62
+
63
+ Status Reset() override;
64
+
65
+ private:
66
+ // Reads data from `file_` and tries to fill up `input_buffer_` if enough
67
+ // unread data is left in `file_`.
68
+ //
69
+ // Looks up `next_in_` to check how much data in `input_buffer_`
70
+ // has already been read. The used data is removed and new data is added to
71
+ // after any unread data in `input_buffer_`.
72
+ // After this call `next_in` points to the start of `input_buffer_`
73
+ // and `avail_in_` stores the number of readable bytes in
74
+ // `input_buffer_`.
75
+ //
76
+ // Returns OutOfRange error if NO data could be read from file. Note that this
77
+ // won't return an OutOfRange if there wasn't sufficient data in file to
78
+ // completely fill up `input_buffer_`.
79
+ Status ReadFromFile();
80
+
81
+ // Reads the length of the next compressed block stored in the next 4 bytes at
82
+ // `next_in_`. Uncompresses the next compressed block and writes the output
83
+ // produced to the output_buffer_.
84
+ // Should be called only after the cached output has been consumed.
85
+ Status Inflate();
86
+
87
+ // Starts reading bytes at `next_out_` until either `bytes_to_read`
88
+ // bytes have been read or `next_out_` is reached.
89
+ // Returns the number of bytes read and advances the `next_out_`
90
+ // pointer to the next location to read from.
91
+ size_t ReadBytesFromCache(size_t bytes_to_read, char* result);
92
+
93
+ // Reads the length of the next *compressed* block and stores in `length`.
94
+ // The length is stored in 4 bytes in little endian notation.
95
+ Status ReadCompressedBlockLength(uint32* length);
96
+
97
+ RandomAccessFile* file_; // Not owned
98
+ int64_t file_pos_ = 0; // Next position to read from in `file_`
99
+ size_t input_buffer_capacity_; // Size of `input_buffer_`.
100
+ // Must be at least as big as the size of
101
+ // the largest compressed block.
102
+ size_t output_buffer_capacity_; // Size of `output_buffer_`
103
+
104
+ // Buffer for storing contents read from compressed file.
105
+ // TODO(srbs): Consider using circular buffers. That would greatly simplify
106
+ // the implementation.
107
+ std::unique_ptr<char[]> input_buffer_;
108
+
109
+ // Buffer for storing inflated contents of `file_`.
110
+ std::unique_ptr<char[]> output_buffer_;
111
+
112
+ // Next unread byte in `input_buffer_`.
113
+ char* next_in_;
114
+
115
+ // Next unread byte in `output_buffer_`
116
+ char* next_out_;
117
+
118
+ // Number of unread bytes available at `next_in_` in `input_buffer_`.
119
+ size_t avail_in_ = 0;
120
+
121
+ // Number of unread bytes available at `next_out_` in `output_buffer_`.
122
+ size_t avail_out_ = 0;
123
+
124
+ // Number of *uncompressed* bytes that have been read from this stream.
125
+ int64_t bytes_read_;
126
+
127
+ SnappyInputBuffer(const SnappyInputBuffer&) = delete;
128
+ void operator=(const SnappyInputBuffer&) = delete;
129
+ };
130
+
131
+ } // namespace io
132
+ } // namespace tsl
133
+
134
+ #endif // TENSORFLOW_TSL_LIB_IO_SNAPPY_SNAPPY_INPUTBUFFER_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/snappy/snappy_inputstream.h ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_IO_SNAPPY_SNAPPY_INPUTSTREAM_H_
17
+ #define TENSORFLOW_TSL_LIB_IO_SNAPPY_SNAPPY_INPUTSTREAM_H_
18
+
19
+ #include <memory>
20
+
21
+ #include "tsl/lib/io/inputstream_interface.h"
22
+
23
+ namespace tsl {
24
+ namespace io {
25
+
26
+ class SnappyInputStream : public InputStreamInterface {
27
+ public:
28
+ // Creates a SnappyInputStream for `input_stream`.
29
+ //
30
+ // Takes ownership of `input_stream` iff `owns_input_stream` is true.
31
+ SnappyInputStream(InputStreamInterface* input_stream,
32
+ size_t output_buffer_bytes, bool owns_input_stream);
33
+
34
+ // Equivalent to the previous constructor with owns_input_stream = false.
35
+ explicit SnappyInputStream(InputStreamInterface* input_stream,
36
+ size_t output_buffer_bytes);
37
+
38
+ ~SnappyInputStream() override;
39
+
40
+ // Reads bytes_to_read bytes into *result, overwriting *result.
41
+ //
42
+ // Return Status codes:
43
+ // OK: If successful.
44
+ // OUT_OF_RANGE: If there are not enough bytes to read before
45
+ // the end of the stream.
46
+ // ABORTED: If inflate() fails, we return the error code with the
47
+ // error message in `z_stream_->msg`.
48
+ // others: If reading from stream failed.
49
+ Status ReadNBytes(int64_t bytes_to_read, tstring* result) override;
50
+
51
+ #if defined(TF_CORD_SUPPORT)
52
+ Status ReadNBytes(int64_t bytes_to_read, absl::Cord* result) override;
53
+ #endif
54
+
55
+ int64_t Tell() const override;
56
+
57
+ Status Reset() override;
58
+
59
+ private:
60
+ // Decompress the next chunk of data and place the data into the cache.
61
+ Status Inflate();
62
+
63
+ // Attempt to read `bytes_to_read` from the decompressed data cache. Returns
64
+ // the actual number of bytes read.
65
+ size_t ReadBytesFromCache(size_t bytes_to_read, char* result);
66
+
67
+ InputStreamInterface* input_stream_;
68
+ const size_t output_buffer_bytes_;
69
+ const bool owns_input_stream_;
70
+
71
+ // Specifies the number of decompressed bytes currently read.
72
+ int64_t bytes_read_;
73
+
74
+ // output_buffer_ contains decompressed data not yet read by the client.
75
+ std::unique_ptr<char[]> output_buffer_;
76
+
77
+ // next_out_ points to the position in the `output_buffer_` that contains the
78
+ // next unread byte.
79
+ char* next_out_;
80
+
81
+ // avail_out_ specifies the number of bytes left in the output_buffers_ that
82
+ // is not yet read.
83
+ size_t avail_out_;
84
+
85
+ SnappyInputStream(const SnappyInputStream&) = delete;
86
+ void operator=(const SnappyInputStream&) = delete;
87
+ };
88
+
89
+ } // namespace io
90
+ } // namespace tsl
91
+
92
+ #endif // TENSORFLOW_TSL_LIB_IO_SNAPPY_SNAPPY_INPUTSTREAM_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/snappy/snappy_outputbuffer.h ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_IO_SNAPPY_SNAPPY_OUTPUTBUFFER_H_
17
+ #define TENSORFLOW_TSL_LIB_IO_SNAPPY_SNAPPY_OUTPUTBUFFER_H_
18
+
19
+ #include <memory>
20
+ #include <string>
21
+
22
+ #include "tsl/platform/env.h"
23
+ #include "tsl/platform/macros.h"
24
+ #include "tsl/platform/platform.h"
25
+ #include "tsl/platform/snappy.h"
26
+ #include "tsl/platform/status.h"
27
+ #include "tsl/platform/types.h"
28
+
29
+ namespace tsl {
30
+ namespace io {
31
+
32
+ // Compresses input data using Snappy (https://github.com/google/snappy) and
33
+ // writes to `file`.
34
+ //
35
+ // The input data is cached in a buffer of size `input_buffer_bytes`. When the
36
+ // buffer does not have enough available space to fit new data (in the call to
37
+ // `Write`), the contents of the buffer are compressed and sent to the output
38
+ // buffer.
39
+ //
40
+ // The compressed output is buffered in a buffer of size `output_buffer_bytes`
41
+ // which gets flushed to file when full.
42
+ //
43
+ // Output file format:
44
+ // The output file consists of a sequence of compressed blocks. Each block
45
+ // starts with a 4 byte header which stores the length (in bytes) of the
46
+ // _compressed_ block _excluding_ this header. The compressed
47
+ // block (excluding the 4 byte header) is a valid snappy block and can directly
48
+ // be uncompressed using Snappy_Uncompress.
49
+ class SnappyOutputBuffer : public WritableFile {
50
+ public:
51
+ // Create an SnappyOutputBuffer for `file` with two buffers that cache the
52
+ // 1. input data to be deflated
53
+ // 2. the deflated output
54
+ // with sizes `input_buffer_bytes` and `output_buffer_bytes` respectively.
55
+ // Does not take ownership of `file`.
56
+ SnappyOutputBuffer(WritableFile* file, int32_t input_buffer_bytes,
57
+ int32_t output_buffer_bytes);
58
+
59
+ // Per convention, the dtor does not call Flush() or Close(). We expect the
60
+ // caller to call those manually when done.
61
+ ~SnappyOutputBuffer() override;
62
+
63
+ // Adds `data` to the compression pipeline.
64
+ //
65
+ // The input data is buffered internally and will be written to disk at a
66
+ // later time. To immediately write contents to file call `Flush()`.
67
+ Status Append(StringPiece data) override;
68
+
69
+ #if defined(TF_CORD_SUPPORT)
70
+ Status Append(const absl::Cord& cord) override;
71
+ #endif
72
+
73
+ // Compresses any buffered input and writes all output to file. This must be
74
+ // called before the destructor to avoid any data loss.
75
+ //
76
+ // Contrary to `Flush()` this informs snappy that it should not expect any
77
+ // further input.
78
+ //
79
+ // After calling this, any further calls to `Write()`, `Flush()` or `Close()`
80
+ // will fail.
81
+ Status Close() override;
82
+
83
+ // Returns the name of the underlying file.
84
+ Status Name(StringPiece* result) const override;
85
+
86
+ // Deflates any cached input, writes all output to file and syncs it.
87
+ Status Sync() override;
88
+
89
+ // Returns the write position in the underlying file. The position does not
90
+ // reflect buffered, un-flushed data.
91
+ Status Tell(int64_t* position) override;
92
+
93
+ // Adds `data` to the compression pipeline.
94
+ //
95
+ // The input data is buffered in `input_buffer_` and is compressed in bulk
96
+ // when the buffer gets full. The compressed output may not be immediately
97
+ // written to file but rather buffered in `output_buffer_` and gets written
98
+ // to file when the buffer is full.
99
+ //
100
+ // To immediately write contents to file call `Flush()`.
101
+ Status Write(StringPiece data);
102
+
103
+ // Compresses any cached input and writes all output to file. This must be
104
+ // called before the destructor to avoid any data loss.
105
+ Status Flush() override;
106
+
107
+ private:
108
+ // Appends `data` to `input_buffer_`.
109
+ // Throws if `data.size()` > AvailableInputSpace().
110
+ void AddToInputBuffer(StringPiece data);
111
+
112
+ // Appends `data` to `output_buffer_`. Flushes buffer contents to file when
113
+ // buffer gets full.
114
+ Status AddToOutputBuffer(const char* data, size_t length);
115
+
116
+ // Returns the total space available in `input_buffer_`.
117
+ int32 AvailableInputSpace() const;
118
+
119
+ // Deflate contents in input_buffer_ and store results in output_buffer_.
120
+ // The contents of output stream are written to file if more space is needed.
121
+ //
122
+ // Note: This method does not flush contents to file.
123
+ // Returns non-ok status if writing contents to file fails.
124
+ Status DeflateBuffered();
125
+
126
+ // Appends contents of `output_buffer_` to `file_`.
127
+ // Returns non-OK status if writing to file fails.
128
+ Status FlushOutputBufferToFile();
129
+
130
+ // Compresses `avail_in_` bytes at `next_in_` location in `input_buffer_` and
131
+ // writes the results to output using `AddToOutputBuffer`.
132
+ // Returns non-OK status if writing to file failed.
133
+ Status Deflate();
134
+
135
+ WritableFile* file_; // Not owned
136
+
137
+ // Buffer for storing contents read from input `file_`.
138
+ // TODO(srbs): Consider using circular buffers. That would greatly simplify
139
+ // the implementation.
140
+ std::unique_ptr<char[]> input_buffer_;
141
+ size_t input_buffer_capacity_;
142
+ char* next_in_;
143
+ size_t avail_in_ = 0;
144
+
145
+ // Buffer for storing deflated contents of `file_`.
146
+ std::unique_ptr<char[]> output_buffer_;
147
+ size_t output_buffer_capacity_;
148
+ char* next_out_;
149
+ size_t avail_out_;
150
+
151
+ SnappyOutputBuffer(const SnappyOutputBuffer&) = delete;
152
+ void operator=(const SnappyOutputBuffer&) = delete;
153
+ };
154
+
155
+ } // namespace io
156
+ } // namespace tsl
157
+
158
+ #endif // TENSORFLOW_TSL_LIB_IO_SNAPPY_SNAPPY_OUTPUTBUFFER_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/table.h ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ #ifndef TENSORFLOW_TSL_LIB_IO_TABLE_H_
17
+ #define TENSORFLOW_TSL_LIB_IO_TABLE_H_
18
+
19
+ #include <stdint.h>
20
+
21
+ #include "tsl/lib/io/iterator.h"
22
+
23
+ namespace tsl {
24
+
25
+ class RandomAccessFile;
26
+
27
+ namespace table {
28
+
29
+ struct Options;
30
+
31
+ // A Table is a sorted map from strings to strings. Tables are
32
+ // immutable and persistent. A Table may be safely accessed from
33
+ // multiple threads without external synchronization.
34
+ class Table {
35
+ public:
36
+ // Attempt to open the table that is stored in bytes [0..file_size)
37
+ // of "file", and read the metadata entries necessary to allow
38
+ // retrieving data from the table.
39
+ //
40
+ // If successful, returns ok and sets "*table" to the newly opened
41
+ // table. The client should delete "*table" when no longer needed.
42
+ // If there was an error while initializing the table, sets "*table"
43
+ // to NULL and returns a non-ok status. Does not take ownership of
44
+ // "*file", but the client must ensure that "file" remains live
45
+ // for the duration of the returned table's lifetime.
46
+ static Status Open(const Options& options, tsl::RandomAccessFile* file,
47
+ uint64 file_size, Table** table);
48
+
49
+ ~Table();
50
+
51
+ // Returns a new iterator over the table contents.
52
+ // The result of NewIterator() is initially invalid (caller must
53
+ // call one of the Seek methods on the iterator before using it).
54
+ Iterator* NewIterator() const;
55
+
56
+ // Given a key, return an approximate byte offset in the file where
57
+ // the data for that key begins (or would begin if the key were
58
+ // present in the file). The returned value is in terms of file
59
+ // bytes, and so includes effects like compression of the underlying data.
60
+ // E.g., the approximate offset of the last key in the table will
61
+ // be close to the file length.
62
+ uint64 ApproximateOffsetOf(const StringPiece& key) const;
63
+
64
+ private:
65
+ struct Rep;
66
+ Rep* rep_;
67
+
68
+ explicit Table(Rep* rep) { rep_ = rep; }
69
+ static Iterator* BlockReader(void*, const StringPiece&);
70
+
71
+ // Calls (*handle_result)(arg, ...) with the entry found after a call
72
+ // to Seek(key). May not make such a call if filter policy says
73
+ // that key is not present.
74
+ Status InternalGet(const StringPiece& key, void* arg,
75
+ void (*handle_result)(void* arg, const StringPiece& k,
76
+ const StringPiece& v));
77
+
78
+ // No copying allowed
79
+ Table(const Table&);
80
+ void operator=(const Table&);
81
+ };
82
+
83
+ } // namespace table
84
+ } // namespace tsl
85
+
86
+ #endif // TENSORFLOW_TSL_LIB_IO_TABLE_H_
videochat2/lib/python3.10/site-packages/tensorflow/include/tsl/lib/io/table_builder.h ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+
16
+ // TableBuilder provides the interface used to build a Table
17
+ // (an immutable and sorted map from keys to values).
18
+ //
19
+ // Multiple threads can invoke const methods on a TableBuilder without
20
+ // external synchronization, but if any of the threads may call a
21
+ // non-const method, all threads accessing the same TableBuilder must use
22
+ // external synchronization.
23
+
24
+ #ifndef TENSORFLOW_TSL_LIB_IO_TABLE_BUILDER_H_
25
+ #define TENSORFLOW_TSL_LIB_IO_TABLE_BUILDER_H_
26
+
27
+ #include <stdint.h>
28
+
29
+ #include "tsl/lib/io/table_options.h"
30
+ #include "tsl/platform/status.h"
31
+ #include "tsl/platform/stringpiece.h"
32
+
33
+ namespace tsl {
34
+ class WritableFile;
35
+ namespace table {
36
+
37
+ class BlockBuilder;
38
+ class BlockHandle;
39
+
40
+ class TableBuilder {
41
+ public:
42
+ // Create a builder that will store the contents of the table it is
43
+ // building in *file. Does not close the file. It is up to the
44
+ // caller to close the file after calling Finish().
45
+ TableBuilder(const Options& options, tsl::WritableFile* file);
46
+
47
+ // REQUIRES: Either Finish() or Abandon() has been called.
48
+ ~TableBuilder();
49
+
50
+ // Add key,value to the table being constructed.
51
+ // REQUIRES: key is after any previously added key in lexicographic order.
52
+ // REQUIRES: Finish(), Abandon() have not been called
53
+ void Add(const StringPiece& key, const StringPiece& value);
54
+
55
+ // Advanced operation: writes any buffered key/value pairs to file.
56
+ // Can be used to ensure that two adjacent entries never live in
57
+ // the same data block. Most clients should not need to use this method.
58
+ // Does not flush the file itself.
59
+ // REQUIRES: Finish(), Abandon() have not been called
60
+ void Flush();
61
+
62
+ // Return non-ok iff some error has been detected.
63
+ Status status() const;
64
+
65
+ // Finish building the table. Stops using the file passed to the
66
+ // constructor after this function returns.
67
+ // REQUIRES: Finish(), Abandon() have not been called
68
+ Status Finish();
69
+
70
+ // Indicate that the contents of this builder should be abandoned. Stops
71
+ // using the file passed to the constructor after this function returns.
72
+ // If the caller is not going to call Finish(), it must call Abandon()
73
+ // before destroying this builder.
74
+ // REQUIRES: Finish(), Abandon() have not been called
75
+ void Abandon();
76
+
77
+ // Number of calls to Add() so far.
78
+ uint64 NumEntries() const;
79
+
80
+ // Size of the file generated so far. If invoked after a successful
81
+ // Finish() call, returns the size of the final generated file.
82
+ uint64 FileSize() const;
83
+
84
+ private:
85
+ bool ok() const { return status().ok(); }
86
+ void WriteBlock(BlockBuilder* block, BlockHandle* handle);
87
+ void WriteRawBlock(const StringPiece& data, CompressionType,
88
+ BlockHandle* handle);
89
+
90
+ struct Rep;
91
+ Rep* rep_;
92
+
93
+ // No copying allowed
94
+ TableBuilder(const TableBuilder&);
95
+ void operator=(const TableBuilder&);
96
+ };
97
+
98
+ } // namespace table
99
+ } // namespace tsl
100
+
101
+ #endif // TENSORFLOW_TSL_LIB_IO_TABLE_BUILDER_H_