ZTWHHH commited on
Commit
a53e768
·
verified ·
1 Parent(s): 8fa4a54

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. evalkit_internvl/lib/python3.10/site-packages/google/logging/type/log_severity.proto +71 -0
  2. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/__init__.cpython-310.pyc +0 -0
  3. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/_client.cpython-310.pyc +0 -0
  4. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/_client_async.cpython-310.pyc +0 -0
  5. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/_credentials_async.cpython-310.pyc +0 -0
  6. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/_id_token_async.cpython-310.pyc +0 -0
  7. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/_reauth_async.cpython-310.pyc +0 -0
  8. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/_service_account_async.cpython-310.pyc +0 -0
  9. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/challenges.cpython-310.pyc +0 -0
  10. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/credentials.cpython-310.pyc +0 -0
  11. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/gdch_credentials.cpython-310.pyc +0 -0
  12. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/id_token.cpython-310.pyc +0 -0
  13. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/reauth.cpython-310.pyc +0 -0
  14. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/service_account.cpython-310.pyc +0 -0
  15. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/sts.cpython-310.pyc +0 -0
  16. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/utils.cpython-310.pyc +0 -0
  17. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/webauthn_handler.cpython-310.pyc +0 -0
  18. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/webauthn_handler_factory.cpython-310.pyc +0 -0
  19. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/webauthn_types.cpython-310.pyc +0 -0
  20. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/_client.py +508 -0
  21. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/_service_account_async.py +132 -0
  22. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/gdch_credentials.py +251 -0
  23. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/service_account.py +847 -0
  24. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/webauthn_handler.py +82 -0
  25. evalkit_internvl/lib/python3.10/site-packages/google/oauth2/webauthn_types.py +156 -0
  26. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_cpu_dispatch.h +24 -0
  27. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/_coalesce_compositeexplicitautograd_dispatch.h +24 -0
  28. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/_cufft_get_plan_cache_size_ops.h +28 -0
  29. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/_functional_sym_constrain_range_native.h +21 -0
  30. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/_logcumsumexp_ops.h +39 -0
  31. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/_pdist_forward_cuda_dispatch.h +23 -0
  32. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/_sparse_sparse_matmul_native.h +23 -0
  33. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/_stack_cpu_dispatch.h +25 -0
  34. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/_transform_bias_rescale_qkv_native.h +23 -0
  35. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/_unique_native.h +23 -0
  36. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/avg_pool2d_meta.h +114 -0
  37. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/avg_pool3d_backward_meta_dispatch.h +25 -0
  38. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/bilinear_native.h +21 -0
  39. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/bmm_cpu_dispatch.h +25 -0
  40. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/ccol_indices_copy_ops.h +39 -0
  41. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/channel_shuffle_cuda_dispatch.h +24 -0
  42. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/clone.h +39 -0
  43. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/copy_sparse_to_sparse.h +44 -0
  44. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/cross_entropy_loss.h +47 -0
  45. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/cummin_ops.h +61 -0
  46. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/fbgemm_linear_fp16_weight_ops.h +28 -0
  47. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/fft_fft.h +91 -0
  48. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/flatten_native.h +24 -0
  49. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/gather_cpu_dispatch.h +25 -0
  50. evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/ge.h +53 -0
evalkit_internvl/lib/python3.10/site-packages/google/logging/type/log_severity.proto ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2025 Google LLC
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
+ syntax = "proto3";
16
+
17
+ package google.logging.type;
18
+
19
+ option csharp_namespace = "Google.Cloud.Logging.Type";
20
+ option go_package = "google.golang.org/genproto/googleapis/logging/type;ltype";
21
+ option java_multiple_files = true;
22
+ option java_outer_classname = "LogSeverityProto";
23
+ option java_package = "com.google.logging.type";
24
+ option objc_class_prefix = "GLOG";
25
+ option php_namespace = "Google\\Cloud\\Logging\\Type";
26
+ option ruby_package = "Google::Cloud::Logging::Type";
27
+
28
+ // The severity of the event described in a log entry, expressed as one of the
29
+ // standard severity levels listed below. For your reference, the levels are
30
+ // assigned the listed numeric values. The effect of using numeric values other
31
+ // than those listed is undefined.
32
+ //
33
+ // You can filter for log entries by severity. For example, the following
34
+ // filter expression will match log entries with severities `INFO`, `NOTICE`,
35
+ // and `WARNING`:
36
+ //
37
+ // severity > DEBUG AND severity <= WARNING
38
+ //
39
+ // If you are writing log entries, you should map other severity encodings to
40
+ // one of these standard levels. For example, you might map all of Java's FINE,
41
+ // FINER, and FINEST levels to `LogSeverity.DEBUG`. You can preserve the
42
+ // original severity level in the log entry payload if you wish.
43
+ enum LogSeverity {
44
+ // (0) The log entry has no assigned severity level.
45
+ DEFAULT = 0;
46
+
47
+ // (100) Debug or trace information.
48
+ DEBUG = 100;
49
+
50
+ // (200) Routine information, such as ongoing status or performance.
51
+ INFO = 200;
52
+
53
+ // (300) Normal but significant events, such as start up, shut down, or
54
+ // a configuration change.
55
+ NOTICE = 300;
56
+
57
+ // (400) Warning events might cause problems.
58
+ WARNING = 400;
59
+
60
+ // (500) Error events are likely to cause problems.
61
+ ERROR = 500;
62
+
63
+ // (600) Critical events cause more severe problems or outages.
64
+ CRITICAL = 600;
65
+
66
+ // (700) A person must take an action immediately.
67
+ ALERT = 700;
68
+
69
+ // (800) One or more systems are unusable.
70
+ EMERGENCY = 800;
71
+ }
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (806 Bytes). View file
 
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/_client.cpython-310.pyc ADDED
Binary file (14 kB). View file
 
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/_client_async.cpython-310.pyc ADDED
Binary file (8.34 kB). View file
 
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/_credentials_async.cpython-310.pyc ADDED
Binary file (3.59 kB). View file
 
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/_id_token_async.cpython-310.pyc ADDED
Binary file (8.57 kB). View file
 
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/_reauth_async.cpython-310.pyc ADDED
Binary file (9.05 kB). View file
 
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/_service_account_async.cpython-310.pyc ADDED
Binary file (4.64 kB). View file
 
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/challenges.cpython-310.pyc ADDED
Binary file (8.5 kB). View file
 
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/credentials.cpython-310.pyc ADDED
Binary file (20.2 kB). View file
 
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/gdch_credentials.cpython-310.pyc ADDED
Binary file (7.87 kB). View file
 
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/id_token.cpython-310.pyc ADDED
Binary file (11.2 kB). View file
 
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/reauth.cpython-310.pyc ADDED
Binary file (9.83 kB). View file
 
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/service_account.cpython-310.pyc ADDED
Binary file (26.4 kB). View file
 
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/sts.cpython-310.pyc ADDED
Binary file (5.33 kB). View file
 
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/utils.cpython-310.pyc ADDED
Binary file (5.53 kB). View file
 
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/webauthn_handler.cpython-310.pyc ADDED
Binary file (3.11 kB). View file
 
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/webauthn_handler_factory.cpython-310.pyc ADDED
Binary file (937 Bytes). View file
 
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/__pycache__/webauthn_types.cpython-310.pyc ADDED
Binary file (5.62 kB). View file
 
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/_client.py ADDED
@@ -0,0 +1,508 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2016 Google LLC
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
+ """OAuth 2.0 client.
16
+
17
+ This is a client for interacting with an OAuth 2.0 authorization server's
18
+ token endpoint.
19
+
20
+ For more information about the token endpoint, see
21
+ `Section 3.1 of rfc6749`_
22
+
23
+ .. _Section 3.1 of rfc6749: https://tools.ietf.org/html/rfc6749#section-3.2
24
+ """
25
+
26
+ import datetime
27
+ import http.client as http_client
28
+ import json
29
+ import urllib
30
+
31
+ from google.auth import _exponential_backoff
32
+ from google.auth import _helpers
33
+ from google.auth import credentials
34
+ from google.auth import exceptions
35
+ from google.auth import jwt
36
+ from google.auth import metrics
37
+ from google.auth import transport
38
+
39
+ _URLENCODED_CONTENT_TYPE = "application/x-www-form-urlencoded"
40
+ _JSON_CONTENT_TYPE = "application/json"
41
+ _JWT_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:jwt-bearer"
42
+ _REFRESH_GRANT_TYPE = "refresh_token"
43
+
44
+
45
+ def _handle_error_response(response_data, retryable_error):
46
+ """Translates an error response into an exception.
47
+
48
+ Args:
49
+ response_data (Mapping | str): The decoded response data.
50
+ retryable_error Optional[bool]: A boolean indicating if an error is retryable.
51
+ Defaults to False.
52
+
53
+ Raises:
54
+ google.auth.exceptions.RefreshError: The errors contained in response_data.
55
+ """
56
+
57
+ retryable_error = retryable_error if retryable_error else False
58
+
59
+ if isinstance(response_data, str):
60
+ raise exceptions.RefreshError(response_data, retryable=retryable_error)
61
+ try:
62
+ error_details = "{}: {}".format(
63
+ response_data["error"], response_data.get("error_description")
64
+ )
65
+ # If no details could be extracted, use the response data.
66
+ except (KeyError, ValueError):
67
+ error_details = json.dumps(response_data)
68
+
69
+ raise exceptions.RefreshError(
70
+ error_details, response_data, retryable=retryable_error
71
+ )
72
+
73
+
74
+ def _can_retry(status_code, response_data):
75
+ """Checks if a request can be retried by inspecting the status code
76
+ and response body of the request.
77
+
78
+ Args:
79
+ status_code (int): The response status code.
80
+ response_data (Mapping | str): The decoded response data.
81
+
82
+ Returns:
83
+ bool: True if the response is retryable. False otherwise.
84
+ """
85
+ if status_code in transport.DEFAULT_RETRYABLE_STATUS_CODES:
86
+ return True
87
+
88
+ try:
89
+ # For a failed response, response_body could be a string
90
+ error_desc = response_data.get("error_description") or ""
91
+ error_code = response_data.get("error") or ""
92
+
93
+ if not isinstance(error_code, str) or not isinstance(error_desc, str):
94
+ return False
95
+
96
+ # Per Oauth 2.0 RFC https://www.rfc-editor.org/rfc/rfc6749.html#section-4.1.2.1
97
+ # This is needed because a redirect will not return a 500 status code.
98
+ retryable_error_descriptions = {
99
+ "internal_failure",
100
+ "server_error",
101
+ "temporarily_unavailable",
102
+ }
103
+
104
+ if any(e in retryable_error_descriptions for e in (error_code, error_desc)):
105
+ return True
106
+
107
+ except AttributeError:
108
+ pass
109
+
110
+ return False
111
+
112
+
113
+ def _parse_expiry(response_data):
114
+ """Parses the expiry field from a response into a datetime.
115
+
116
+ Args:
117
+ response_data (Mapping): The JSON-parsed response data.
118
+
119
+ Returns:
120
+ Optional[datetime]: The expiration or ``None`` if no expiration was
121
+ specified.
122
+ """
123
+ expires_in = response_data.get("expires_in", None)
124
+
125
+ if expires_in is not None:
126
+ # Some services do not respect the OAUTH2.0 RFC and send expires_in as a
127
+ # JSON String.
128
+ if isinstance(expires_in, str):
129
+ expires_in = int(expires_in)
130
+
131
+ return _helpers.utcnow() + datetime.timedelta(seconds=expires_in)
132
+ else:
133
+ return None
134
+
135
+
136
+ def _token_endpoint_request_no_throw(
137
+ request,
138
+ token_uri,
139
+ body,
140
+ access_token=None,
141
+ use_json=False,
142
+ can_retry=True,
143
+ headers=None,
144
+ **kwargs
145
+ ):
146
+ """Makes a request to the OAuth 2.0 authorization server's token endpoint.
147
+ This function doesn't throw on response errors.
148
+
149
+ Args:
150
+ request (google.auth.transport.Request): A callable used to make
151
+ HTTP requests.
152
+ token_uri (str): The OAuth 2.0 authorizations server's token endpoint
153
+ URI.
154
+ body (Mapping[str, str]): The parameters to send in the request body.
155
+ access_token (Optional(str)): The access token needed to make the request.
156
+ use_json (Optional(bool)): Use urlencoded format or json format for the
157
+ content type. The default value is False.
158
+ can_retry (bool): Enable or disable request retry behavior.
159
+ headers (Optional[Mapping[str, str]]): The headers for the request.
160
+ kwargs: Additional arguments passed on to the request method. The
161
+ kwargs will be passed to `requests.request` method, see:
162
+ https://docs.python-requests.org/en/latest/api/#requests.request.
163
+ For example, you can use `cert=("cert_pem_path", "key_pem_path")`
164
+ to set up client side SSL certificate, and use
165
+ `verify="ca_bundle_path"` to set up the CA certificates for sever
166
+ side SSL certificate verification.
167
+
168
+ Returns:
169
+ Tuple(bool, Mapping[str, str], Optional[bool]): A boolean indicating
170
+ if the request is successful, a mapping for the JSON-decoded response
171
+ data and in the case of an error a boolean indicating if the error
172
+ is retryable.
173
+ """
174
+ if use_json:
175
+ headers_to_use = {"Content-Type": _JSON_CONTENT_TYPE}
176
+ body = json.dumps(body).encode("utf-8")
177
+ else:
178
+ headers_to_use = {"Content-Type": _URLENCODED_CONTENT_TYPE}
179
+ body = urllib.parse.urlencode(body).encode("utf-8")
180
+
181
+ if access_token:
182
+ headers_to_use["Authorization"] = "Bearer {}".format(access_token)
183
+
184
+ if headers:
185
+ headers_to_use.update(headers)
186
+
187
+ response_data = {}
188
+ retryable_error = False
189
+
190
+ retries = _exponential_backoff.ExponentialBackoff()
191
+ for _ in retries:
192
+ response = request(
193
+ method="POST", url=token_uri, headers=headers_to_use, body=body, **kwargs
194
+ )
195
+ response_body = (
196
+ response.data.decode("utf-8")
197
+ if hasattr(response.data, "decode")
198
+ else response.data
199
+ )
200
+
201
+ try:
202
+ # response_body should be a JSON
203
+ response_data = json.loads(response_body)
204
+ except ValueError:
205
+ response_data = response_body
206
+
207
+ if response.status == http_client.OK:
208
+ return True, response_data, None
209
+
210
+ retryable_error = _can_retry(
211
+ status_code=response.status, response_data=response_data
212
+ )
213
+
214
+ if not can_retry or not retryable_error:
215
+ return False, response_data, retryable_error
216
+
217
+ return False, response_data, retryable_error
218
+
219
+
220
+ def _token_endpoint_request(
221
+ request,
222
+ token_uri,
223
+ body,
224
+ access_token=None,
225
+ use_json=False,
226
+ can_retry=True,
227
+ headers=None,
228
+ **kwargs
229
+ ):
230
+ """Makes a request to the OAuth 2.0 authorization server's token endpoint.
231
+
232
+ Args:
233
+ request (google.auth.transport.Request): A callable used to make
234
+ HTTP requests.
235
+ token_uri (str): The OAuth 2.0 authorizations server's token endpoint
236
+ URI.
237
+ body (Mapping[str, str]): The parameters to send in the request body.
238
+ access_token (Optional(str)): The access token needed to make the request.
239
+ use_json (Optional(bool)): Use urlencoded format or json format for the
240
+ content type. The default value is False.
241
+ can_retry (bool): Enable or disable request retry behavior.
242
+ headers (Optional[Mapping[str, str]]): The headers for the request.
243
+ kwargs: Additional arguments passed on to the request method. The
244
+ kwargs will be passed to `requests.request` method, see:
245
+ https://docs.python-requests.org/en/latest/api/#requests.request.
246
+ For example, you can use `cert=("cert_pem_path", "key_pem_path")`
247
+ to set up client side SSL certificate, and use
248
+ `verify="ca_bundle_path"` to set up the CA certificates for sever
249
+ side SSL certificate verification.
250
+
251
+ Returns:
252
+ Mapping[str, str]: The JSON-decoded response data.
253
+
254
+ Raises:
255
+ google.auth.exceptions.RefreshError: If the token endpoint returned
256
+ an error.
257
+ """
258
+
259
+ response_status_ok, response_data, retryable_error = _token_endpoint_request_no_throw(
260
+ request,
261
+ token_uri,
262
+ body,
263
+ access_token=access_token,
264
+ use_json=use_json,
265
+ can_retry=can_retry,
266
+ headers=headers,
267
+ **kwargs
268
+ )
269
+ if not response_status_ok:
270
+ _handle_error_response(response_data, retryable_error)
271
+ return response_data
272
+
273
+
274
+ def jwt_grant(request, token_uri, assertion, can_retry=True):
275
+ """Implements the JWT Profile for OAuth 2.0 Authorization Grants.
276
+
277
+ For more details, see `rfc7523 section 4`_.
278
+
279
+ Args:
280
+ request (google.auth.transport.Request): A callable used to make
281
+ HTTP requests.
282
+ token_uri (str): The OAuth 2.0 authorizations server's token endpoint
283
+ URI.
284
+ assertion (str): The OAuth 2.0 assertion.
285
+ can_retry (bool): Enable or disable request retry behavior.
286
+
287
+ Returns:
288
+ Tuple[str, Optional[datetime], Mapping[str, str]]: The access token,
289
+ expiration, and additional data returned by the token endpoint.
290
+
291
+ Raises:
292
+ google.auth.exceptions.RefreshError: If the token endpoint returned
293
+ an error.
294
+
295
+ .. _rfc7523 section 4: https://tools.ietf.org/html/rfc7523#section-4
296
+ """
297
+ body = {"assertion": assertion, "grant_type": _JWT_GRANT_TYPE}
298
+
299
+ response_data = _token_endpoint_request(
300
+ request,
301
+ token_uri,
302
+ body,
303
+ can_retry=can_retry,
304
+ headers={
305
+ metrics.API_CLIENT_HEADER: metrics.token_request_access_token_sa_assertion()
306
+ },
307
+ )
308
+
309
+ try:
310
+ access_token = response_data["access_token"]
311
+ except KeyError as caught_exc:
312
+ new_exc = exceptions.RefreshError(
313
+ "No access token in response.", response_data, retryable=False
314
+ )
315
+ raise new_exc from caught_exc
316
+
317
+ expiry = _parse_expiry(response_data)
318
+
319
+ return access_token, expiry, response_data
320
+
321
+
322
+ def call_iam_generate_id_token_endpoint(
323
+ request,
324
+ iam_id_token_endpoint,
325
+ signer_email,
326
+ audience,
327
+ access_token,
328
+ universe_domain=credentials.DEFAULT_UNIVERSE_DOMAIN,
329
+ ):
330
+ """Call iam.generateIdToken endpoint to get ID token.
331
+
332
+ Args:
333
+ request (google.auth.transport.Request): A callable used to make
334
+ HTTP requests.
335
+ iam_id_token_endpoint (str): The IAM ID token endpoint to use.
336
+ signer_email (str): The signer email used to form the IAM
337
+ generateIdToken endpoint.
338
+ audience (str): The audience for the ID token.
339
+ access_token (str): The access token used to call the IAM endpoint.
340
+
341
+ Returns:
342
+ Tuple[str, datetime]: The ID token and expiration.
343
+ """
344
+ body = {"audience": audience, "includeEmail": "true", "useEmailAzp": "true"}
345
+
346
+ response_data = _token_endpoint_request(
347
+ request,
348
+ iam_id_token_endpoint.replace(
349
+ credentials.DEFAULT_UNIVERSE_DOMAIN, universe_domain
350
+ ).format(signer_email),
351
+ body,
352
+ access_token=access_token,
353
+ use_json=True,
354
+ )
355
+
356
+ try:
357
+ id_token = response_data["token"]
358
+ except KeyError as caught_exc:
359
+ new_exc = exceptions.RefreshError(
360
+ "No ID token in response.", response_data, retryable=False
361
+ )
362
+ raise new_exc from caught_exc
363
+
364
+ payload = jwt.decode(id_token, verify=False)
365
+ expiry = datetime.datetime.utcfromtimestamp(payload["exp"])
366
+
367
+ return id_token, expiry
368
+
369
+
370
+ def id_token_jwt_grant(request, token_uri, assertion, can_retry=True):
371
+ """Implements the JWT Profile for OAuth 2.0 Authorization Grants, but
372
+ requests an OpenID Connect ID Token instead of an access token.
373
+
374
+ This is a variant on the standard JWT Profile that is currently unique
375
+ to Google. This was added for the benefit of authenticating to services
376
+ that require ID Tokens instead of access tokens or JWT bearer tokens.
377
+
378
+ Args:
379
+ request (google.auth.transport.Request): A callable used to make
380
+ HTTP requests.
381
+ token_uri (str): The OAuth 2.0 authorization server's token endpoint
382
+ URI.
383
+ assertion (str): JWT token signed by a service account. The token's
384
+ payload must include a ``target_audience`` claim.
385
+ can_retry (bool): Enable or disable request retry behavior.
386
+
387
+ Returns:
388
+ Tuple[str, Optional[datetime], Mapping[str, str]]:
389
+ The (encoded) Open ID Connect ID Token, expiration, and additional
390
+ data returned by the endpoint.
391
+
392
+ Raises:
393
+ google.auth.exceptions.RefreshError: If the token endpoint returned
394
+ an error.
395
+ """
396
+ body = {"assertion": assertion, "grant_type": _JWT_GRANT_TYPE}
397
+
398
+ response_data = _token_endpoint_request(
399
+ request,
400
+ token_uri,
401
+ body,
402
+ can_retry=can_retry,
403
+ headers={
404
+ metrics.API_CLIENT_HEADER: metrics.token_request_id_token_sa_assertion()
405
+ },
406
+ )
407
+
408
+ try:
409
+ id_token = response_data["id_token"]
410
+ except KeyError as caught_exc:
411
+ new_exc = exceptions.RefreshError(
412
+ "No ID token in response.", response_data, retryable=False
413
+ )
414
+ raise new_exc from caught_exc
415
+
416
+ payload = jwt.decode(id_token, verify=False)
417
+ expiry = datetime.datetime.utcfromtimestamp(payload["exp"])
418
+
419
+ return id_token, expiry, response_data
420
+
421
+
422
+ def _handle_refresh_grant_response(response_data, refresh_token):
423
+ """Extract tokens from refresh grant response.
424
+
425
+ Args:
426
+ response_data (Mapping[str, str]): Refresh grant response data.
427
+ refresh_token (str): Current refresh token.
428
+
429
+ Returns:
430
+ Tuple[str, str, Optional[datetime], Mapping[str, str]]: The access token,
431
+ refresh token, expiration, and additional data returned by the token
432
+ endpoint. If response_data doesn't have refresh token, then the current
433
+ refresh token will be returned.
434
+
435
+ Raises:
436
+ google.auth.exceptions.RefreshError: If the token endpoint returned
437
+ an error.
438
+ """
439
+ try:
440
+ access_token = response_data["access_token"]
441
+ except KeyError as caught_exc:
442
+ new_exc = exceptions.RefreshError(
443
+ "No access token in response.", response_data, retryable=False
444
+ )
445
+ raise new_exc from caught_exc
446
+
447
+ refresh_token = response_data.get("refresh_token", refresh_token)
448
+ expiry = _parse_expiry(response_data)
449
+
450
+ return access_token, refresh_token, expiry, response_data
451
+
452
+
453
+ def refresh_grant(
454
+ request,
455
+ token_uri,
456
+ refresh_token,
457
+ client_id,
458
+ client_secret,
459
+ scopes=None,
460
+ rapt_token=None,
461
+ can_retry=True,
462
+ ):
463
+ """Implements the OAuth 2.0 refresh token grant.
464
+
465
+ For more details, see `rfc678 section 6`_.
466
+
467
+ Args:
468
+ request (google.auth.transport.Request): A callable used to make
469
+ HTTP requests.
470
+ token_uri (str): The OAuth 2.0 authorizations server's token endpoint
471
+ URI.
472
+ refresh_token (str): The refresh token to use to get a new access
473
+ token.
474
+ client_id (str): The OAuth 2.0 application's client ID.
475
+ client_secret (str): The Oauth 2.0 appliaction's client secret.
476
+ scopes (Optional(Sequence[str])): Scopes to request. If present, all
477
+ scopes must be authorized for the refresh token. Useful if refresh
478
+ token has a wild card scope (e.g.
479
+ 'https://www.googleapis.com/auth/any-api').
480
+ rapt_token (Optional(str)): The reauth Proof Token.
481
+ can_retry (bool): Enable or disable request retry behavior.
482
+
483
+ Returns:
484
+ Tuple[str, str, Optional[datetime], Mapping[str, str]]: The access
485
+ token, new or current refresh token, expiration, and additional data
486
+ returned by the token endpoint.
487
+
488
+ Raises:
489
+ google.auth.exceptions.RefreshError: If the token endpoint returned
490
+ an error.
491
+
492
+ .. _rfc6748 section 6: https://tools.ietf.org/html/rfc6749#section-6
493
+ """
494
+ body = {
495
+ "grant_type": _REFRESH_GRANT_TYPE,
496
+ "client_id": client_id,
497
+ "client_secret": client_secret,
498
+ "refresh_token": refresh_token,
499
+ }
500
+ if scopes:
501
+ body["scope"] = " ".join(scopes)
502
+ if rapt_token:
503
+ body["rapt"] = rapt_token
504
+
505
+ response_data = _token_endpoint_request(
506
+ request, token_uri, body, can_retry=can_retry
507
+ )
508
+ return _handle_refresh_grant_response(response_data, refresh_token)
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/_service_account_async.py ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2020 Google LLC
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
+ """Service Accounts: JSON Web Token (JWT) Profile for OAuth 2.0
16
+
17
+ NOTE: This file adds asynchronous refresh methods to both credentials
18
+ classes, and therefore async/await syntax is required when calling this
19
+ method when using service account credentials with asynchronous functionality.
20
+ Otherwise, all other methods are inherited from the regular service account
21
+ credentials file google.oauth2.service_account
22
+
23
+ """
24
+
25
+ from google.auth import _credentials_async as credentials_async
26
+ from google.auth import _helpers
27
+ from google.oauth2 import _client_async
28
+ from google.oauth2 import service_account
29
+
30
+
31
+ class Credentials(
32
+ service_account.Credentials, credentials_async.Scoped, credentials_async.Credentials
33
+ ):
34
+ """Service account credentials
35
+
36
+ Usually, you'll create these credentials with one of the helper
37
+ constructors. To create credentials using a Google service account
38
+ private key JSON file::
39
+
40
+ credentials = _service_account_async.Credentials.from_service_account_file(
41
+ 'service-account.json')
42
+
43
+ Or if you already have the service account file loaded::
44
+
45
+ service_account_info = json.load(open('service_account.json'))
46
+ credentials = _service_account_async.Credentials.from_service_account_info(
47
+ service_account_info)
48
+
49
+ Both helper methods pass on arguments to the constructor, so you can
50
+ specify additional scopes and a subject if necessary::
51
+
52
+ credentials = _service_account_async.Credentials.from_service_account_file(
53
+ 'service-account.json',
54
+ scopes=['email'],
55
+ subject='user@example.com')
56
+
57
+ The credentials are considered immutable. If you want to modify the scopes
58
+ or the subject used for delegation, use :meth:`with_scopes` or
59
+ :meth:`with_subject`::
60
+
61
+ scoped_credentials = credentials.with_scopes(['email'])
62
+ delegated_credentials = credentials.with_subject(subject)
63
+
64
+ To add a quota project, use :meth:`with_quota_project`::
65
+
66
+ credentials = credentials.with_quota_project('myproject-123')
67
+ """
68
+
69
+ @_helpers.copy_docstring(credentials_async.Credentials)
70
+ async def refresh(self, request):
71
+ assertion = self._make_authorization_grant_assertion()
72
+ access_token, expiry, _ = await _client_async.jwt_grant(
73
+ request, self._token_uri, assertion
74
+ )
75
+ self.token = access_token
76
+ self.expiry = expiry
77
+
78
+
79
+ class IDTokenCredentials(
80
+ service_account.IDTokenCredentials,
81
+ credentials_async.Signing,
82
+ credentials_async.Credentials,
83
+ ):
84
+ """Open ID Connect ID Token-based service account credentials.
85
+
86
+ These credentials are largely similar to :class:`.Credentials`, but instead
87
+ of using an OAuth 2.0 Access Token as the bearer token, they use an Open
88
+ ID Connect ID Token as the bearer token. These credentials are useful when
89
+ communicating to services that require ID Tokens and can not accept access
90
+ tokens.
91
+
92
+ Usually, you'll create these credentials with one of the helper
93
+ constructors. To create credentials using a Google service account
94
+ private key JSON file::
95
+
96
+ credentials = (
97
+ _service_account_async.IDTokenCredentials.from_service_account_file(
98
+ 'service-account.json'))
99
+
100
+ Or if you already have the service account file loaded::
101
+
102
+ service_account_info = json.load(open('service_account.json'))
103
+ credentials = (
104
+ _service_account_async.IDTokenCredentials.from_service_account_info(
105
+ service_account_info))
106
+
107
+ Both helper methods pass on arguments to the constructor, so you can
108
+ specify additional scopes and a subject if necessary::
109
+
110
+ credentials = (
111
+ _service_account_async.IDTokenCredentials.from_service_account_file(
112
+ 'service-account.json',
113
+ scopes=['email'],
114
+ subject='user@example.com'))
115
+
116
+ The credentials are considered immutable. If you want to modify the scopes
117
+ or the subject used for delegation, use :meth:`with_scopes` or
118
+ :meth:`with_subject`::
119
+
120
+ scoped_credentials = credentials.with_scopes(['email'])
121
+ delegated_credentials = credentials.with_subject(subject)
122
+
123
+ """
124
+
125
+ @_helpers.copy_docstring(credentials_async.Credentials)
126
+ async def refresh(self, request):
127
+ assertion = self._make_authorization_grant_assertion()
128
+ access_token, expiry, _ = await _client_async.id_token_jwt_grant(
129
+ request, self._token_uri, assertion
130
+ )
131
+ self.token = access_token
132
+ self.expiry = expiry
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/gdch_credentials.py ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2022 Google LLC
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
+ """Experimental GDCH credentials support.
16
+ """
17
+
18
+ import datetime
19
+
20
+ from google.auth import _helpers
21
+ from google.auth import _service_account_info
22
+ from google.auth import credentials
23
+ from google.auth import exceptions
24
+ from google.auth import jwt
25
+ from google.oauth2 import _client
26
+
27
+
28
+ TOKEN_EXCHANGE_TYPE = "urn:ietf:params:oauth:token-type:token-exchange"
29
+ ACCESS_TOKEN_TOKEN_TYPE = "urn:ietf:params:oauth:token-type:access_token"
30
+ SERVICE_ACCOUNT_TOKEN_TYPE = "urn:k8s:params:oauth:token-type:serviceaccount"
31
+ JWT_LIFETIME = datetime.timedelta(seconds=3600) # 1 hour
32
+
33
+
34
+ class ServiceAccountCredentials(credentials.Credentials):
35
+ """Credentials for GDCH (`Google Distributed Cloud Hosted`_) for service
36
+ account users.
37
+
38
+ .. _Google Distributed Cloud Hosted:
39
+ https://cloud.google.com/blog/topics/hybrid-cloud/\
40
+ announcing-google-distributed-cloud-edge-and-hosted
41
+
42
+ To create a GDCH service account credential, first create a JSON file of
43
+ the following format::
44
+
45
+ {
46
+ "type": "gdch_service_account",
47
+ "format_version": "1",
48
+ "project": "<project name>",
49
+ "private_key_id": "<key id>",
50
+ "private_key": "-----BEGIN EC PRIVATE KEY-----\n<key bytes>\n-----END EC PRIVATE KEY-----\n",
51
+ "name": "<service identity name>",
52
+ "ca_cert_path": "<CA cert path>",
53
+ "token_uri": "https://service-identity.<Domain>/authenticate"
54
+ }
55
+
56
+ The "format_version" field stands for the format of the JSON file. For now
57
+ it is always "1". The `private_key_id` and `private_key` is used for signing.
58
+ The `ca_cert_path` is used for token server TLS certificate verification.
59
+
60
+ After the JSON file is created, set `GOOGLE_APPLICATION_CREDENTIALS` environment
61
+ variable to the JSON file path, then use the following code to create the
62
+ credential::
63
+
64
+ import google.auth
65
+
66
+ credential, _ = google.auth.default()
67
+ credential = credential.with_gdch_audience("<the audience>")
68
+
69
+ We can also create the credential directly::
70
+
71
+ from google.oauth import gdch_credentials
72
+
73
+ credential = gdch_credentials.ServiceAccountCredentials.from_service_account_file("<the json file path>")
74
+ credential = credential.with_gdch_audience("<the audience>")
75
+
76
+ The token is obtained in the following way. This class first creates a
77
+ self signed JWT. It uses the `name` value as the `iss` and `sub` claim, and
78
+ the `token_uri` as the `aud` claim, and signs the JWT with the `private_key`.
79
+ It then sends the JWT to the `token_uri` to exchange a final token for
80
+ `audience`.
81
+ """
82
+
83
+ def __init__(
84
+ self, signer, service_identity_name, project, audience, token_uri, ca_cert_path
85
+ ):
86
+ """
87
+ Args:
88
+ signer (google.auth.crypt.Signer): The signer used to sign JWTs.
89
+ service_identity_name (str): The service identity name. It will be
90
+ used as the `iss` and `sub` claim in the self signed JWT.
91
+ project (str): The project.
92
+ audience (str): The audience for the final token.
93
+ token_uri (str): The token server uri.
94
+ ca_cert_path (str): The CA cert path for token server side TLS
95
+ certificate verification. If the token server uses well known
96
+ CA, then this parameter can be `None`.
97
+ """
98
+ super(ServiceAccountCredentials, self).__init__()
99
+ self._signer = signer
100
+ self._service_identity_name = service_identity_name
101
+ self._project = project
102
+ self._audience = audience
103
+ self._token_uri = token_uri
104
+ self._ca_cert_path = ca_cert_path
105
+
106
+ def _create_jwt(self):
107
+ now = _helpers.utcnow()
108
+ expiry = now + JWT_LIFETIME
109
+ iss_sub_value = "system:serviceaccount:{}:{}".format(
110
+ self._project, self._service_identity_name
111
+ )
112
+
113
+ payload = {
114
+ "iss": iss_sub_value,
115
+ "sub": iss_sub_value,
116
+ "aud": self._token_uri,
117
+ "iat": _helpers.datetime_to_secs(now),
118
+ "exp": _helpers.datetime_to_secs(expiry),
119
+ }
120
+
121
+ return _helpers.from_bytes(jwt.encode(self._signer, payload))
122
+
123
+ @_helpers.copy_docstring(credentials.Credentials)
124
+ def refresh(self, request):
125
+ import google.auth.transport.requests
126
+
127
+ if not isinstance(request, google.auth.transport.requests.Request):
128
+ raise exceptions.RefreshError(
129
+ "For GDCH service account credentials, request must be a google.auth.transport.requests.Request object"
130
+ )
131
+
132
+ # Create a self signed JWT, and do token exchange.
133
+ jwt_token = self._create_jwt()
134
+ request_body = {
135
+ "grant_type": TOKEN_EXCHANGE_TYPE,
136
+ "audience": self._audience,
137
+ "requested_token_type": ACCESS_TOKEN_TOKEN_TYPE,
138
+ "subject_token": jwt_token,
139
+ "subject_token_type": SERVICE_ACCOUNT_TOKEN_TYPE,
140
+ }
141
+ response_data = _client._token_endpoint_request(
142
+ request,
143
+ self._token_uri,
144
+ request_body,
145
+ access_token=None,
146
+ use_json=True,
147
+ verify=self._ca_cert_path,
148
+ )
149
+
150
+ self.token, _, self.expiry, _ = _client._handle_refresh_grant_response(
151
+ response_data, None
152
+ )
153
+
154
+ def with_gdch_audience(self, audience):
155
+ """Create a copy of GDCH credentials with the specified audience.
156
+
157
+ Args:
158
+ audience (str): The intended audience for GDCH credentials.
159
+ """
160
+ return self.__class__(
161
+ self._signer,
162
+ self._service_identity_name,
163
+ self._project,
164
+ audience,
165
+ self._token_uri,
166
+ self._ca_cert_path,
167
+ )
168
+
169
+ @classmethod
170
+ def _from_signer_and_info(cls, signer, info):
171
+ """Creates a Credentials instance from a signer and service account
172
+ info.
173
+
174
+ Args:
175
+ signer (google.auth.crypt.Signer): The signer used to sign JWTs.
176
+ info (Mapping[str, str]): The service account info.
177
+
178
+ Returns:
179
+ google.oauth2.gdch_credentials.ServiceAccountCredentials: The constructed
180
+ credentials.
181
+
182
+ Raises:
183
+ ValueError: If the info is not in the expected format.
184
+ """
185
+ if info["format_version"] != "1":
186
+ raise ValueError("Only format version 1 is supported")
187
+
188
+ return cls(
189
+ signer,
190
+ info["name"], # service_identity_name
191
+ info["project"],
192
+ None, # audience
193
+ info["token_uri"],
194
+ info.get("ca_cert_path", None),
195
+ )
196
+
197
+ @classmethod
198
+ def from_service_account_info(cls, info):
199
+ """Creates a Credentials instance from parsed service account info.
200
+
201
+ Args:
202
+ info (Mapping[str, str]): The service account info in Google
203
+ format.
204
+ kwargs: Additional arguments to pass to the constructor.
205
+
206
+ Returns:
207
+ google.oauth2.gdch_credentials.ServiceAccountCredentials: The constructed
208
+ credentials.
209
+
210
+ Raises:
211
+ ValueError: If the info is not in the expected format.
212
+ """
213
+ signer = _service_account_info.from_dict(
214
+ info,
215
+ require=[
216
+ "format_version",
217
+ "private_key_id",
218
+ "private_key",
219
+ "name",
220
+ "project",
221
+ "token_uri",
222
+ ],
223
+ use_rsa_signer=False,
224
+ )
225
+ return cls._from_signer_and_info(signer, info)
226
+
227
+ @classmethod
228
+ def from_service_account_file(cls, filename):
229
+ """Creates a Credentials instance from a service account json file.
230
+
231
+ Args:
232
+ filename (str): The path to the service account json file.
233
+ kwargs: Additional arguments to pass to the constructor.
234
+
235
+ Returns:
236
+ google.oauth2.gdch_credentials.ServiceAccountCredentials: The constructed
237
+ credentials.
238
+ """
239
+ info, signer = _service_account_info.from_filename(
240
+ filename,
241
+ require=[
242
+ "format_version",
243
+ "private_key_id",
244
+ "private_key",
245
+ "name",
246
+ "project",
247
+ "token_uri",
248
+ ],
249
+ use_rsa_signer=False,
250
+ )
251
+ return cls._from_signer_and_info(signer, info)
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/service_account.py ADDED
@@ -0,0 +1,847 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2016 Google LLC
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
+ """Service Accounts: JSON Web Token (JWT) Profile for OAuth 2.0
16
+
17
+ This module implements the JWT Profile for OAuth 2.0 Authorization Grants
18
+ as defined by `RFC 7523`_ with particular support for how this RFC is
19
+ implemented in Google's infrastructure. Google refers to these credentials
20
+ as *Service Accounts*.
21
+
22
+ Service accounts are used for server-to-server communication, such as
23
+ interactions between a web application server and a Google service. The
24
+ service account belongs to your application instead of to an individual end
25
+ user. In contrast to other OAuth 2.0 profiles, no users are involved and your
26
+ application "acts" as the service account.
27
+
28
+ Typically an application uses a service account when the application uses
29
+ Google APIs to work with its own data rather than a user's data. For example,
30
+ an application that uses Google Cloud Datastore for data persistence would use
31
+ a service account to authenticate its calls to the Google Cloud Datastore API.
32
+ However, an application that needs to access a user's Drive documents would
33
+ use the normal OAuth 2.0 profile.
34
+
35
+ Additionally, Google Apps domain administrators can grant service accounts
36
+ `domain-wide delegation`_ authority to access user data on behalf of users in
37
+ the domain.
38
+
39
+ This profile uses a JWT to acquire an OAuth 2.0 access token. The JWT is used
40
+ in place of the usual authorization token returned during the standard
41
+ OAuth 2.0 Authorization Code grant. The JWT is only used for this purpose, as
42
+ the acquired access token is used as the bearer token when making requests
43
+ using these credentials.
44
+
45
+ This profile differs from normal OAuth 2.0 profile because no user consent
46
+ step is required. The use of the private key allows this profile to assert
47
+ identity directly.
48
+
49
+ This profile also differs from the :mod:`google.auth.jwt` authentication
50
+ because the JWT credentials use the JWT directly as the bearer token. This
51
+ profile instead only uses the JWT to obtain an OAuth 2.0 access token. The
52
+ obtained OAuth 2.0 access token is used as the bearer token.
53
+
54
+ Domain-wide delegation
55
+ ----------------------
56
+
57
+ Domain-wide delegation allows a service account to access user data on
58
+ behalf of any user in a Google Apps domain without consent from the user.
59
+ For example, an application that uses the Google Calendar API to add events to
60
+ the calendars of all users in a Google Apps domain would use a service account
61
+ to access the Google Calendar API on behalf of users.
62
+
63
+ The Google Apps administrator must explicitly authorize the service account to
64
+ do this. This authorization step is referred to as "delegating domain-wide
65
+ authority" to a service account.
66
+
67
+ You can use domain-wise delegation by creating a set of credentials with a
68
+ specific subject using :meth:`~Credentials.with_subject`.
69
+
70
+ .. _RFC 7523: https://tools.ietf.org/html/rfc7523
71
+ """
72
+
73
+ import copy
74
+ import datetime
75
+
76
+ from google.auth import _helpers
77
+ from google.auth import _service_account_info
78
+ from google.auth import credentials
79
+ from google.auth import exceptions
80
+ from google.auth import iam
81
+ from google.auth import jwt
82
+ from google.auth import metrics
83
+ from google.oauth2 import _client
84
+
85
+ _DEFAULT_TOKEN_LIFETIME_SECS = 3600 # 1 hour in seconds
86
+ _GOOGLE_OAUTH2_TOKEN_ENDPOINT = "https://oauth2.googleapis.com/token"
87
+
88
+
89
+ class Credentials(
90
+ credentials.Signing,
91
+ credentials.Scoped,
92
+ credentials.CredentialsWithQuotaProject,
93
+ credentials.CredentialsWithTokenUri,
94
+ ):
95
+ """Service account credentials
96
+
97
+ Usually, you'll create these credentials with one of the helper
98
+ constructors. To create credentials using a Google service account
99
+ private key JSON file::
100
+
101
+ credentials = service_account.Credentials.from_service_account_file(
102
+ 'service-account.json')
103
+
104
+ Or if you already have the service account file loaded::
105
+
106
+ service_account_info = json.load(open('service_account.json'))
107
+ credentials = service_account.Credentials.from_service_account_info(
108
+ service_account_info)
109
+
110
+ Both helper methods pass on arguments to the constructor, so you can
111
+ specify additional scopes and a subject if necessary::
112
+
113
+ credentials = service_account.Credentials.from_service_account_file(
114
+ 'service-account.json',
115
+ scopes=['email'],
116
+ subject='user@example.com')
117
+
118
+ The credentials are considered immutable. If you want to modify the scopes
119
+ or the subject used for delegation, use :meth:`with_scopes` or
120
+ :meth:`with_subject`::
121
+
122
+ scoped_credentials = credentials.with_scopes(['email'])
123
+ delegated_credentials = credentials.with_subject(subject)
124
+
125
+ To add a quota project, use :meth:`with_quota_project`::
126
+
127
+ credentials = credentials.with_quota_project('myproject-123')
128
+ """
129
+
130
+ def __init__(
131
+ self,
132
+ signer,
133
+ service_account_email,
134
+ token_uri,
135
+ scopes=None,
136
+ default_scopes=None,
137
+ subject=None,
138
+ project_id=None,
139
+ quota_project_id=None,
140
+ additional_claims=None,
141
+ always_use_jwt_access=False,
142
+ universe_domain=credentials.DEFAULT_UNIVERSE_DOMAIN,
143
+ trust_boundary=None,
144
+ ):
145
+ """
146
+ Args:
147
+ signer (google.auth.crypt.Signer): The signer used to sign JWTs.
148
+ service_account_email (str): The service account's email.
149
+ scopes (Sequence[str]): User-defined scopes to request during the
150
+ authorization grant.
151
+ default_scopes (Sequence[str]): Default scopes passed by a
152
+ Google client library. Use 'scopes' for user-defined scopes.
153
+ token_uri (str): The OAuth 2.0 Token URI.
154
+ subject (str): For domain-wide delegation, the email address of the
155
+ user to for which to request delegated access.
156
+ project_id (str): Project ID associated with the service account
157
+ credential.
158
+ quota_project_id (Optional[str]): The project ID used for quota and
159
+ billing.
160
+ additional_claims (Mapping[str, str]): Any additional claims for
161
+ the JWT assertion used in the authorization grant.
162
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
163
+ be always used.
164
+ universe_domain (str): The universe domain. The default
165
+ universe domain is googleapis.com. For default value self
166
+ signed jwt is used for token refresh.
167
+ trust_boundary (str): String representation of trust boundary meta.
168
+
169
+ .. note:: Typically one of the helper constructors
170
+ :meth:`from_service_account_file` or
171
+ :meth:`from_service_account_info` are used instead of calling the
172
+ constructor directly.
173
+ """
174
+ super(Credentials, self).__init__()
175
+
176
+ self._cred_file_path = None
177
+ self._scopes = scopes
178
+ self._default_scopes = default_scopes
179
+ self._signer = signer
180
+ self._service_account_email = service_account_email
181
+ self._subject = subject
182
+ self._project_id = project_id
183
+ self._quota_project_id = quota_project_id
184
+ self._token_uri = token_uri
185
+ self._always_use_jwt_access = always_use_jwt_access
186
+ self._universe_domain = universe_domain or credentials.DEFAULT_UNIVERSE_DOMAIN
187
+
188
+ if universe_domain != credentials.DEFAULT_UNIVERSE_DOMAIN:
189
+ self._always_use_jwt_access = True
190
+
191
+ self._jwt_credentials = None
192
+
193
+ if additional_claims is not None:
194
+ self._additional_claims = additional_claims
195
+ else:
196
+ self._additional_claims = {}
197
+ self._trust_boundary = {"locations": [], "encoded_locations": "0x0"}
198
+
199
+ @classmethod
200
+ def _from_signer_and_info(cls, signer, info, **kwargs):
201
+ """Creates a Credentials instance from a signer and service account
202
+ info.
203
+
204
+ Args:
205
+ signer (google.auth.crypt.Signer): The signer used to sign JWTs.
206
+ info (Mapping[str, str]): The service account info.
207
+ kwargs: Additional arguments to pass to the constructor.
208
+
209
+ Returns:
210
+ google.auth.jwt.Credentials: The constructed credentials.
211
+
212
+ Raises:
213
+ ValueError: If the info is not in the expected format.
214
+ """
215
+ return cls(
216
+ signer,
217
+ service_account_email=info["client_email"],
218
+ token_uri=info["token_uri"],
219
+ project_id=info.get("project_id"),
220
+ universe_domain=info.get(
221
+ "universe_domain", credentials.DEFAULT_UNIVERSE_DOMAIN
222
+ ),
223
+ trust_boundary=info.get("trust_boundary"),
224
+ **kwargs,
225
+ )
226
+
227
+ @classmethod
228
+ def from_service_account_info(cls, info, **kwargs):
229
+ """Creates a Credentials instance from parsed service account info.
230
+
231
+ Args:
232
+ info (Mapping[str, str]): The service account info in Google
233
+ format.
234
+ kwargs: Additional arguments to pass to the constructor.
235
+
236
+ Returns:
237
+ google.auth.service_account.Credentials: The constructed
238
+ credentials.
239
+
240
+ Raises:
241
+ ValueError: If the info is not in the expected format.
242
+ """
243
+ signer = _service_account_info.from_dict(
244
+ info, require=["client_email", "token_uri"]
245
+ )
246
+ return cls._from_signer_and_info(signer, info, **kwargs)
247
+
248
+ @classmethod
249
+ def from_service_account_file(cls, filename, **kwargs):
250
+ """Creates a Credentials instance from a service account json file.
251
+
252
+ Args:
253
+ filename (str): The path to the service account json file.
254
+ kwargs: Additional arguments to pass to the constructor.
255
+
256
+ Returns:
257
+ google.auth.service_account.Credentials: The constructed
258
+ credentials.
259
+ """
260
+ info, signer = _service_account_info.from_filename(
261
+ filename, require=["client_email", "token_uri"]
262
+ )
263
+ return cls._from_signer_and_info(signer, info, **kwargs)
264
+
265
+ @property
266
+ def service_account_email(self):
267
+ """The service account email."""
268
+ return self._service_account_email
269
+
270
+ @property
271
+ def project_id(self):
272
+ """Project ID associated with this credential."""
273
+ return self._project_id
274
+
275
+ @property
276
+ def requires_scopes(self):
277
+ """Checks if the credentials requires scopes.
278
+
279
+ Returns:
280
+ bool: True if there are no scopes set otherwise False.
281
+ """
282
+ return True if not self._scopes else False
283
+
284
+ def _make_copy(self):
285
+ cred = self.__class__(
286
+ self._signer,
287
+ service_account_email=self._service_account_email,
288
+ scopes=copy.copy(self._scopes),
289
+ default_scopes=copy.copy(self._default_scopes),
290
+ token_uri=self._token_uri,
291
+ subject=self._subject,
292
+ project_id=self._project_id,
293
+ quota_project_id=self._quota_project_id,
294
+ additional_claims=self._additional_claims.copy(),
295
+ always_use_jwt_access=self._always_use_jwt_access,
296
+ universe_domain=self._universe_domain,
297
+ )
298
+ cred._cred_file_path = self._cred_file_path
299
+ return cred
300
+
301
+ @_helpers.copy_docstring(credentials.Scoped)
302
+ def with_scopes(self, scopes, default_scopes=None):
303
+ cred = self._make_copy()
304
+ cred._scopes = scopes
305
+ cred._default_scopes = default_scopes
306
+ return cred
307
+
308
+ def with_always_use_jwt_access(self, always_use_jwt_access):
309
+ """Create a copy of these credentials with the specified always_use_jwt_access value.
310
+
311
+ Args:
312
+ always_use_jwt_access (bool): Whether always use self signed JWT or not.
313
+
314
+ Returns:
315
+ google.auth.service_account.Credentials: A new credentials
316
+ instance.
317
+ Raises:
318
+ google.auth.exceptions.InvalidValue: If the universe domain is not
319
+ default and always_use_jwt_access is False.
320
+ """
321
+ cred = self._make_copy()
322
+ if (
323
+ cred._universe_domain != credentials.DEFAULT_UNIVERSE_DOMAIN
324
+ and not always_use_jwt_access
325
+ ):
326
+ raise exceptions.InvalidValue(
327
+ "always_use_jwt_access should be True for non-default universe domain"
328
+ )
329
+ cred._always_use_jwt_access = always_use_jwt_access
330
+ return cred
331
+
332
+ @_helpers.copy_docstring(credentials.CredentialsWithUniverseDomain)
333
+ def with_universe_domain(self, universe_domain):
334
+ cred = self._make_copy()
335
+ cred._universe_domain = universe_domain
336
+ if universe_domain != credentials.DEFAULT_UNIVERSE_DOMAIN:
337
+ cred._always_use_jwt_access = True
338
+ return cred
339
+
340
+ def with_subject(self, subject):
341
+ """Create a copy of these credentials with the specified subject.
342
+
343
+ Args:
344
+ subject (str): The subject claim.
345
+
346
+ Returns:
347
+ google.auth.service_account.Credentials: A new credentials
348
+ instance.
349
+ """
350
+ cred = self._make_copy()
351
+ cred._subject = subject
352
+ return cred
353
+
354
+ def with_claims(self, additional_claims):
355
+ """Returns a copy of these credentials with modified claims.
356
+
357
+ Args:
358
+ additional_claims (Mapping[str, str]): Any additional claims for
359
+ the JWT payload. This will be merged with the current
360
+ additional claims.
361
+
362
+ Returns:
363
+ google.auth.service_account.Credentials: A new credentials
364
+ instance.
365
+ """
366
+ new_additional_claims = copy.deepcopy(self._additional_claims)
367
+ new_additional_claims.update(additional_claims or {})
368
+ cred = self._make_copy()
369
+ cred._additional_claims = new_additional_claims
370
+ return cred
371
+
372
+ @_helpers.copy_docstring(credentials.CredentialsWithQuotaProject)
373
+ def with_quota_project(self, quota_project_id):
374
+ cred = self._make_copy()
375
+ cred._quota_project_id = quota_project_id
376
+ return cred
377
+
378
+ @_helpers.copy_docstring(credentials.CredentialsWithTokenUri)
379
+ def with_token_uri(self, token_uri):
380
+ cred = self._make_copy()
381
+ cred._token_uri = token_uri
382
+ return cred
383
+
384
+ def _make_authorization_grant_assertion(self):
385
+ """Create the OAuth 2.0 assertion.
386
+
387
+ This assertion is used during the OAuth 2.0 grant to acquire an
388
+ access token.
389
+
390
+ Returns:
391
+ bytes: The authorization grant assertion.
392
+ """
393
+ now = _helpers.utcnow()
394
+ lifetime = datetime.timedelta(seconds=_DEFAULT_TOKEN_LIFETIME_SECS)
395
+ expiry = now + lifetime
396
+
397
+ payload = {
398
+ "iat": _helpers.datetime_to_secs(now),
399
+ "exp": _helpers.datetime_to_secs(expiry),
400
+ # The issuer must be the service account email.
401
+ "iss": self._service_account_email,
402
+ # The audience must be the auth token endpoint's URI
403
+ "aud": _GOOGLE_OAUTH2_TOKEN_ENDPOINT,
404
+ "scope": _helpers.scopes_to_string(self._scopes or ()),
405
+ }
406
+
407
+ payload.update(self._additional_claims)
408
+
409
+ # The subject can be a user email for domain-wide delegation.
410
+ if self._subject:
411
+ payload.setdefault("sub", self._subject)
412
+
413
+ token = jwt.encode(self._signer, payload)
414
+
415
+ return token
416
+
417
+ def _use_self_signed_jwt(self):
418
+ # Since domain wide delegation doesn't work with self signed JWT. If
419
+ # subject exists, then we should not use self signed JWT.
420
+ return self._subject is None and self._jwt_credentials is not None
421
+
422
+ def _metric_header_for_usage(self):
423
+ if self._use_self_signed_jwt():
424
+ return metrics.CRED_TYPE_SA_JWT
425
+ return metrics.CRED_TYPE_SA_ASSERTION
426
+
427
+ @_helpers.copy_docstring(credentials.Credentials)
428
+ def refresh(self, request):
429
+ if self._always_use_jwt_access and not self._jwt_credentials:
430
+ # If self signed jwt should be used but jwt credential is not
431
+ # created, try to create one with scopes
432
+ self._create_self_signed_jwt(None)
433
+
434
+ if (
435
+ self._universe_domain != credentials.DEFAULT_UNIVERSE_DOMAIN
436
+ and self._subject
437
+ ):
438
+ raise exceptions.RefreshError(
439
+ "domain wide delegation is not supported for non-default universe domain"
440
+ )
441
+
442
+ if self._use_self_signed_jwt():
443
+ self._jwt_credentials.refresh(request)
444
+ self.token = self._jwt_credentials.token.decode()
445
+ self.expiry = self._jwt_credentials.expiry
446
+ else:
447
+ assertion = self._make_authorization_grant_assertion()
448
+ access_token, expiry, _ = _client.jwt_grant(
449
+ request, self._token_uri, assertion
450
+ )
451
+ self.token = access_token
452
+ self.expiry = expiry
453
+
454
+ def _create_self_signed_jwt(self, audience):
455
+ """Create a self-signed JWT from the credentials if requirements are met.
456
+
457
+ Args:
458
+ audience (str): The service URL. ``https://[API_ENDPOINT]/``
459
+ """
460
+ # https://google.aip.dev/auth/4111
461
+ if self._always_use_jwt_access:
462
+ if self._scopes:
463
+ additional_claims = {"scope": " ".join(self._scopes)}
464
+ if (
465
+ self._jwt_credentials is None
466
+ or self._jwt_credentials.additional_claims != additional_claims
467
+ ):
468
+ self._jwt_credentials = jwt.Credentials.from_signing_credentials(
469
+ self, None, additional_claims=additional_claims
470
+ )
471
+ elif audience:
472
+ if (
473
+ self._jwt_credentials is None
474
+ or self._jwt_credentials._audience != audience
475
+ ):
476
+
477
+ self._jwt_credentials = jwt.Credentials.from_signing_credentials(
478
+ self, audience
479
+ )
480
+ elif self._default_scopes:
481
+ additional_claims = {"scope": " ".join(self._default_scopes)}
482
+ if (
483
+ self._jwt_credentials is None
484
+ or additional_claims != self._jwt_credentials.additional_claims
485
+ ):
486
+ self._jwt_credentials = jwt.Credentials.from_signing_credentials(
487
+ self, None, additional_claims=additional_claims
488
+ )
489
+ elif not self._scopes and audience:
490
+ self._jwt_credentials = jwt.Credentials.from_signing_credentials(
491
+ self, audience
492
+ )
493
+
494
+ @_helpers.copy_docstring(credentials.Signing)
495
+ def sign_bytes(self, message):
496
+ return self._signer.sign(message)
497
+
498
+ @property # type: ignore
499
+ @_helpers.copy_docstring(credentials.Signing)
500
+ def signer(self):
501
+ return self._signer
502
+
503
+ @property # type: ignore
504
+ @_helpers.copy_docstring(credentials.Signing)
505
+ def signer_email(self):
506
+ return self._service_account_email
507
+
508
+ @_helpers.copy_docstring(credentials.Credentials)
509
+ def get_cred_info(self):
510
+ if self._cred_file_path:
511
+ return {
512
+ "credential_source": self._cred_file_path,
513
+ "credential_type": "service account credentials",
514
+ "principal": self.service_account_email,
515
+ }
516
+ return None
517
+
518
+
519
+ class IDTokenCredentials(
520
+ credentials.Signing,
521
+ credentials.CredentialsWithQuotaProject,
522
+ credentials.CredentialsWithTokenUri,
523
+ ):
524
+ """Open ID Connect ID Token-based service account credentials.
525
+
526
+ These credentials are largely similar to :class:`.Credentials`, but instead
527
+ of using an OAuth 2.0 Access Token as the bearer token, they use an Open
528
+ ID Connect ID Token as the bearer token. These credentials are useful when
529
+ communicating to services that require ID Tokens and can not accept access
530
+ tokens.
531
+
532
+ Usually, you'll create these credentials with one of the helper
533
+ constructors. To create credentials using a Google service account
534
+ private key JSON file::
535
+
536
+ credentials = (
537
+ service_account.IDTokenCredentials.from_service_account_file(
538
+ 'service-account.json'))
539
+
540
+
541
+ Or if you already have the service account file loaded::
542
+
543
+ service_account_info = json.load(open('service_account.json'))
544
+ credentials = (
545
+ service_account.IDTokenCredentials.from_service_account_info(
546
+ service_account_info))
547
+
548
+
549
+ Both helper methods pass on arguments to the constructor, so you can
550
+ specify additional scopes and a subject if necessary::
551
+
552
+ credentials = (
553
+ service_account.IDTokenCredentials.from_service_account_file(
554
+ 'service-account.json',
555
+ scopes=['email'],
556
+ subject='user@example.com'))
557
+
558
+
559
+ The credentials are considered immutable. If you want to modify the scopes
560
+ or the subject used for delegation, use :meth:`with_scopes` or
561
+ :meth:`with_subject`::
562
+
563
+ scoped_credentials = credentials.with_scopes(['email'])
564
+ delegated_credentials = credentials.with_subject(subject)
565
+
566
+ """
567
+
568
+ def __init__(
569
+ self,
570
+ signer,
571
+ service_account_email,
572
+ token_uri,
573
+ target_audience,
574
+ additional_claims=None,
575
+ quota_project_id=None,
576
+ universe_domain=credentials.DEFAULT_UNIVERSE_DOMAIN,
577
+ ):
578
+ """
579
+ Args:
580
+ signer (google.auth.crypt.Signer): The signer used to sign JWTs.
581
+ service_account_email (str): The service account's email.
582
+ token_uri (str): The OAuth 2.0 Token URI.
583
+ target_audience (str): The intended audience for these credentials,
584
+ used when requesting the ID Token. The ID Token's ``aud`` claim
585
+ will be set to this string.
586
+ additional_claims (Mapping[str, str]): Any additional claims for
587
+ the JWT assertion used in the authorization grant.
588
+ quota_project_id (Optional[str]): The project ID used for quota and billing.
589
+ universe_domain (str): The universe domain. The default
590
+ universe domain is googleapis.com. For default value IAM ID
591
+ token endponint is used for token refresh. Note that
592
+ iam.serviceAccountTokenCreator role is required to use the IAM
593
+ endpoint.
594
+ .. note:: Typically one of the helper constructors
595
+ :meth:`from_service_account_file` or
596
+ :meth:`from_service_account_info` are used instead of calling the
597
+ constructor directly.
598
+ """
599
+ super(IDTokenCredentials, self).__init__()
600
+ self._signer = signer
601
+ self._service_account_email = service_account_email
602
+ self._token_uri = token_uri
603
+ self._target_audience = target_audience
604
+ self._quota_project_id = quota_project_id
605
+ self._use_iam_endpoint = False
606
+
607
+ if not universe_domain:
608
+ self._universe_domain = credentials.DEFAULT_UNIVERSE_DOMAIN
609
+ else:
610
+ self._universe_domain = universe_domain
611
+ self._iam_id_token_endpoint = iam._IAM_IDTOKEN_ENDPOINT.replace(
612
+ "googleapis.com", self._universe_domain
613
+ )
614
+
615
+ if self._universe_domain != credentials.DEFAULT_UNIVERSE_DOMAIN:
616
+ self._use_iam_endpoint = True
617
+
618
+ if additional_claims is not None:
619
+ self._additional_claims = additional_claims
620
+ else:
621
+ self._additional_claims = {}
622
+
623
+ @classmethod
624
+ def _from_signer_and_info(cls, signer, info, **kwargs):
625
+ """Creates a credentials instance from a signer and service account
626
+ info.
627
+
628
+ Args:
629
+ signer (google.auth.crypt.Signer): The signer used to sign JWTs.
630
+ info (Mapping[str, str]): The service account info.
631
+ kwargs: Additional arguments to pass to the constructor.
632
+
633
+ Returns:
634
+ google.auth.jwt.IDTokenCredentials: The constructed credentials.
635
+
636
+ Raises:
637
+ ValueError: If the info is not in the expected format.
638
+ """
639
+ kwargs.setdefault("service_account_email", info["client_email"])
640
+ kwargs.setdefault("token_uri", info["token_uri"])
641
+ if "universe_domain" in info:
642
+ kwargs["universe_domain"] = info["universe_domain"]
643
+ return cls(signer, **kwargs)
644
+
645
+ @classmethod
646
+ def from_service_account_info(cls, info, **kwargs):
647
+ """Creates a credentials instance from parsed service account info.
648
+
649
+ Args:
650
+ info (Mapping[str, str]): The service account info in Google
651
+ format.
652
+ kwargs: Additional arguments to pass to the constructor.
653
+
654
+ Returns:
655
+ google.auth.service_account.IDTokenCredentials: The constructed
656
+ credentials.
657
+
658
+ Raises:
659
+ ValueError: If the info is not in the expected format.
660
+ """
661
+ signer = _service_account_info.from_dict(
662
+ info, require=["client_email", "token_uri"]
663
+ )
664
+ return cls._from_signer_and_info(signer, info, **kwargs)
665
+
666
+ @classmethod
667
+ def from_service_account_file(cls, filename, **kwargs):
668
+ """Creates a credentials instance from a service account json file.
669
+
670
+ Args:
671
+ filename (str): The path to the service account json file.
672
+ kwargs: Additional arguments to pass to the constructor.
673
+
674
+ Returns:
675
+ google.auth.service_account.IDTokenCredentials: The constructed
676
+ credentials.
677
+ """
678
+ info, signer = _service_account_info.from_filename(
679
+ filename, require=["client_email", "token_uri"]
680
+ )
681
+ return cls._from_signer_and_info(signer, info, **kwargs)
682
+
683
+ def _make_copy(self):
684
+ cred = self.__class__(
685
+ self._signer,
686
+ service_account_email=self._service_account_email,
687
+ token_uri=self._token_uri,
688
+ target_audience=self._target_audience,
689
+ additional_claims=self._additional_claims.copy(),
690
+ quota_project_id=self.quota_project_id,
691
+ universe_domain=self._universe_domain,
692
+ )
693
+ # _use_iam_endpoint is not exposed in the constructor
694
+ cred._use_iam_endpoint = self._use_iam_endpoint
695
+ return cred
696
+
697
+ def with_target_audience(self, target_audience):
698
+ """Create a copy of these credentials with the specified target
699
+ audience.
700
+
701
+ Args:
702
+ target_audience (str): The intended audience for these credentials,
703
+ used when requesting the ID Token.
704
+
705
+ Returns:
706
+ google.auth.service_account.IDTokenCredentials: A new credentials
707
+ instance.
708
+ """
709
+ cred = self._make_copy()
710
+ cred._target_audience = target_audience
711
+ return cred
712
+
713
+ def _with_use_iam_endpoint(self, use_iam_endpoint):
714
+ """Create a copy of these credentials with the use_iam_endpoint value.
715
+
716
+ Args:
717
+ use_iam_endpoint (bool): If True, IAM generateIdToken endpoint will
718
+ be used instead of the token_uri. Note that
719
+ iam.serviceAccountTokenCreator role is required to use the IAM
720
+ endpoint. The default value is False. This feature is currently
721
+ experimental and subject to change without notice.
722
+
723
+ Returns:
724
+ google.auth.service_account.IDTokenCredentials: A new credentials
725
+ instance.
726
+ Raises:
727
+ google.auth.exceptions.InvalidValue: If the universe domain is not
728
+ default and use_iam_endpoint is False.
729
+ """
730
+ cred = self._make_copy()
731
+ if (
732
+ cred._universe_domain != credentials.DEFAULT_UNIVERSE_DOMAIN
733
+ and not use_iam_endpoint
734
+ ):
735
+ raise exceptions.InvalidValue(
736
+ "use_iam_endpoint should be True for non-default universe domain"
737
+ )
738
+ cred._use_iam_endpoint = use_iam_endpoint
739
+ return cred
740
+
741
+ @_helpers.copy_docstring(credentials.CredentialsWithQuotaProject)
742
+ def with_quota_project(self, quota_project_id):
743
+ cred = self._make_copy()
744
+ cred._quota_project_id = quota_project_id
745
+ return cred
746
+
747
+ @_helpers.copy_docstring(credentials.CredentialsWithTokenUri)
748
+ def with_token_uri(self, token_uri):
749
+ cred = self._make_copy()
750
+ cred._token_uri = token_uri
751
+ return cred
752
+
753
+ def _make_authorization_grant_assertion(self):
754
+ """Create the OAuth 2.0 assertion.
755
+
756
+ This assertion is used during the OAuth 2.0 grant to acquire an
757
+ ID token.
758
+
759
+ Returns:
760
+ bytes: The authorization grant assertion.
761
+ """
762
+ now = _helpers.utcnow()
763
+ lifetime = datetime.timedelta(seconds=_DEFAULT_TOKEN_LIFETIME_SECS)
764
+ expiry = now + lifetime
765
+
766
+ payload = {
767
+ "iat": _helpers.datetime_to_secs(now),
768
+ "exp": _helpers.datetime_to_secs(expiry),
769
+ # The issuer must be the service account email.
770
+ "iss": self.service_account_email,
771
+ # The audience must be the auth token endpoint's URI
772
+ "aud": _GOOGLE_OAUTH2_TOKEN_ENDPOINT,
773
+ # The target audience specifies which service the ID token is
774
+ # intended for.
775
+ "target_audience": self._target_audience,
776
+ }
777
+
778
+ payload.update(self._additional_claims)
779
+
780
+ token = jwt.encode(self._signer, payload)
781
+
782
+ return token
783
+
784
+ def _refresh_with_iam_endpoint(self, request):
785
+ """Use IAM generateIdToken endpoint to obtain an ID token.
786
+
787
+ It works as follows:
788
+
789
+ 1. First we create a self signed jwt with
790
+ https://www.googleapis.com/auth/iam being the scope.
791
+
792
+ 2. Next we use the self signed jwt as the access token, and make a POST
793
+ request to IAM generateIdToken endpoint. The request body is:
794
+ {
795
+ "audience": self._target_audience,
796
+ "includeEmail": "true",
797
+ "useEmailAzp": "true",
798
+ }
799
+
800
+ If the request is succesfully, it will return {"token":"the ID token"},
801
+ and we can extract the ID token and compute its expiry.
802
+ """
803
+ jwt_credentials = jwt.Credentials.from_signing_credentials(
804
+ self,
805
+ None,
806
+ additional_claims={"scope": "https://www.googleapis.com/auth/iam"},
807
+ )
808
+ jwt_credentials.refresh(request)
809
+ self.token, self.expiry = _client.call_iam_generate_id_token_endpoint(
810
+ request,
811
+ self._iam_id_token_endpoint,
812
+ self.signer_email,
813
+ self._target_audience,
814
+ jwt_credentials.token.decode(),
815
+ self._universe_domain,
816
+ )
817
+
818
+ @_helpers.copy_docstring(credentials.Credentials)
819
+ def refresh(self, request):
820
+ if self._use_iam_endpoint:
821
+ self._refresh_with_iam_endpoint(request)
822
+ else:
823
+ assertion = self._make_authorization_grant_assertion()
824
+ access_token, expiry, _ = _client.id_token_jwt_grant(
825
+ request, self._token_uri, assertion
826
+ )
827
+ self.token = access_token
828
+ self.expiry = expiry
829
+
830
+ @property
831
+ def service_account_email(self):
832
+ """The service account email."""
833
+ return self._service_account_email
834
+
835
+ @_helpers.copy_docstring(credentials.Signing)
836
+ def sign_bytes(self, message):
837
+ return self._signer.sign(message)
838
+
839
+ @property # type: ignore
840
+ @_helpers.copy_docstring(credentials.Signing)
841
+ def signer(self):
842
+ return self._signer
843
+
844
+ @property # type: ignore
845
+ @_helpers.copy_docstring(credentials.Signing)
846
+ def signer_email(self):
847
+ return self._service_account_email
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/webauthn_handler.py ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import abc
2
+ import os
3
+ import struct
4
+ import subprocess
5
+
6
+ from google.auth import exceptions
7
+ from google.oauth2.webauthn_types import GetRequest, GetResponse
8
+
9
+
10
+ class WebAuthnHandler(abc.ABC):
11
+ @abc.abstractmethod
12
+ def is_available(self) -> bool:
13
+ """Check whether this WebAuthn handler is available"""
14
+ raise NotImplementedError("is_available method must be implemented")
15
+
16
+ @abc.abstractmethod
17
+ def get(self, get_request: GetRequest) -> GetResponse:
18
+ """WebAuthn get (assertion)"""
19
+ raise NotImplementedError("get method must be implemented")
20
+
21
+
22
+ class PluginHandler(WebAuthnHandler):
23
+ """Offloads WebAuthn get reqeust to a pluggable command-line tool.
24
+
25
+ Offloads WebAuthn get to a plugin which takes the form of a
26
+ command-line tool. The command-line tool is configurable via the
27
+ PluginHandler._ENV_VAR environment variable.
28
+
29
+ The WebAuthn plugin should implement the following interface:
30
+
31
+ Communication occurs over stdin/stdout, and messages are both sent and
32
+ received in the form:
33
+
34
+ [4 bytes - payload size (little-endian)][variable bytes - json payload]
35
+ """
36
+
37
+ _ENV_VAR = "GOOGLE_AUTH_WEBAUTHN_PLUGIN"
38
+
39
+ def is_available(self) -> bool:
40
+ try:
41
+ self._find_plugin()
42
+ except Exception:
43
+ return False
44
+ else:
45
+ return True
46
+
47
+ def get(self, get_request: GetRequest) -> GetResponse:
48
+ request_json = get_request.to_json()
49
+ cmd = self._find_plugin()
50
+ response_json = self._call_plugin(cmd, request_json)
51
+ return GetResponse.from_json(response_json)
52
+
53
+ def _call_plugin(self, cmd: str, input_json: str) -> str:
54
+ # Calculate length of input
55
+ input_length = len(input_json)
56
+ length_bytes_le = struct.pack("<I", input_length)
57
+ request = length_bytes_le + input_json.encode()
58
+
59
+ # Call plugin
60
+ process_result = subprocess.run(
61
+ [cmd], input=request, capture_output=True, check=True
62
+ )
63
+
64
+ # Check length of response
65
+ response_len_le = process_result.stdout[:4]
66
+ response_len = struct.unpack("<I", response_len_le)[0]
67
+ response = process_result.stdout[4:]
68
+ if response_len != len(response):
69
+ raise exceptions.MalformedError(
70
+ "Plugin response length {} does not match data {}".format(
71
+ response_len, len(response)
72
+ )
73
+ )
74
+ return response.decode()
75
+
76
+ def _find_plugin(self) -> str:
77
+ plugin_cmd = os.environ.get(PluginHandler._ENV_VAR)
78
+ if plugin_cmd is None:
79
+ raise exceptions.InvalidResource(
80
+ "{} env var is not set".format(PluginHandler._ENV_VAR)
81
+ )
82
+ return plugin_cmd
evalkit_internvl/lib/python3.10/site-packages/google/oauth2/webauthn_types.py ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dataclasses import dataclass
2
+ import json
3
+ from typing import Any, Dict, List, Optional
4
+
5
+ from google.auth import exceptions
6
+
7
+
8
+ @dataclass(frozen=True)
9
+ class PublicKeyCredentialDescriptor:
10
+ """Descriptor for a security key based credential.
11
+
12
+ https://www.w3.org/TR/webauthn-3/#dictionary-credential-descriptor
13
+
14
+ Args:
15
+ id: <url-safe base64-encoded> credential id (key handle).
16
+ transports: <'usb'|'nfc'|'ble'|'internal'> List of supported transports.
17
+ """
18
+
19
+ id: str
20
+ transports: Optional[List[str]] = None
21
+
22
+ def to_dict(self):
23
+ cred = {"type": "public-key", "id": self.id}
24
+ if self.transports:
25
+ cred["transports"] = self.transports
26
+ return cred
27
+
28
+
29
+ @dataclass
30
+ class AuthenticationExtensionsClientInputs:
31
+ """Client extensions inputs for WebAuthn extensions.
32
+
33
+ Args:
34
+ appid: app id that can be asserted with in addition to rpid.
35
+ https://www.w3.org/TR/webauthn-3/#sctn-appid-extension
36
+ """
37
+
38
+ appid: Optional[str] = None
39
+
40
+ def to_dict(self):
41
+ extensions = {}
42
+ if self.appid:
43
+ extensions["appid"] = self.appid
44
+ return extensions
45
+
46
+
47
+ @dataclass
48
+ class GetRequest:
49
+ """WebAuthn get request
50
+
51
+ Args:
52
+ origin: Origin where the WebAuthn get assertion takes place.
53
+ rpid: Relying Party ID.
54
+ challenge: <url-safe base64-encoded> raw challenge.
55
+ timeout_ms: Timeout number in millisecond.
56
+ allow_credentials: List of allowed credentials.
57
+ user_verification: <'required'|'preferred'|'discouraged'> User verification requirement.
58
+ extensions: WebAuthn authentication extensions inputs.
59
+ """
60
+
61
+ origin: str
62
+ rpid: str
63
+ challenge: str
64
+ timeout_ms: Optional[int] = None
65
+ allow_credentials: Optional[List[PublicKeyCredentialDescriptor]] = None
66
+ user_verification: Optional[str] = None
67
+ extensions: Optional[AuthenticationExtensionsClientInputs] = None
68
+
69
+ def to_json(self) -> str:
70
+ req_options: Dict[str, Any] = {"rpid": self.rpid, "challenge": self.challenge}
71
+ if self.timeout_ms:
72
+ req_options["timeout"] = self.timeout_ms
73
+ if self.allow_credentials:
74
+ req_options["allowCredentials"] = [
75
+ c.to_dict() for c in self.allow_credentials
76
+ ]
77
+ if self.user_verification:
78
+ req_options["userVerification"] = self.user_verification
79
+ if self.extensions:
80
+ req_options["extensions"] = self.extensions.to_dict()
81
+ return json.dumps(
82
+ {"type": "get", "origin": self.origin, "requestData": req_options}
83
+ )
84
+
85
+
86
+ @dataclass(frozen=True)
87
+ class AuthenticatorAssertionResponse:
88
+ """Authenticator response to a WebAuthn get (assertion) request.
89
+
90
+ https://www.w3.org/TR/webauthn-3/#authenticatorassertionresponse
91
+
92
+ Args:
93
+ client_data_json: <url-safe base64-encoded> client data JSON.
94
+ authenticator_data: <url-safe base64-encoded> authenticator data.
95
+ signature: <url-safe base64-encoded> signature.
96
+ user_handle: <url-safe base64-encoded> user handle.
97
+ """
98
+
99
+ client_data_json: str
100
+ authenticator_data: str
101
+ signature: str
102
+ user_handle: Optional[str]
103
+
104
+
105
+ @dataclass(frozen=True)
106
+ class GetResponse:
107
+ """WebAuthn get (assertion) response.
108
+
109
+ Args:
110
+ id: <url-safe base64-encoded> credential id (key handle).
111
+ response: The authenticator assertion response.
112
+ authenticator_attachment: <'cross-platform'|'platform'> The attachment status of the authenticator.
113
+ client_extension_results: WebAuthn authentication extensions output results in a dictionary.
114
+ """
115
+
116
+ id: str
117
+ response: AuthenticatorAssertionResponse
118
+ authenticator_attachment: Optional[str]
119
+ client_extension_results: Optional[Dict]
120
+
121
+ @staticmethod
122
+ def from_json(json_str: str):
123
+ """Verify and construct GetResponse from a JSON string."""
124
+ try:
125
+ resp_json = json.loads(json_str)
126
+ except ValueError:
127
+ raise exceptions.MalformedError("Invalid Get JSON response")
128
+ if resp_json.get("type") != "getResponse":
129
+ raise exceptions.MalformedError(
130
+ "Invalid Get response type: {}".format(resp_json.get("type"))
131
+ )
132
+ pk_cred = resp_json.get("responseData")
133
+ if pk_cred is None:
134
+ if resp_json.get("error"):
135
+ raise exceptions.ReauthFailError(
136
+ "WebAuthn.get failure: {}".format(resp_json["error"])
137
+ )
138
+ else:
139
+ raise exceptions.MalformedError("Get response is empty")
140
+ if pk_cred.get("type") != "public-key":
141
+ raise exceptions.MalformedError(
142
+ "Invalid credential type: {}".format(pk_cred.get("type"))
143
+ )
144
+ assertion_json = pk_cred["response"]
145
+ assertion_resp = AuthenticatorAssertionResponse(
146
+ client_data_json=assertion_json["clientDataJSON"],
147
+ authenticator_data=assertion_json["authenticatorData"],
148
+ signature=assertion_json["signature"],
149
+ user_handle=assertion_json.get("userHandle"),
150
+ )
151
+ return GetResponse(
152
+ id=pk_cred["id"],
153
+ response=assertion_resp,
154
+ authenticator_attachment=pk_cred.get("authenticatorAttachment"),
155
+ client_extension_results=pk_cred.get("clientExtensionResults"),
156
+ )
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_cpu_dispatch.h ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunction.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ // Forward declarations of any types needed in the operator signatures.
12
+ // We can't directly include these classes because it will cause circular include dependencies.
13
+ // This file is included by TensorBody.h, which defines the Tensor class.
14
+ #include <ATen/core/ATen_fwd.h>
15
+
16
+ namespace at {
17
+
18
+ namespace cpu {
19
+
20
+ TORCH_API at::Tensor _adaptive_avg_pool3d(const at::Tensor & self, at::IntArrayRef output_size);
21
+ TORCH_API at::Tensor _adaptive_avg_pool3d_symint(const at::Tensor & self, c10::SymIntArrayRef output_size);
22
+
23
+ } // namespace cpu
24
+ } // namespace at
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/_coalesce_compositeexplicitautograd_dispatch.h ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunction.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ // Forward declarations of any types needed in the operator signatures.
12
+ // We can't directly include these classes because it will cause circular include dependencies.
13
+ // This file is included by TensorBody.h, which defines the Tensor class.
14
+ #include <ATen/core/ATen_fwd.h>
15
+
16
+ namespace at {
17
+
18
+ namespace compositeexplicitautograd {
19
+
20
+ TORCH_API at::Tensor & _coalesce_out(at::Tensor & out, const at::Tensor & self);
21
+ TORCH_API at::Tensor & _coalesce_outf(const at::Tensor & self, at::Tensor & out);
22
+
23
+ } // namespace compositeexplicitautograd
24
+ } // namespace at
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/_cufft_get_plan_cache_size_ops.h ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Operator.h
4
+
5
+ #include <tuple>
6
+ #include <vector>
7
+
8
+ // Forward declarations of any types needed in the operator signatures.
9
+ // We can't directly include these classes because it will cause circular include dependencies.
10
+ // This file is included by TensorBody.h, which defines the Tensor class.
11
+ #include <ATen/core/ATen_fwd.h>
12
+
13
+ namespace at {
14
+ namespace _ops {
15
+
16
+
17
+ struct TORCH_API _cufft_get_plan_cache_size {
18
+ using schema = int64_t (at::DeviceIndex);
19
+ using ptr_schema = schema*;
20
+ // See Note [static constexpr char* members for windows NVCC]
21
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_cufft_get_plan_cache_size")
22
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
23
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_cufft_get_plan_cache_size(DeviceIndex device_index) -> int")
24
+ static int64_t call(at::DeviceIndex device_index);
25
+ static int64_t redispatch(c10::DispatchKeySet dispatchKeySet, at::DeviceIndex device_index);
26
+ };
27
+
28
+ }} // namespace at::_ops
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/_functional_sym_constrain_range_native.h ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from NativeFunction.h
4
+
5
+ #include <c10/core/Scalar.h>
6
+ #include <c10/core/Storage.h>
7
+ #include <c10/core/TensorOptions.h>
8
+ #include <c10/util/Deprecated.h>
9
+ #include <c10/util/Optional.h>
10
+ #include <c10/core/QScheme.h>
11
+ #include <ATen/core/Reduction.h>
12
+ #include <ATen/core/Tensor.h>
13
+ #include <tuple>
14
+ #include <vector>
15
+
16
+
17
+ namespace at {
18
+ namespace native {
19
+ TORCH_API at::Tensor _functional_sym_constrain_range(const at::Scalar & size, c10::optional<int64_t> min, c10::optional<int64_t> max, const at::Tensor & dep_token);
20
+ } // namespace native
21
+ } // namespace at
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/_logcumsumexp_ops.h ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Operator.h
4
+
5
+ #include <tuple>
6
+ #include <vector>
7
+
8
+ // Forward declarations of any types needed in the operator signatures.
9
+ // We can't directly include these classes because it will cause circular include dependencies.
10
+ // This file is included by TensorBody.h, which defines the Tensor class.
11
+ #include <ATen/core/ATen_fwd.h>
12
+
13
+ namespace at {
14
+ namespace _ops {
15
+
16
+
17
+ struct TORCH_API _logcumsumexp {
18
+ using schema = at::Tensor (const at::Tensor &, int64_t);
19
+ using ptr_schema = schema*;
20
+ // See Note [static constexpr char* members for windows NVCC]
21
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_logcumsumexp")
22
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
23
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_logcumsumexp(Tensor self, int dim) -> Tensor")
24
+ static at::Tensor call(const at::Tensor & self, int64_t dim);
25
+ static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, int64_t dim);
26
+ };
27
+
28
+ struct TORCH_API _logcumsumexp_out {
29
+ using schema = at::Tensor & (const at::Tensor &, int64_t, at::Tensor &);
30
+ using ptr_schema = schema*;
31
+ // See Note [static constexpr char* members for windows NVCC]
32
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_logcumsumexp")
33
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out")
34
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_logcumsumexp.out(Tensor self, int dim, *, Tensor(a!) out) -> Tensor(a!)")
35
+ static at::Tensor & call(const at::Tensor & self, int64_t dim, at::Tensor & out);
36
+ static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, int64_t dim, at::Tensor & out);
37
+ };
38
+
39
+ }} // namespace at::_ops
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/_pdist_forward_cuda_dispatch.h ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunction.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ // Forward declarations of any types needed in the operator signatures.
12
+ // We can't directly include these classes because it will cause circular include dependencies.
13
+ // This file is included by TensorBody.h, which defines the Tensor class.
14
+ #include <ATen/core/ATen_fwd.h>
15
+
16
+ namespace at {
17
+
18
+ namespace cuda {
19
+
20
+ TORCH_API at::Tensor _pdist_forward(const at::Tensor & self, double p=2);
21
+
22
+ } // namespace cuda
23
+ } // namespace at
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/_sparse_sparse_matmul_native.h ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from NativeFunction.h
4
+
5
+ #include <c10/core/Scalar.h>
6
+ #include <c10/core/Storage.h>
7
+ #include <c10/core/TensorOptions.h>
8
+ #include <c10/util/Deprecated.h>
9
+ #include <c10/util/Optional.h>
10
+ #include <c10/core/QScheme.h>
11
+ #include <ATen/core/Reduction.h>
12
+ #include <ATen/core/Tensor.h>
13
+ #include <tuple>
14
+ #include <vector>
15
+
16
+
17
+ namespace at {
18
+ namespace native {
19
+ TORCH_API at::Tensor & _sparse_sparse_matmul_out(const at::Tensor & self, const at::Tensor & other, at::Tensor & out);
20
+ TORCH_API at::Tensor sparse_sparse_matmul_cpu(const at::Tensor & self, const at::Tensor & other);
21
+ TORCH_API at::Tensor sparse_sparse_matmul_cuda(const at::Tensor & self, const at::Tensor & other);
22
+ } // namespace native
23
+ } // namespace at
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/_stack_cpu_dispatch.h ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunction.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ // Forward declarations of any types needed in the operator signatures.
12
+ // We can't directly include these classes because it will cause circular include dependencies.
13
+ // This file is included by TensorBody.h, which defines the Tensor class.
14
+ #include <ATen/core/ATen_fwd.h>
15
+
16
+ namespace at {
17
+
18
+ namespace cpu {
19
+
20
+ TORCH_API at::Tensor _stack(at::TensorList tensors, int64_t dim=0);
21
+ TORCH_API at::Tensor & _stack_out(at::Tensor & out, at::TensorList tensors, int64_t dim=0);
22
+ TORCH_API at::Tensor & _stack_outf(at::TensorList tensors, int64_t dim, at::Tensor & out);
23
+
24
+ } // namespace cpu
25
+ } // namespace at
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/_transform_bias_rescale_qkv_native.h ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from NativeFunction.h
4
+
5
+ #include <c10/core/Scalar.h>
6
+ #include <c10/core/Storage.h>
7
+ #include <c10/core/TensorOptions.h>
8
+ #include <c10/util/Deprecated.h>
9
+ #include <c10/util/Optional.h>
10
+ #include <c10/core/QScheme.h>
11
+ #include <ATen/core/Reduction.h>
12
+ #include <ATen/core/Tensor.h>
13
+ #include <tuple>
14
+ #include <vector>
15
+
16
+
17
+ namespace at {
18
+ namespace native {
19
+ TORCH_API ::std::tuple<at::Tensor &,at::Tensor &,at::Tensor &> _transform_bias_rescale_qkv_out(const at::Tensor & qkv, const at::Tensor & qkv_bias, int64_t num_heads, at::Tensor & out0, at::Tensor & out1, at::Tensor & out2);
20
+ TORCH_API ::std::tuple<at::Tensor,at::Tensor,at::Tensor> transform_bias_rescale_qkv_cpu(const at::Tensor & qkv, const at::Tensor & qkv_bias, int64_t num_heads);
21
+ TORCH_API ::std::tuple<at::Tensor,at::Tensor,at::Tensor> transform_bias_rescale_qkv_cuda(const at::Tensor & qkv, const at::Tensor & qkv_bias, int64_t num_heads);
22
+ } // namespace native
23
+ } // namespace at
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/_unique_native.h ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from NativeFunction.h
4
+
5
+ #include <c10/core/Scalar.h>
6
+ #include <c10/core/Storage.h>
7
+ #include <c10/core/TensorOptions.h>
8
+ #include <c10/util/Deprecated.h>
9
+ #include <c10/util/Optional.h>
10
+ #include <c10/core/QScheme.h>
11
+ #include <ATen/core/Reduction.h>
12
+ #include <ATen/core/Tensor.h>
13
+ #include <tuple>
14
+ #include <vector>
15
+
16
+
17
+ namespace at {
18
+ namespace native {
19
+ TORCH_API ::std::tuple<at::Tensor &,at::Tensor &> _unique_out(const at::Tensor & self, bool sorted, bool return_inverse, at::Tensor & out0, at::Tensor & out1);
20
+ TORCH_API ::std::tuple<at::Tensor,at::Tensor> _unique_cpu(const at::Tensor & self, bool sorted=true, bool return_inverse=false);
21
+ TORCH_API ::std::tuple<at::Tensor,at::Tensor> _unique_cuda(const at::Tensor & self, bool sorted=true, bool return_inverse=false);
22
+ } // namespace native
23
+ } // namespace at
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/avg_pool2d_meta.h ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from NativeMetaFunction.h
4
+
5
+ #include <c10/core/Scalar.h>
6
+ #include <c10/core/Storage.h>
7
+ #include <c10/core/TensorOptions.h>
8
+ #include <c10/util/Deprecated.h>
9
+ #include <c10/util/Optional.h>
10
+ #include <c10/core/QScheme.h>
11
+ #include <ATen/core/Reduction.h>
12
+ #include <ATen/TensorIterator.h>
13
+ #include <ATen/TensorMeta.h>
14
+ #include <tuple>
15
+ #include <vector>
16
+
17
+ namespace at {
18
+ namespace meta {
19
+
20
+ struct TORCH_API structured_avg_pool2d : public at::impl::MetaBase {
21
+
22
+ template <bool KH = false, bool KW = false, bool DH = false, bool DW = false, bool PADH = false, bool PADW = false>
23
+ struct TORCH_API precompute_out {
24
+
25
+ precompute_out<true, KW, DH, DW, PADH, PADW> set_kH(int64_t value) {
26
+ static_assert(KH == false, "kH already set");
27
+ precompute_out<true, KW, DH, DW, PADH, PADW> ret;
28
+ ret.kH = value;
29
+ ret.kW = this->kW;
30
+ ret.dH = this->dH;
31
+ ret.dW = this->dW;
32
+ ret.padH = this->padH;
33
+ ret.padW = this->padW;
34
+ return ret;
35
+ }
36
+
37
+
38
+ precompute_out<KH, true, DH, DW, PADH, PADW> set_kW(int64_t value) {
39
+ static_assert(KW == false, "kW already set");
40
+ precompute_out<KH, true, DH, DW, PADH, PADW> ret;
41
+ ret.kH = this->kH;
42
+ ret.kW = value;
43
+ ret.dH = this->dH;
44
+ ret.dW = this->dW;
45
+ ret.padH = this->padH;
46
+ ret.padW = this->padW;
47
+ return ret;
48
+ }
49
+
50
+
51
+ precompute_out<KH, KW, true, DW, PADH, PADW> set_dH(int64_t value) {
52
+ static_assert(DH == false, "dH already set");
53
+ precompute_out<KH, KW, true, DW, PADH, PADW> ret;
54
+ ret.kH = this->kH;
55
+ ret.kW = this->kW;
56
+ ret.dH = value;
57
+ ret.dW = this->dW;
58
+ ret.padH = this->padH;
59
+ ret.padW = this->padW;
60
+ return ret;
61
+ }
62
+
63
+
64
+ precompute_out<KH, KW, DH, true, PADH, PADW> set_dW(int64_t value) {
65
+ static_assert(DW == false, "dW already set");
66
+ precompute_out<KH, KW, DH, true, PADH, PADW> ret;
67
+ ret.kH = this->kH;
68
+ ret.kW = this->kW;
69
+ ret.dH = this->dH;
70
+ ret.dW = value;
71
+ ret.padH = this->padH;
72
+ ret.padW = this->padW;
73
+ return ret;
74
+ }
75
+
76
+
77
+ precompute_out<KH, KW, DH, DW, true, PADW> set_padH(int64_t value) {
78
+ static_assert(PADH == false, "padH already set");
79
+ precompute_out<KH, KW, DH, DW, true, PADW> ret;
80
+ ret.kH = this->kH;
81
+ ret.kW = this->kW;
82
+ ret.dH = this->dH;
83
+ ret.dW = this->dW;
84
+ ret.padH = value;
85
+ ret.padW = this->padW;
86
+ return ret;
87
+ }
88
+
89
+
90
+ precompute_out<KH, KW, DH, DW, PADH, true> set_padW(int64_t value) {
91
+ static_assert(PADW == false, "padW already set");
92
+ precompute_out<KH, KW, DH, DW, PADH, true> ret;
93
+ ret.kH = this->kH;
94
+ ret.kW = this->kW;
95
+ ret.dH = this->dH;
96
+ ret.dW = this->dW;
97
+ ret.padH = this->padH;
98
+ ret.padW = value;
99
+ return ret;
100
+ }
101
+
102
+ int64_t kH;
103
+ int64_t kW;
104
+ int64_t dH;
105
+ int64_t dW;
106
+ int64_t padH;
107
+ int64_t padW;
108
+ };
109
+ using meta_return_ty = precompute_out <true, true, true, true, true, true>;
110
+ meta_return_ty meta(const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef stride, at::IntArrayRef padding, bool ceil_mode, bool count_include_pad, c10::optional<int64_t> divisor_override);
111
+ };
112
+
113
+ } // namespace native
114
+ } // namespace at
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/avg_pool3d_backward_meta_dispatch.h ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunction.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ // Forward declarations of any types needed in the operator signatures.
12
+ // We can't directly include these classes because it will cause circular include dependencies.
13
+ // This file is included by TensorBody.h, which defines the Tensor class.
14
+ #include <ATen/core/ATen_fwd.h>
15
+
16
+ namespace at {
17
+
18
+ namespace meta {
19
+
20
+ TORCH_API at::Tensor avg_pool3d_backward(const at::Tensor & grad_output, const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef stride, at::IntArrayRef padding, bool ceil_mode, bool count_include_pad, c10::optional<int64_t> divisor_override);
21
+ TORCH_API at::Tensor & avg_pool3d_backward_out(at::Tensor & grad_input, const at::Tensor & grad_output, const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef stride, at::IntArrayRef padding, bool ceil_mode, bool count_include_pad, c10::optional<int64_t> divisor_override);
22
+ TORCH_API at::Tensor & avg_pool3d_backward_outf(const at::Tensor & grad_output, const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef stride, at::IntArrayRef padding, bool ceil_mode, bool count_include_pad, c10::optional<int64_t> divisor_override, at::Tensor & grad_input);
23
+
24
+ } // namespace meta
25
+ } // namespace at
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/bilinear_native.h ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from NativeFunction.h
4
+
5
+ #include <c10/core/Scalar.h>
6
+ #include <c10/core/Storage.h>
7
+ #include <c10/core/TensorOptions.h>
8
+ #include <c10/util/Deprecated.h>
9
+ #include <c10/util/Optional.h>
10
+ #include <c10/core/QScheme.h>
11
+ #include <ATen/core/Reduction.h>
12
+ #include <ATen/core/Tensor.h>
13
+ #include <tuple>
14
+ #include <vector>
15
+
16
+
17
+ namespace at {
18
+ namespace native {
19
+ TORCH_API at::Tensor bilinear(const at::Tensor & input1, const at::Tensor & input2, const at::Tensor & weight, const c10::optional<at::Tensor> & bias={});
20
+ } // namespace native
21
+ } // namespace at
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/bmm_cpu_dispatch.h ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunction.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ // Forward declarations of any types needed in the operator signatures.
12
+ // We can't directly include these classes because it will cause circular include dependencies.
13
+ // This file is included by TensorBody.h, which defines the Tensor class.
14
+ #include <ATen/core/ATen_fwd.h>
15
+
16
+ namespace at {
17
+
18
+ namespace cpu {
19
+
20
+ TORCH_API at::Tensor bmm(const at::Tensor & self, const at::Tensor & mat2);
21
+ TORCH_API at::Tensor & bmm_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & mat2);
22
+ TORCH_API at::Tensor & bmm_outf(const at::Tensor & self, const at::Tensor & mat2, at::Tensor & out);
23
+
24
+ } // namespace cpu
25
+ } // namespace at
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/ccol_indices_copy_ops.h ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Operator.h
4
+
5
+ #include <tuple>
6
+ #include <vector>
7
+
8
+ // Forward declarations of any types needed in the operator signatures.
9
+ // We can't directly include these classes because it will cause circular include dependencies.
10
+ // This file is included by TensorBody.h, which defines the Tensor class.
11
+ #include <ATen/core/ATen_fwd.h>
12
+
13
+ namespace at {
14
+ namespace _ops {
15
+
16
+
17
+ struct TORCH_API ccol_indices_copy {
18
+ using schema = at::Tensor (const at::Tensor &);
19
+ using ptr_schema = schema*;
20
+ // See Note [static constexpr char* members for windows NVCC]
21
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::ccol_indices_copy")
22
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
23
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "ccol_indices_copy(Tensor self) -> Tensor")
24
+ static at::Tensor call(const at::Tensor & self);
25
+ static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self);
26
+ };
27
+
28
+ struct TORCH_API ccol_indices_copy_out {
29
+ using schema = at::Tensor & (const at::Tensor &, at::Tensor &);
30
+ using ptr_schema = schema*;
31
+ // See Note [static constexpr char* members for windows NVCC]
32
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::ccol_indices_copy")
33
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out")
34
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "ccol_indices_copy.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)")
35
+ static at::Tensor & call(const at::Tensor & self, at::Tensor & out);
36
+ static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, at::Tensor & out);
37
+ };
38
+
39
+ }} // namespace at::_ops
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/channel_shuffle_cuda_dispatch.h ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunction.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ // Forward declarations of any types needed in the operator signatures.
12
+ // We can't directly include these classes because it will cause circular include dependencies.
13
+ // This file is included by TensorBody.h, which defines the Tensor class.
14
+ #include <ATen/core/ATen_fwd.h>
15
+
16
+ namespace at {
17
+
18
+ namespace cuda {
19
+
20
+ TORCH_API at::Tensor channel_shuffle(const at::Tensor & self, int64_t groups);
21
+ TORCH_API at::Tensor channel_shuffle_symint(const at::Tensor & self, c10::SymInt groups);
22
+
23
+ } // namespace cuda
24
+ } // namespace at
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/clone.h ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Function.h
4
+
5
+ #include <ATen/Context.h>
6
+ #include <ATen/DeviceGuard.h>
7
+ #include <ATen/TensorUtils.h>
8
+ #include <ATen/TracerMode.h>
9
+ #include <ATen/core/Generator.h>
10
+ #include <ATen/core/Reduction.h>
11
+ #include <ATen/core/Tensor.h>
12
+ #include <c10/core/Scalar.h>
13
+ #include <c10/core/Storage.h>
14
+ #include <c10/core/TensorOptions.h>
15
+ #include <c10/util/Deprecated.h>
16
+ #include <c10/util/Optional.h>
17
+
18
+
19
+
20
+ #include <ATen/ops/clone_ops.h>
21
+
22
+ namespace at {
23
+
24
+
25
+ // aten::clone(Tensor self, *, MemoryFormat? memory_format=None) -> Tensor
26
+ inline at::Tensor clone(const at::Tensor & self, c10::optional<at::MemoryFormat> memory_format=c10::nullopt) {
27
+ return at::_ops::clone::call(self, memory_format);
28
+ }
29
+
30
+ // aten::clone.out(Tensor self, *, MemoryFormat? memory_format=None, Tensor(a!) out) -> Tensor(a!)
31
+ inline at::Tensor & clone_out(at::Tensor & out, const at::Tensor & self, c10::optional<at::MemoryFormat> memory_format=c10::nullopt) {
32
+ return at::_ops::clone_out::call(self, memory_format, out);
33
+ }
34
+ // aten::clone.out(Tensor self, *, MemoryFormat? memory_format=None, Tensor(a!) out) -> Tensor(a!)
35
+ inline at::Tensor & clone_outf(const at::Tensor & self, c10::optional<at::MemoryFormat> memory_format, at::Tensor & out) {
36
+ return at::_ops::clone_out::call(self, memory_format, out);
37
+ }
38
+
39
+ }
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/copy_sparse_to_sparse.h ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Function.h
4
+
5
+ #include <ATen/Context.h>
6
+ #include <ATen/DeviceGuard.h>
7
+ #include <ATen/TensorUtils.h>
8
+ #include <ATen/TracerMode.h>
9
+ #include <ATen/core/Generator.h>
10
+ #include <ATen/core/Reduction.h>
11
+ #include <ATen/core/Tensor.h>
12
+ #include <c10/core/Scalar.h>
13
+ #include <c10/core/Storage.h>
14
+ #include <c10/core/TensorOptions.h>
15
+ #include <c10/util/Deprecated.h>
16
+ #include <c10/util/Optional.h>
17
+
18
+
19
+
20
+ #include <ATen/ops/copy_sparse_to_sparse_ops.h>
21
+
22
+ namespace at {
23
+
24
+
25
+ // aten::copy_sparse_to_sparse_(Tensor(a!) self, Tensor src, bool non_blocking=False) -> Tensor(a!)
26
+ inline at::Tensor & copy_sparse_to_sparse_(at::Tensor & self, const at::Tensor & src, bool non_blocking=false) {
27
+ return at::_ops::copy_sparse_to_sparse_::call(self, src, non_blocking);
28
+ }
29
+
30
+ // aten::copy_sparse_to_sparse.out(Tensor self, Tensor src, bool non_blocking=False, *, Tensor(a!) out) -> Tensor(a!)
31
+ inline at::Tensor & copy_sparse_to_sparse_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & src, bool non_blocking=false) {
32
+ return at::_ops::copy_sparse_to_sparse_out::call(self, src, non_blocking, out);
33
+ }
34
+ // aten::copy_sparse_to_sparse.out(Tensor self, Tensor src, bool non_blocking=False, *, Tensor(a!) out) -> Tensor(a!)
35
+ inline at::Tensor & copy_sparse_to_sparse_outf(const at::Tensor & self, const at::Tensor & src, bool non_blocking, at::Tensor & out) {
36
+ return at::_ops::copy_sparse_to_sparse_out::call(self, src, non_blocking, out);
37
+ }
38
+
39
+ // aten::copy_sparse_to_sparse(Tensor self, Tensor src, bool non_blocking=False) -> Tensor
40
+ inline at::Tensor copy_sparse_to_sparse(const at::Tensor & self, const at::Tensor & src, bool non_blocking=false) {
41
+ return at::_ops::copy_sparse_to_sparse::call(self, src, non_blocking);
42
+ }
43
+
44
+ }
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/cross_entropy_loss.h ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Function.h
4
+
5
+ #include <ATen/Context.h>
6
+ #include <ATen/DeviceGuard.h>
7
+ #include <ATen/TensorUtils.h>
8
+ #include <ATen/TracerMode.h>
9
+ #include <ATen/core/Generator.h>
10
+ #include <ATen/core/Reduction.h>
11
+ #include <ATen/core/Tensor.h>
12
+ #include <c10/core/Scalar.h>
13
+ #include <c10/core/Storage.h>
14
+ #include <c10/core/TensorOptions.h>
15
+ #include <c10/util/Deprecated.h>
16
+ #include <c10/util/Optional.h>
17
+
18
+
19
+
20
+ #include <ATen/ops/cross_entropy_loss_ops.h>
21
+
22
+ namespace at {
23
+
24
+
25
+ // aten::cross_entropy_loss(Tensor self, Tensor target, Tensor? weight=None, int reduction=Mean, SymInt ignore_index=-100, float label_smoothing=0.0) -> Tensor
26
+ inline at::Tensor cross_entropy_loss(const at::Tensor & self, const at::Tensor & target, const c10::optional<at::Tensor> & weight={}, int64_t reduction=at::Reduction::Mean, int64_t ignore_index=-100, double label_smoothing=0.0) {
27
+ return at::_ops::cross_entropy_loss::call(self, target, weight, reduction, ignore_index, label_smoothing);
28
+ }
29
+ namespace symint {
30
+ template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
31
+ at::Tensor cross_entropy_loss(const at::Tensor & self, const at::Tensor & target, const c10::optional<at::Tensor> & weight={}, int64_t reduction=at::Reduction::Mean, int64_t ignore_index=-100, double label_smoothing=0.0) {
32
+ return at::_ops::cross_entropy_loss::call(self, target, weight, reduction, ignore_index, label_smoothing);
33
+ }
34
+ }
35
+
36
+ // aten::cross_entropy_loss(Tensor self, Tensor target, Tensor? weight=None, int reduction=Mean, SymInt ignore_index=-100, float label_smoothing=0.0) -> Tensor
37
+ inline at::Tensor cross_entropy_loss_symint(const at::Tensor & self, const at::Tensor & target, const c10::optional<at::Tensor> & weight={}, int64_t reduction=at::Reduction::Mean, c10::SymInt ignore_index=-100, double label_smoothing=0.0) {
38
+ return at::_ops::cross_entropy_loss::call(self, target, weight, reduction, ignore_index, label_smoothing);
39
+ }
40
+ namespace symint {
41
+ template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
42
+ at::Tensor cross_entropy_loss(const at::Tensor & self, const at::Tensor & target, const c10::optional<at::Tensor> & weight={}, int64_t reduction=at::Reduction::Mean, c10::SymInt ignore_index=-100, double label_smoothing=0.0) {
43
+ return at::_ops::cross_entropy_loss::call(self, target, weight, reduction, ignore_index, label_smoothing);
44
+ }
45
+ }
46
+
47
+ }
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/cummin_ops.h ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Operator.h
4
+
5
+ #include <tuple>
6
+ #include <vector>
7
+
8
+ // Forward declarations of any types needed in the operator signatures.
9
+ // We can't directly include these classes because it will cause circular include dependencies.
10
+ // This file is included by TensorBody.h, which defines the Tensor class.
11
+ #include <ATen/core/ATen_fwd.h>
12
+
13
+ namespace at {
14
+ namespace _ops {
15
+
16
+
17
+ struct TORCH_API cummin {
18
+ using schema = ::std::tuple<at::Tensor,at::Tensor> (const at::Tensor &, int64_t);
19
+ using ptr_schema = schema*;
20
+ // See Note [static constexpr char* members for windows NVCC]
21
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::cummin")
22
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
23
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "cummin(Tensor self, int dim) -> (Tensor values, Tensor indices)")
24
+ static ::std::tuple<at::Tensor,at::Tensor> call(const at::Tensor & self, int64_t dim);
25
+ static ::std::tuple<at::Tensor,at::Tensor> redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, int64_t dim);
26
+ };
27
+
28
+ struct TORCH_API cummin_out {
29
+ using schema = ::std::tuple<at::Tensor &,at::Tensor &> (const at::Tensor &, int64_t, at::Tensor &, at::Tensor &);
30
+ using ptr_schema = schema*;
31
+ // See Note [static constexpr char* members for windows NVCC]
32
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::cummin")
33
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out")
34
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "cummin.out(Tensor self, int dim, *, Tensor(a!) values, Tensor(b!) indices) -> (Tensor(a!) values, Tensor(b!) indices)")
35
+ static ::std::tuple<at::Tensor &,at::Tensor &> call(const at::Tensor & self, int64_t dim, at::Tensor & values, at::Tensor & indices);
36
+ static ::std::tuple<at::Tensor &,at::Tensor &> redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, int64_t dim, at::Tensor & values, at::Tensor & indices);
37
+ };
38
+
39
+ struct TORCH_API cummin_dimname {
40
+ using schema = ::std::tuple<at::Tensor,at::Tensor> (const at::Tensor &, at::Dimname);
41
+ using ptr_schema = schema*;
42
+ // See Note [static constexpr char* members for windows NVCC]
43
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::cummin")
44
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "dimname")
45
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "cummin.dimname(Tensor self, Dimname dim) -> (Tensor values, Tensor indices)")
46
+ static ::std::tuple<at::Tensor,at::Tensor> call(const at::Tensor & self, at::Dimname dim);
47
+ static ::std::tuple<at::Tensor,at::Tensor> redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, at::Dimname dim);
48
+ };
49
+
50
+ struct TORCH_API cummin_dimname_out {
51
+ using schema = ::std::tuple<at::Tensor &,at::Tensor &> (const at::Tensor &, at::Dimname, at::Tensor &, at::Tensor &);
52
+ using ptr_schema = schema*;
53
+ // See Note [static constexpr char* members for windows NVCC]
54
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::cummin")
55
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "dimname_out")
56
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "cummin.dimname_out(Tensor self, Dimname dim, *, Tensor(a!) values, Tensor(b!) indices) -> (Tensor(a!) values, Tensor(b!) indices)")
57
+ static ::std::tuple<at::Tensor &,at::Tensor &> call(const at::Tensor & self, at::Dimname dim, at::Tensor & values, at::Tensor & indices);
58
+ static ::std::tuple<at::Tensor &,at::Tensor &> redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, at::Dimname dim, at::Tensor & values, at::Tensor & indices);
59
+ };
60
+
61
+ }} // namespace at::_ops
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/fbgemm_linear_fp16_weight_ops.h ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Operator.h
4
+
5
+ #include <tuple>
6
+ #include <vector>
7
+
8
+ // Forward declarations of any types needed in the operator signatures.
9
+ // We can't directly include these classes because it will cause circular include dependencies.
10
+ // This file is included by TensorBody.h, which defines the Tensor class.
11
+ #include <ATen/core/ATen_fwd.h>
12
+
13
+ namespace at {
14
+ namespace _ops {
15
+
16
+
17
+ struct TORCH_API fbgemm_linear_fp16_weight {
18
+ using schema = at::Tensor (const at::Tensor &, const at::Tensor &, const at::Tensor &);
19
+ using ptr_schema = schema*;
20
+ // See Note [static constexpr char* members for windows NVCC]
21
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::fbgemm_linear_fp16_weight")
22
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
23
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "fbgemm_linear_fp16_weight(Tensor input, Tensor packed_weight, Tensor bias) -> Tensor")
24
+ static at::Tensor call(const at::Tensor & input, const at::Tensor & packed_weight, const at::Tensor & bias);
25
+ static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & input, const at::Tensor & packed_weight, const at::Tensor & bias);
26
+ };
27
+
28
+ }} // namespace at::_ops
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/fft_fft.h ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Function.h
4
+
5
+ #include <ATen/Context.h>
6
+ #include <ATen/DeviceGuard.h>
7
+ #include <ATen/TensorUtils.h>
8
+ #include <ATen/TracerMode.h>
9
+ #include <ATen/core/Generator.h>
10
+ #include <ATen/core/Reduction.h>
11
+ #include <ATen/core/Tensor.h>
12
+ #include <c10/core/Scalar.h>
13
+ #include <c10/core/Storage.h>
14
+ #include <c10/core/TensorOptions.h>
15
+ #include <c10/util/Deprecated.h>
16
+ #include <c10/util/Optional.h>
17
+
18
+
19
+
20
+ #include <ATen/ops/fft_fft_ops.h>
21
+
22
+ namespace at {
23
+
24
+
25
+ // aten::fft_fft(Tensor self, SymInt? n=None, int dim=-1, str? norm=None) -> Tensor
26
+ inline at::Tensor fft_fft(const at::Tensor & self, c10::optional<int64_t> n=c10::nullopt, int64_t dim=-1, c10::optional<c10::string_view> norm=c10::nullopt) {
27
+ return at::_ops::fft_fft::call(self, n.has_value() ? c10::make_optional(c10::SymInt(*n)) : c10::nullopt, dim, norm);
28
+ }
29
+ namespace symint {
30
+ template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
31
+ at::Tensor fft_fft(const at::Tensor & self, c10::optional<int64_t> n=c10::nullopt, int64_t dim=-1, c10::optional<c10::string_view> norm=c10::nullopt) {
32
+ return at::_ops::fft_fft::call(self, n.has_value() ? c10::make_optional(c10::SymInt(*n)) : c10::nullopt, dim, norm);
33
+ }
34
+ }
35
+
36
+ // aten::fft_fft(Tensor self, SymInt? n=None, int dim=-1, str? norm=None) -> Tensor
37
+ inline at::Tensor fft_fft_symint(const at::Tensor & self, c10::optional<c10::SymInt> n=c10::nullopt, int64_t dim=-1, c10::optional<c10::string_view> norm=c10::nullopt) {
38
+ return at::_ops::fft_fft::call(self, n, dim, norm);
39
+ }
40
+ namespace symint {
41
+ template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
42
+ at::Tensor fft_fft(const at::Tensor & self, c10::optional<c10::SymInt> n=c10::nullopt, int64_t dim=-1, c10::optional<c10::string_view> norm=c10::nullopt) {
43
+ return at::_ops::fft_fft::call(self, n, dim, norm);
44
+ }
45
+ }
46
+
47
+ // aten::fft_fft.out(Tensor self, SymInt? n=None, int dim=-1, str? norm=None, *, Tensor(a!) out) -> Tensor(a!)
48
+ inline at::Tensor & fft_fft_out(at::Tensor & out, const at::Tensor & self, c10::optional<int64_t> n=c10::nullopt, int64_t dim=-1, c10::optional<c10::string_view> norm=c10::nullopt) {
49
+ return at::_ops::fft_fft_out::call(self, n.has_value() ? c10::make_optional(c10::SymInt(*n)) : c10::nullopt, dim, norm, out);
50
+ }
51
+ namespace symint {
52
+ template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
53
+ at::Tensor & fft_fft_out(at::Tensor & out, const at::Tensor & self, c10::optional<int64_t> n=c10::nullopt, int64_t dim=-1, c10::optional<c10::string_view> norm=c10::nullopt) {
54
+ return at::_ops::fft_fft_out::call(self, n.has_value() ? c10::make_optional(c10::SymInt(*n)) : c10::nullopt, dim, norm, out);
55
+ }
56
+ }
57
+
58
+ // aten::fft_fft.out(Tensor self, SymInt? n=None, int dim=-1, str? norm=None, *, Tensor(a!) out) -> Tensor(a!)
59
+ inline at::Tensor & fft_fft_outf(const at::Tensor & self, c10::optional<int64_t> n, int64_t dim, c10::optional<c10::string_view> norm, at::Tensor & out) {
60
+ return at::_ops::fft_fft_out::call(self, n.has_value() ? c10::make_optional(c10::SymInt(*n)) : c10::nullopt, dim, norm, out);
61
+ }
62
+ namespace symint {
63
+ template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
64
+ at::Tensor & fft_fft_outf(const at::Tensor & self, c10::optional<int64_t> n, int64_t dim, c10::optional<c10::string_view> norm, at::Tensor & out) {
65
+ return at::_ops::fft_fft_out::call(self, n.has_value() ? c10::make_optional(c10::SymInt(*n)) : c10::nullopt, dim, norm, out);
66
+ }
67
+ }
68
+
69
+ // aten::fft_fft.out(Tensor self, SymInt? n=None, int dim=-1, str? norm=None, *, Tensor(a!) out) -> Tensor(a!)
70
+ inline at::Tensor & fft_fft_symint_out(at::Tensor & out, const at::Tensor & self, c10::optional<c10::SymInt> n=c10::nullopt, int64_t dim=-1, c10::optional<c10::string_view> norm=c10::nullopt) {
71
+ return at::_ops::fft_fft_out::call(self, n, dim, norm, out);
72
+ }
73
+ namespace symint {
74
+ template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
75
+ at::Tensor & fft_fft_out(at::Tensor & out, const at::Tensor & self, c10::optional<c10::SymInt> n=c10::nullopt, int64_t dim=-1, c10::optional<c10::string_view> norm=c10::nullopt) {
76
+ return at::_ops::fft_fft_out::call(self, n, dim, norm, out);
77
+ }
78
+ }
79
+
80
+ // aten::fft_fft.out(Tensor self, SymInt? n=None, int dim=-1, str? norm=None, *, Tensor(a!) out) -> Tensor(a!)
81
+ inline at::Tensor & fft_fft_symint_outf(const at::Tensor & self, c10::optional<c10::SymInt> n, int64_t dim, c10::optional<c10::string_view> norm, at::Tensor & out) {
82
+ return at::_ops::fft_fft_out::call(self, n, dim, norm, out);
83
+ }
84
+ namespace symint {
85
+ template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
86
+ at::Tensor & fft_fft_outf(const at::Tensor & self, c10::optional<c10::SymInt> n, int64_t dim, c10::optional<c10::string_view> norm, at::Tensor & out) {
87
+ return at::_ops::fft_fft_out::call(self, n, dim, norm, out);
88
+ }
89
+ }
90
+
91
+ }
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/flatten_native.h ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from NativeFunction.h
4
+
5
+ #include <c10/core/Scalar.h>
6
+ #include <c10/core/Storage.h>
7
+ #include <c10/core/TensorOptions.h>
8
+ #include <c10/util/Deprecated.h>
9
+ #include <c10/util/Optional.h>
10
+ #include <c10/core/QScheme.h>
11
+ #include <ATen/core/Reduction.h>
12
+ #include <ATen/core/Tensor.h>
13
+ #include <tuple>
14
+ #include <vector>
15
+
16
+
17
+ namespace at {
18
+ namespace native {
19
+ TORCH_API at::Tensor flatten(const at::Tensor & self, int64_t start_dim=0, int64_t end_dim=-1);
20
+ TORCH_API at::Tensor flatten(const at::Tensor & self, int64_t start_dim, int64_t end_dim, at::Dimname out_dim);
21
+ TORCH_API at::Tensor flatten(const at::Tensor & self, at::Dimname start_dim, at::Dimname end_dim, at::Dimname out_dim);
22
+ TORCH_API at::Tensor flatten(const at::Tensor & self, at::DimnameList dims, at::Dimname out_dim);
23
+ } // namespace native
24
+ } // namespace at
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/gather_cpu_dispatch.h ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunction.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ // Forward declarations of any types needed in the operator signatures.
12
+ // We can't directly include these classes because it will cause circular include dependencies.
13
+ // This file is included by TensorBody.h, which defines the Tensor class.
14
+ #include <ATen/core/ATen_fwd.h>
15
+
16
+ namespace at {
17
+
18
+ namespace cpu {
19
+
20
+ TORCH_API at::Tensor gather(const at::Tensor & self, int64_t dim, const at::Tensor & index, bool sparse_grad=false);
21
+ TORCH_API at::Tensor & gather_out(at::Tensor & out, const at::Tensor & self, int64_t dim, const at::Tensor & index, bool sparse_grad=false);
22
+ TORCH_API at::Tensor & gather_outf(const at::Tensor & self, int64_t dim, const at::Tensor & index, bool sparse_grad, at::Tensor & out);
23
+
24
+ } // namespace cpu
25
+ } // namespace at
evalkit_tf437/lib/python3.10/site-packages/torch/include/ATen/ops/ge.h ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Function.h
4
+
5
+ #include <ATen/Context.h>
6
+ #include <ATen/DeviceGuard.h>
7
+ #include <ATen/TensorUtils.h>
8
+ #include <ATen/TracerMode.h>
9
+ #include <ATen/core/Generator.h>
10
+ #include <ATen/core/Reduction.h>
11
+ #include <ATen/core/Tensor.h>
12
+ #include <c10/core/Scalar.h>
13
+ #include <c10/core/Storage.h>
14
+ #include <c10/core/TensorOptions.h>
15
+ #include <c10/util/Deprecated.h>
16
+ #include <c10/util/Optional.h>
17
+
18
+
19
+
20
+ #include <ATen/ops/ge_ops.h>
21
+
22
+ namespace at {
23
+
24
+
25
+ // aten::ge.Scalar_out(Tensor self, Scalar other, *, Tensor(a!) out) -> Tensor(a!)
26
+ inline at::Tensor & ge_out(at::Tensor & out, const at::Tensor & self, const at::Scalar & other) {
27
+ return at::_ops::ge_Scalar_out::call(self, other, out);
28
+ }
29
+ // aten::ge.Scalar_out(Tensor self, Scalar other, *, Tensor(a!) out) -> Tensor(a!)
30
+ inline at::Tensor & ge_outf(const at::Tensor & self, const at::Scalar & other, at::Tensor & out) {
31
+ return at::_ops::ge_Scalar_out::call(self, other, out);
32
+ }
33
+
34
+ // aten::ge.Scalar(Tensor self, Scalar other) -> Tensor
35
+ inline at::Tensor ge(const at::Tensor & self, const at::Scalar & other) {
36
+ return at::_ops::ge_Scalar::call(self, other);
37
+ }
38
+
39
+ // aten::ge.Tensor_out(Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)
40
+ inline at::Tensor & ge_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & other) {
41
+ return at::_ops::ge_Tensor_out::call(self, other, out);
42
+ }
43
+ // aten::ge.Tensor_out(Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)
44
+ inline at::Tensor & ge_outf(const at::Tensor & self, const at::Tensor & other, at::Tensor & out) {
45
+ return at::_ops::ge_Tensor_out::call(self, other, out);
46
+ }
47
+
48
+ // aten::ge.Tensor(Tensor self, Tensor other) -> Tensor
49
+ inline at::Tensor ge(const at::Tensor & self, const at::Tensor & other) {
50
+ return at::_ops::ge_Tensor::call(self, other);
51
+ }
52
+
53
+ }