Publish 11 evaluated Astra histories with reproducible checkpoint artifacts (part 16)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +19 -0
- shared/package-files/2e/2e88d0c1ed7f4e4b8068130b6210fd68f61897d9fafa2f14015acb2879a18d3a/blob +39 -0
- shared/package-files/2e/2e8cb9fbcd3ba9fee49adc064123d8a063d6473936ef84719fc5c5343c1352f8/blob +61 -0
- shared/package-files/2e/2e8ddec2c108827f8b40160d9e2efdc3be2ee4b4afbee5581747ba822100ad08/blob +127 -0
- shared/package-files/2e/2e8f346967d8aefa3f5bf5314c8b264258a54402618c9e0cb5852018dad8bc68/blob +23 -0
- shared/package-files/2e/2e93737d50bd68e6fba65dcc677e569a85d58f5a9d26ddb307756f823f6f3ad3/blob +25 -0
- shared/package-files/2e/2e94bf106f33025763f512d208285c441f2344c344d4c3f3a67ba778d0589f51/blob +3 -0
- shared/package-files/2e/2e9b428e5ad448f442fdcea301508c046ad8062b56a8b2b560837481ecec51ce/blob +11 -0
- shared/package-files/2e/2e9b54587398ac57cd835fbc70d10cc43a10cc2743b60ba286056819bd100bd3/blob +652 -0
- shared/package-files/2e/2e9d04897257e83b6fec7fe1c0a06913709a4df371b9c90ebfa3c75c9f749ed2/blob +61 -0
- shared/package-files/2e/2ea3f8a48d2e0c35ef80b157a53c54c67b81d74add11c5faea827e4cb5d9562d/blob +0 -0
- shared/package-files/2e/2ea490b3d369e66dd002ea0133404c4a452900f17d7bf3bd6fb0661f2058055f/blob +318 -0
- shared/package-files/2e/2ea4a717a746c15cfa898719b58815519482e2875a2119c5457e6f0885af589d/blob +3 -0
- shared/package-files/2e/2eab602cade8e09484ac61e8c813333e531828c91cfe2e4ffdef8f2908dcb7f7/blob +39 -0
- shared/package-files/2e/2eabb41cdb7633a98cb0d49f3d7938f87853397075d0d4c49227a3abde1d063f/blob +21 -0
- shared/package-files/2e/2eabb4ac0bbc238804fe01626bb3b94c9711d1653350382481b886a819cb3640/blob +22 -0
- shared/package-files/2e/2ead4cdad023d0c362f960157422c50f36596e151be4090d0e1d3ccb83aefe15/blob +91 -0
- shared/package-files/2e/2eb0e1b96a4fa1f4fcc3edbaefaf5094c583a852ee0bcf8715b1cce911477b3b/blob +3 -0
- shared/package-files/2e/2eb40044553fffc467aaf31fad117e24949cfd62b4dfd2a2d94dbad5e0f2151d/blob +23 -0
- shared/package-files/2e/2eb44462c9e559c11b14a7bc2c1d088a551566f12f76d73d3b9672326a8cd5c8/blob +51 -0
- shared/package-files/2e/2eb6246b0764da26e8e0c408cdab10aff3cf03be070dbd5ad8c7dd2e79c470d2/blob +555 -0
- shared/package-files/2e/2eb9c84a7741917b5dba0bce59e464f59198425ced148e72ab2b6869988a3909/blob +19 -0
- shared/package-files/2e/2ebd6a872ab2c28a1b3648fdb007dda2fa05cbdbc17e4cf678775309ceec651b/blob +307 -0
- shared/package-files/2e/2ebdb2ff589719bc9cd931b5d7f2dec8183b217151fbed270d48fbd8a30d69a5/blob +540 -0
- shared/package-files/2e/2ec42712829628685d7aa1a131cebc02ac33e0cad39c4b36d0a0186c58941f3a/blob +28 -0
- shared/package-files/2e/2ec7d9373df55b89d3f35d5c1ebb6f82a85598f4e0f6b062a189c1781010379b/blob +264 -0
- shared/package-files/2e/2ecb5434dae88d16cfebb2396f2566564d98a62b0ebc1a9a8ca3a181f26d132c/property_features.py +23 -0
- shared/package-files/2e/2ecc26b4441f97c8a50f772ad29f9b8e47afdf44fa9a0da2162d1208e56e830d/blob +28 -0
- shared/package-files/2e/2ecea44b99a5e2e19f8c2f0afc0dfca30e880a4ee73535900ab9e10f4dc32449/blob +25 -0
- shared/package-files/2e/2ed0833b84de3212d60224c6889113dd83fc44ee93dce42a99da49f091f7f758/blob +40 -0
- shared/package-files/2e/2ed0f84625acfeb439f191192e9fbfd4171ed41d79b78192d56a62c475bcf758/blob +61 -0
- shared/package-files/2e/2ed374ea5c33373f68633f4045e4128b3a72f5bedcd7c4caa52a8039c64c89b0/blob +23 -0
- shared/package-files/2e/2ed5ed8d31bfe29f23cd375465f0d0154512f2355c509d543080b375b028dd55/blob +273 -0
- shared/package-files/2e/2ed7720a8f3906b5d0b3aae51fad589bef0aa961c7e8fc003a30f44318487733/blob +0 -0
- shared/package-files/2e/2edaf7151e34a33e0bace52ba5949e4770a644cb53d4792fb8e4ed6404538ae5/blob +39 -0
- shared/package-files/2e/2edb767a89d7bc06e14532908fbe151f6f7d3412bd982c785d809dc945cb4385/blob +155 -0
- shared/package-files/2e/2edea89ce24ba152444e003c144de0693cc49f1990857c8b4417ba4f4f91dfee/blob +0 -0
- shared/package-files/2e/2ee1a46e823643a77ad24420c0c0ee772fb97846e2c5a68218fefc0b01e58ba7/blob +724 -0
- shared/package-files/2e/2ee356ffa2491a5a60bdf7d7febfac426824904738615a0c1d07aef6bda3b76f/blob +6 -0
- shared/package-files/2e/2ee441783df4613b7b64a908cb440f239714a0274391c154a613c5dcfe951e65/blob +11 -0
- shared/package-files/2e/2ee4f4c3ffc032d6b09ec04ca1b844316f60a76ca4d26039651cf0178e5cd142/blob +14 -0
- shared/package-files/2e/2ee656f28f77559662edc6043f7d1dbca5939bb330d532e60ade546970f10898/blob +20 -0
- shared/package-files/2e/2ee70fb03381b96701b9b9e0a686dac6d4f43e356d81170f06725fed88f01d2c/blob +0 -0
- shared/package-files/2e/2ee7953a85601960c1c106fc385c1791529f567df708cd4b9307f5f80f3ab514/blob +91 -0
- shared/package-files/2e/2ee8cbfb3974ecd0a735b3057ed88de45ab044b3125f2ae4c219f206df1c3ccb/blob +28 -0
- shared/package-files/2e/2eed6198a6a99a5937fe377515c20f6eb9f3f3d595953342c18e3a0f84c56df1/blob +38 -0
- shared/package-files/2e/2eed95d9d64b0c4dcd8a7ebf8476d10ba5762f6eefeaf35c3f44abc9f45f8fb6/blob +24 -0
- shared/package-files/2e/2eee023a23bca6fcc91e7cbd517a975efeaff648fa41ce8fbc2b0976dba35c7a/blob +7 -0
- shared/package-files/2e/2ef4c53f7fe3a7267b835cffebe135d5227ca23ad5243f61cf4a4427b55500dc/blob +0 -0
- shared/package-files/2e/2ef68fc1f8ccdabef7c89c1330dbb54a20cacd65aace12418cdfe48af9d8b32a/blob +0 -0
.gitattributes
CHANGED
|
@@ -252,3 +252,22 @@ shared/package-files/2d/2d1384f65f1897f0ebd3685461cdedefd4c38e9148004d66478721a5
|
|
| 252 |
shared/package-files/2d/2dafd96242e798bd6badf82ca2e58a75f7ae39b59e85a15a04ab6724ba6a67f1/blob filter=lfs diff=lfs merge=lfs -text
|
| 253 |
shared/package-files/2d/2df214270d7c2fc2dba566a047d23e2a1ae88d8de5b64a95325511838a6e3129/blob filter=lfs diff=lfs merge=lfs -text
|
| 254 |
shared/package-files/2e/2e744a910df689584b5e7f45e62723e8fcfb1951f82bbc5e5f0b385caa27a15a/blob filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 252 |
shared/package-files/2d/2dafd96242e798bd6badf82ca2e58a75f7ae39b59e85a15a04ab6724ba6a67f1/blob filter=lfs diff=lfs merge=lfs -text
|
| 253 |
shared/package-files/2d/2df214270d7c2fc2dba566a047d23e2a1ae88d8de5b64a95325511838a6e3129/blob filter=lfs diff=lfs merge=lfs -text
|
| 254 |
shared/package-files/2e/2e744a910df689584b5e7f45e62723e8fcfb1951f82bbc5e5f0b385caa27a15a/blob filter=lfs diff=lfs merge=lfs -text
|
| 255 |
+
shared/package-files/2e/2e94bf106f33025763f512d208285c441f2344c344d4c3f3a67ba778d0589f51/blob filter=lfs diff=lfs merge=lfs -text
|
| 256 |
+
shared/package-files/2e/2ea4a717a746c15cfa898719b58815519482e2875a2119c5457e6f0885af589d/blob filter=lfs diff=lfs merge=lfs -text
|
| 257 |
+
shared/package-files/2e/2eb0e1b96a4fa1f4fcc3edbaefaf5094c583a852ee0bcf8715b1cce911477b3b/blob filter=lfs diff=lfs merge=lfs -text
|
| 258 |
+
shared/package-files/2f/2f1a92c18f01c13c9a89908fb86a7309ae5b89a882db9914114957bc4b6fed92/blob filter=lfs diff=lfs merge=lfs -text
|
| 259 |
+
shared/package-files/2f/2f1d086b642fd7ca8cde9c3c1bfbdda86f9178e42ffb035d2e285e27180f71ff/blob filter=lfs diff=lfs merge=lfs -text
|
| 260 |
+
shared/package-files/2f/2f2ed822742486b148167fa34eb9725a66c2686afbc4f12f2c94466d38dcb522/blob filter=lfs diff=lfs merge=lfs -text
|
| 261 |
+
shared/package-files/2f/2f31a0f1567cea4ce99391a914d6f783de2d33543ae3a690ca11ba51fc284327/blob filter=lfs diff=lfs merge=lfs -text
|
| 262 |
+
shared/package-files/2f/2f49d9e22c0ac3805fd499e23815b6310a447dad1a85541b6aadd6c7968c1ef7/blob filter=lfs diff=lfs merge=lfs -text
|
| 263 |
+
shared/package-files/2f/2f626635294596acca06c371a1312462b11e6cd919678eb3e244d61d4e0a2db5/blob filter=lfs diff=lfs merge=lfs -text
|
| 264 |
+
shared/package-files/2f/2f78bbcbca0c663f15bb1744612a35e97581a1063b99c05b6d560bc417976aa2/blob filter=lfs diff=lfs merge=lfs -text
|
| 265 |
+
shared/package-files/2f/2f78f2961eda0d1fbe672fd4e14692d4c36f2a6a6a570e634cb347bec89c7e35/blob filter=lfs diff=lfs merge=lfs -text
|
| 266 |
+
shared/package-files/2f/2f84ea0d0e55dfc231a9e4a351e6034c21fd9e9efd3f84958c10ea43fb7b1a99/blob filter=lfs diff=lfs merge=lfs -text
|
| 267 |
+
shared/package-files/2f/2fb9b38eba1d1b12b464d7828efc94a3c8306599909bbc7db311fab71d96d061/blob filter=lfs diff=lfs merge=lfs -text
|
| 268 |
+
shared/package-files/2f/2fbf3905d18dcba8e6899424c9ba60c25bce67893e84a22fbb8ea6a4a8a29b2e/blob filter=lfs diff=lfs merge=lfs -text
|
| 269 |
+
shared/package-files/30/30aa6a82e55c9b6882c41c9aaf9e9137c4c8c4545b627542d6b23ef5743b0acc/blob filter=lfs diff=lfs merge=lfs -text
|
| 270 |
+
shared/package-files/30/30e2c5853b7762551f32be245e79fd9d06e52a7cfdfd9c31bfece83405563292/blob filter=lfs diff=lfs merge=lfs -text
|
| 271 |
+
shared/package-files/31/3196378de7c8f842481203abc471a1e1b5f231b4c1da26fd6812cc90df38e012/blob filter=lfs diff=lfs merge=lfs -text
|
| 272 |
+
shared/package-files/31/31977145330b3a430a9088dcab494e4598947e5084b79e19958f694840c249e6/blob filter=lfs diff=lfs merge=lfs -text
|
| 273 |
+
shared/package-files/31/31b8c3d177e2f59d9cff0198d08c057aafd81f9098b9ad34eae9d7a4a7b10120/blob filter=lfs diff=lfs merge=lfs -text
|
shared/package-files/2e/2e88d0c1ed7f4e4b8068130b6210fd68f61897d9fafa2f14015acb2879a18d3a/blob
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 mkldnn_max_pool3d {
|
| 18 |
+
using schema = at::Tensor (const at::Tensor &, at::IntArrayRef, at::IntArrayRef, at::IntArrayRef, at::IntArrayRef, bool);
|
| 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::mkldnn_max_pool3d")
|
| 22 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
|
| 23 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "mkldnn_max_pool3d(Tensor self, int[3] kernel_size, int[3] stride=[], int[3] padding=0, int[3] dilation=1, bool ceil_mode=False) -> Tensor")
|
| 24 |
+
static at::Tensor call(const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef stride, at::IntArrayRef padding, at::IntArrayRef dilation, bool ceil_mode);
|
| 25 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef stride, at::IntArrayRef padding, at::IntArrayRef dilation, bool ceil_mode);
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
struct TORCH_API mkldnn_max_pool3d_out {
|
| 29 |
+
using schema = at::Tensor & (const at::Tensor &, at::IntArrayRef, at::IntArrayRef, at::IntArrayRef, at::IntArrayRef, bool, 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::mkldnn_max_pool3d")
|
| 33 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out")
|
| 34 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "mkldnn_max_pool3d.out(Tensor self, int[3] kernel_size, int[3] stride=[], int[3] padding=0, int[3] dilation=1, bool ceil_mode=False, *, Tensor(a!) out) -> Tensor(a!)")
|
| 35 |
+
static at::Tensor & call(const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef stride, at::IntArrayRef padding, at::IntArrayRef dilation, bool ceil_mode, at::Tensor & out);
|
| 36 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef stride, at::IntArrayRef padding, at::IntArrayRef dilation, bool ceil_mode, at::Tensor & out);
|
| 37 |
+
};
|
| 38 |
+
|
| 39 |
+
}} // namespace at::_ops
|
shared/package-files/2e/2e8cb9fbcd3ba9fee49adc064123d8a063d6473936ef84719fc5c5343c1352f8/blob
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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/blackman_window_ops.h>
|
| 21 |
+
|
| 22 |
+
namespace at {
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
// aten::blackman_window(int window_length, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor
|
| 26 |
+
inline at::Tensor blackman_window(int64_t window_length, at::TensorOptions options={}) {
|
| 27 |
+
return at::_ops::blackman_window::call(window_length, c10::optTypeMetaToScalarType(options.dtype_opt()), options.layout_opt(), options.device_opt(), options.pinned_memory_opt());
|
| 28 |
+
}
|
| 29 |
+
// aten::blackman_window(int window_length, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor
|
| 30 |
+
inline at::Tensor blackman_window(int64_t window_length, c10::optional<at::ScalarType> dtype, c10::optional<at::Layout> layout, c10::optional<at::Device> device, c10::optional<bool> pin_memory) {
|
| 31 |
+
return at::_ops::blackman_window::call(window_length, dtype, layout, device, pin_memory);
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
// aten::blackman_window.periodic(int window_length, bool periodic, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor
|
| 35 |
+
inline at::Tensor blackman_window(int64_t window_length, bool periodic, at::TensorOptions options={}) {
|
| 36 |
+
return at::_ops::blackman_window_periodic::call(window_length, periodic, c10::optTypeMetaToScalarType(options.dtype_opt()), options.layout_opt(), options.device_opt(), options.pinned_memory_opt());
|
| 37 |
+
}
|
| 38 |
+
// aten::blackman_window.periodic(int window_length, bool periodic, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor
|
| 39 |
+
inline at::Tensor blackman_window(int64_t window_length, bool periodic, c10::optional<at::ScalarType> dtype, c10::optional<at::Layout> layout, c10::optional<at::Device> device, c10::optional<bool> pin_memory) {
|
| 40 |
+
return at::_ops::blackman_window_periodic::call(window_length, periodic, dtype, layout, device, pin_memory);
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
// aten::blackman_window.out(int window_length, *, Tensor(a!) out) -> Tensor(a!)
|
| 44 |
+
inline at::Tensor & blackman_window_out(at::Tensor & out, int64_t window_length) {
|
| 45 |
+
return at::_ops::blackman_window_out::call(window_length, out);
|
| 46 |
+
}
|
| 47 |
+
// aten::blackman_window.out(int window_length, *, Tensor(a!) out) -> Tensor(a!)
|
| 48 |
+
inline at::Tensor & blackman_window_outf(int64_t window_length, at::Tensor & out) {
|
| 49 |
+
return at::_ops::blackman_window_out::call(window_length, out);
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
// aten::blackman_window.periodic_out(int window_length, bool periodic, *, Tensor(a!) out) -> Tensor(a!)
|
| 53 |
+
inline at::Tensor & blackman_window_out(at::Tensor & out, int64_t window_length, bool periodic) {
|
| 54 |
+
return at::_ops::blackman_window_periodic_out::call(window_length, periodic, out);
|
| 55 |
+
}
|
| 56 |
+
// aten::blackman_window.periodic_out(int window_length, bool periodic, *, Tensor(a!) out) -> Tensor(a!)
|
| 57 |
+
inline at::Tensor & blackman_window_outf(int64_t window_length, bool periodic, at::Tensor & out) {
|
| 58 |
+
return at::_ops::blackman_window_periodic_out::call(window_length, periodic, out);
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
}
|
shared/package-files/2e/2e8ddec2c108827f8b40160d9e2efdc3be2ee4b4afbee5581747ba822100ad08/blob
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from collections import deque
|
| 4 |
+
from functools import wraps
|
| 5 |
+
from typing import Any, Callable, Dict, Generic, Hashable, Tuple, TypeVar, cast
|
| 6 |
+
|
| 7 |
+
__all__ = [
|
| 8 |
+
"SimpleCache",
|
| 9 |
+
"FastDictCache",
|
| 10 |
+
"memoized",
|
| 11 |
+
]
|
| 12 |
+
|
| 13 |
+
_T = TypeVar("_T", bound=Hashable)
|
| 14 |
+
_U = TypeVar("_U")
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class SimpleCache(Generic[_T, _U]):
|
| 18 |
+
"""
|
| 19 |
+
Very simple cache that discards the oldest item when the cache size is
|
| 20 |
+
exceeded.
|
| 21 |
+
|
| 22 |
+
:param maxsize: Maximum size of the cache. (Don't make it too big.)
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
def __init__(self, maxsize: int = 8) -> None:
|
| 26 |
+
assert maxsize > 0
|
| 27 |
+
|
| 28 |
+
self._data: dict[_T, _U] = {}
|
| 29 |
+
self._keys: deque[_T] = deque()
|
| 30 |
+
self.maxsize: int = maxsize
|
| 31 |
+
|
| 32 |
+
def get(self, key: _T, getter_func: Callable[[], _U]) -> _U:
|
| 33 |
+
"""
|
| 34 |
+
Get object from the cache.
|
| 35 |
+
If not found, call `getter_func` to resolve it, and put that on the top
|
| 36 |
+
of the cache instead.
|
| 37 |
+
"""
|
| 38 |
+
# Look in cache first.
|
| 39 |
+
try:
|
| 40 |
+
return self._data[key]
|
| 41 |
+
except KeyError:
|
| 42 |
+
# Not found? Get it.
|
| 43 |
+
value = getter_func()
|
| 44 |
+
self._data[key] = value
|
| 45 |
+
self._keys.append(key)
|
| 46 |
+
|
| 47 |
+
# Remove the oldest key when the size is exceeded.
|
| 48 |
+
if len(self._data) > self.maxsize:
|
| 49 |
+
key_to_remove = self._keys.popleft()
|
| 50 |
+
if key_to_remove in self._data:
|
| 51 |
+
del self._data[key_to_remove]
|
| 52 |
+
|
| 53 |
+
return value
|
| 54 |
+
|
| 55 |
+
def clear(self) -> None:
|
| 56 |
+
"Clear cache."
|
| 57 |
+
self._data = {}
|
| 58 |
+
self._keys = deque()
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
_K = TypeVar("_K", bound=Tuple[Hashable, ...])
|
| 62 |
+
_V = TypeVar("_V")
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
class FastDictCache(Dict[_K, _V]):
|
| 66 |
+
"""
|
| 67 |
+
Fast, lightweight cache which keeps at most `size` items.
|
| 68 |
+
It will discard the oldest items in the cache first.
|
| 69 |
+
|
| 70 |
+
The cache is a dictionary, which doesn't keep track of access counts.
|
| 71 |
+
It is perfect to cache little immutable objects which are not expensive to
|
| 72 |
+
create, but where a dictionary lookup is still much faster than an object
|
| 73 |
+
instantiation.
|
| 74 |
+
|
| 75 |
+
:param get_value: Callable that's called in case of a missing key.
|
| 76 |
+
"""
|
| 77 |
+
|
| 78 |
+
# NOTE: This cache is used to cache `prompt_toolkit.layout.screen.Char` and
|
| 79 |
+
# `prompt_toolkit.Document`. Make sure to keep this really lightweight.
|
| 80 |
+
# Accessing the cache should stay faster than instantiating new
|
| 81 |
+
# objects.
|
| 82 |
+
# (Dictionary lookups are really fast.)
|
| 83 |
+
# SimpleCache is still required for cases where the cache key is not
|
| 84 |
+
# the same as the arguments given to the function that creates the
|
| 85 |
+
# value.)
|
| 86 |
+
def __init__(self, get_value: Callable[..., _V], size: int = 1000000) -> None:
|
| 87 |
+
assert size > 0
|
| 88 |
+
|
| 89 |
+
self._keys: deque[_K] = deque()
|
| 90 |
+
self.get_value = get_value
|
| 91 |
+
self.size = size
|
| 92 |
+
|
| 93 |
+
def __missing__(self, key: _K) -> _V:
|
| 94 |
+
# Remove the oldest key when the size is exceeded.
|
| 95 |
+
if len(self) > self.size:
|
| 96 |
+
key_to_remove = self._keys.popleft()
|
| 97 |
+
if key_to_remove in self:
|
| 98 |
+
del self[key_to_remove]
|
| 99 |
+
|
| 100 |
+
result = self.get_value(*key)
|
| 101 |
+
self[key] = result
|
| 102 |
+
self._keys.append(key)
|
| 103 |
+
return result
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
_F = TypeVar("_F", bound=Callable[..., object])
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def memoized(maxsize: int = 1024) -> Callable[[_F], _F]:
|
| 110 |
+
"""
|
| 111 |
+
Memoization decorator for immutable classes and pure functions.
|
| 112 |
+
"""
|
| 113 |
+
|
| 114 |
+
def decorator(obj: _F) -> _F:
|
| 115 |
+
cache: SimpleCache[Hashable, Any] = SimpleCache(maxsize=maxsize)
|
| 116 |
+
|
| 117 |
+
@wraps(obj)
|
| 118 |
+
def new_callable(*a: Any, **kw: Any) -> Any:
|
| 119 |
+
def create_new() -> Any:
|
| 120 |
+
return obj(*a, **kw)
|
| 121 |
+
|
| 122 |
+
key = (a, tuple(sorted(kw.items())))
|
| 123 |
+
return cache.get(key, create_new)
|
| 124 |
+
|
| 125 |
+
return cast(_F, new_callable)
|
| 126 |
+
|
| 127 |
+
return decorator
|
shared/package-files/2e/2e8f346967d8aefa3f5bf5314c8b264258a54402618c9e0cb5852018dad8bc68/blob
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 _nested_tensor_from_mask(const at::Tensor & t, const at::Tensor & mask, bool mask_check=true);
|
| 21 |
+
|
| 22 |
+
} // namespace cuda
|
| 23 |
+
} // namespace at
|
shared/package-files/2e/2e93737d50bd68e6fba65dcc677e569a85d58f5a9d26ddb307756f823f6f3ad3/blob
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
#include <ATen/ops/hardsigmoid_meta.h>
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
namespace native {
|
| 19 |
+
struct TORCH_API structured_hardsigmoid_out : public at::meta::structured_hardsigmoid {
|
| 20 |
+
void impl(const at::Tensor & self, const at::Tensor & out);
|
| 21 |
+
};
|
| 22 |
+
TORCH_API at::Tensor hardsigmoid_quantized_cpu(const at::Tensor & self);
|
| 23 |
+
TORCH_API at::Tensor & hardsigmoid_out_quantized_cpu(const at::Tensor & self, at::Tensor & out);
|
| 24 |
+
} // namespace native
|
| 25 |
+
} // namespace at
|
shared/package-files/2e/2e94bf106f33025763f512d208285c441f2344c344d4c3f3a67ba778d0589f51/blob
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2e94bf106f33025763f512d208285c441f2344c344d4c3f3a67ba778d0589f51
|
| 3 |
+
size 695056
|
shared/package-files/2e/2e9b428e5ad448f442fdcea301508c046ad8062b56a8b2b560837481ecec51ce/blob
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from packaging.version import Version, parse
|
| 2 |
+
|
| 3 |
+
try:
|
| 4 |
+
import matplotlib as mpl
|
| 5 |
+
|
| 6 |
+
version = parse(mpl.__version__)
|
| 7 |
+
MPL_LT_310 = version < Version("3.9.99")
|
| 8 |
+
except ImportError:
|
| 9 |
+
MPL_LT_310 = False
|
| 10 |
+
|
| 11 |
+
__all__ = ["MPL_LT_310"]
|
shared/package-files/2e/2e9b54587398ac57cd835fbc70d10cc43a10cc2743b60ba286056819bd100bd3/blob
ADDED
|
@@ -0,0 +1,652 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from sympy.core import (
|
| 2 |
+
Basic, Rational, Symbol, S, Float, Integer, Mul, Number, Pow,
|
| 3 |
+
Expr, I, nan, pi, symbols, oo, zoo, N)
|
| 4 |
+
from sympy.core.parameters import global_parameters
|
| 5 |
+
from sympy.core.tests.test_evalf import NS
|
| 6 |
+
from sympy.core.function import expand_multinomial
|
| 7 |
+
from sympy.functions.elementary.miscellaneous import sqrt, cbrt
|
| 8 |
+
from sympy.functions.elementary.exponential import exp, log
|
| 9 |
+
from sympy.functions.special.error_functions import erf
|
| 10 |
+
from sympy.functions.elementary.trigonometric import (
|
| 11 |
+
sin, cos, tan, sec, csc, atan)
|
| 12 |
+
from sympy.functions.elementary.hyperbolic import cosh, sinh, tanh
|
| 13 |
+
from sympy.polys import Poly
|
| 14 |
+
from sympy.series.order import O
|
| 15 |
+
from sympy.sets import FiniteSet
|
| 16 |
+
from sympy.core.power import power, integer_nthroot
|
| 17 |
+
from sympy.testing.pytest import warns, _both_exp_pow
|
| 18 |
+
from sympy.utilities.exceptions import SymPyDeprecationWarning
|
| 19 |
+
from sympy.abc import a, b, c, x, y
|
| 20 |
+
|
| 21 |
+
def test_rational():
|
| 22 |
+
a = Rational(1, 5)
|
| 23 |
+
|
| 24 |
+
r = sqrt(5)/5
|
| 25 |
+
assert sqrt(a) == r
|
| 26 |
+
assert 2*sqrt(a) == 2*r
|
| 27 |
+
|
| 28 |
+
r = a*a**S.Half
|
| 29 |
+
assert a**Rational(3, 2) == r
|
| 30 |
+
assert 2*a**Rational(3, 2) == 2*r
|
| 31 |
+
|
| 32 |
+
r = a**5*a**Rational(2, 3)
|
| 33 |
+
assert a**Rational(17, 3) == r
|
| 34 |
+
assert 2 * a**Rational(17, 3) == 2*r
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def test_large_rational():
|
| 38 |
+
e = (Rational(123712**12 - 1, 7) + Rational(1, 7))**Rational(1, 3)
|
| 39 |
+
assert e == 234232585392159195136 * (Rational(1, 7)**Rational(1, 3))
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def test_negative_real():
|
| 43 |
+
def feq(a, b):
|
| 44 |
+
return abs(a - b) < 1E-10
|
| 45 |
+
|
| 46 |
+
assert feq(S.One / Float(-0.5), -Integer(2))
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
def test_expand():
|
| 50 |
+
assert (2**(-1 - x)).expand() == S.Half*2**(-x)
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def test_issue_3449():
|
| 54 |
+
#test if powers are simplified correctly
|
| 55 |
+
#see also issue 3995
|
| 56 |
+
assert ((x**Rational(1, 3))**Rational(2)) == x**Rational(2, 3)
|
| 57 |
+
assert (
|
| 58 |
+
(x**Rational(3))**Rational(2, 5)) == (x**Rational(3))**Rational(2, 5)
|
| 59 |
+
|
| 60 |
+
a = Symbol('a', real=True)
|
| 61 |
+
b = Symbol('b', real=True)
|
| 62 |
+
assert (a**2)**b == (abs(a)**b)**2
|
| 63 |
+
assert sqrt(1/a) != 1/sqrt(a) # e.g. for a = -1
|
| 64 |
+
assert (a**3)**Rational(1, 3) != a
|
| 65 |
+
assert (x**a)**b != x**(a*b) # e.g. x = -1, a=2, b=1/2
|
| 66 |
+
assert (x**.5)**b == x**(.5*b)
|
| 67 |
+
assert (x**.5)**.5 == x**.25
|
| 68 |
+
assert (x**2.5)**.5 != x**1.25 # e.g. for x = 5*I
|
| 69 |
+
|
| 70 |
+
k = Symbol('k', integer=True)
|
| 71 |
+
m = Symbol('m', integer=True)
|
| 72 |
+
assert (x**k)**m == x**(k*m)
|
| 73 |
+
assert Number(5)**Rational(2, 3) == Number(25)**Rational(1, 3)
|
| 74 |
+
|
| 75 |
+
assert (x**.5)**2 == x**1.0
|
| 76 |
+
assert (x**2)**k == (x**k)**2 == x**(2*k)
|
| 77 |
+
|
| 78 |
+
a = Symbol('a', positive=True)
|
| 79 |
+
assert (a**3)**Rational(2, 5) == a**Rational(6, 5)
|
| 80 |
+
assert (a**2)**b == (a**b)**2
|
| 81 |
+
assert (a**Rational(2, 3))**x == a**(x*Rational(2, 3)) != (a**x)**Rational(2, 3)
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def test_issue_3866():
|
| 85 |
+
assert --sqrt(sqrt(5) - 1) == sqrt(sqrt(5) - 1)
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
def test_negative_one():
|
| 89 |
+
x = Symbol('x', complex=True)
|
| 90 |
+
y = Symbol('y', complex=True)
|
| 91 |
+
assert 1/x**y == x**(-y)
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
def test_issue_4362():
|
| 95 |
+
neg = Symbol('neg', negative=True)
|
| 96 |
+
nonneg = Symbol('nonneg', nonnegative=True)
|
| 97 |
+
any = Symbol('any')
|
| 98 |
+
num, den = sqrt(1/neg).as_numer_denom()
|
| 99 |
+
assert num == sqrt(-1)
|
| 100 |
+
assert den == sqrt(-neg)
|
| 101 |
+
num, den = sqrt(1/nonneg).as_numer_denom()
|
| 102 |
+
assert num == 1
|
| 103 |
+
assert den == sqrt(nonneg)
|
| 104 |
+
num, den = sqrt(1/any).as_numer_denom()
|
| 105 |
+
assert num == sqrt(1/any)
|
| 106 |
+
assert den == 1
|
| 107 |
+
|
| 108 |
+
def eqn(num, den, pow):
|
| 109 |
+
return (num/den)**pow
|
| 110 |
+
npos = 1
|
| 111 |
+
nneg = -1
|
| 112 |
+
dpos = 2 - sqrt(3)
|
| 113 |
+
dneg = 1 - sqrt(3)
|
| 114 |
+
assert dpos > 0 and dneg < 0 and npos > 0 and nneg < 0
|
| 115 |
+
# pos or neg integer
|
| 116 |
+
eq = eqn(npos, dpos, 2)
|
| 117 |
+
assert eq.is_Pow and eq.as_numer_denom() == (1, dpos**2)
|
| 118 |
+
eq = eqn(npos, dneg, 2)
|
| 119 |
+
assert eq.is_Pow and eq.as_numer_denom() == (1, dneg**2)
|
| 120 |
+
eq = eqn(nneg, dpos, 2)
|
| 121 |
+
assert eq.is_Pow and eq.as_numer_denom() == (1, dpos**2)
|
| 122 |
+
eq = eqn(nneg, dneg, 2)
|
| 123 |
+
assert eq.is_Pow and eq.as_numer_denom() == (1, dneg**2)
|
| 124 |
+
eq = eqn(npos, dpos, -2)
|
| 125 |
+
assert eq.is_Pow and eq.as_numer_denom() == (dpos**2, 1)
|
| 126 |
+
eq = eqn(npos, dneg, -2)
|
| 127 |
+
assert eq.is_Pow and eq.as_numer_denom() == (dneg**2, 1)
|
| 128 |
+
eq = eqn(nneg, dpos, -2)
|
| 129 |
+
assert eq.is_Pow and eq.as_numer_denom() == (dpos**2, 1)
|
| 130 |
+
eq = eqn(nneg, dneg, -2)
|
| 131 |
+
assert eq.is_Pow and eq.as_numer_denom() == (dneg**2, 1)
|
| 132 |
+
# pos or neg rational
|
| 133 |
+
pow = S.Half
|
| 134 |
+
eq = eqn(npos, dpos, pow)
|
| 135 |
+
assert eq.is_Pow and eq.as_numer_denom() == (npos**pow, dpos**pow)
|
| 136 |
+
eq = eqn(npos, dneg, pow)
|
| 137 |
+
assert eq.is_Pow is False and eq.as_numer_denom() == ((-npos)**pow, (-dneg)**pow)
|
| 138 |
+
eq = eqn(nneg, dpos, pow)
|
| 139 |
+
assert not eq.is_Pow or eq.as_numer_denom() == (nneg**pow, dpos**pow)
|
| 140 |
+
eq = eqn(nneg, dneg, pow)
|
| 141 |
+
assert eq.is_Pow and eq.as_numer_denom() == ((-nneg)**pow, (-dneg)**pow)
|
| 142 |
+
eq = eqn(npos, dpos, -pow)
|
| 143 |
+
assert eq.is_Pow and eq.as_numer_denom() == (dpos**pow, npos**pow)
|
| 144 |
+
eq = eqn(npos, dneg, -pow)
|
| 145 |
+
assert eq.is_Pow is False and eq.as_numer_denom() == (-(-npos)**pow*(-dneg)**pow, npos)
|
| 146 |
+
eq = eqn(nneg, dpos, -pow)
|
| 147 |
+
assert not eq.is_Pow or eq.as_numer_denom() == (dpos**pow, nneg**pow)
|
| 148 |
+
eq = eqn(nneg, dneg, -pow)
|
| 149 |
+
assert eq.is_Pow and eq.as_numer_denom() == ((-dneg)**pow, (-nneg)**pow)
|
| 150 |
+
# unknown exponent
|
| 151 |
+
pow = 2*any
|
| 152 |
+
eq = eqn(npos, dpos, pow)
|
| 153 |
+
assert eq.is_Pow and eq.as_numer_denom() == (npos**pow, dpos**pow)
|
| 154 |
+
eq = eqn(npos, dneg, pow)
|
| 155 |
+
assert eq.is_Pow and eq.as_numer_denom() == ((-npos)**pow, (-dneg)**pow)
|
| 156 |
+
eq = eqn(nneg, dpos, pow)
|
| 157 |
+
assert eq.is_Pow and eq.as_numer_denom() == (nneg**pow, dpos**pow)
|
| 158 |
+
eq = eqn(nneg, dneg, pow)
|
| 159 |
+
assert eq.is_Pow and eq.as_numer_denom() == ((-nneg)**pow, (-dneg)**pow)
|
| 160 |
+
eq = eqn(npos, dpos, -pow)
|
| 161 |
+
assert eq.as_numer_denom() == (dpos**pow, npos**pow)
|
| 162 |
+
eq = eqn(npos, dneg, -pow)
|
| 163 |
+
assert eq.is_Pow and eq.as_numer_denom() == ((-dneg)**pow, (-npos)**pow)
|
| 164 |
+
eq = eqn(nneg, dpos, -pow)
|
| 165 |
+
assert eq.is_Pow and eq.as_numer_denom() == (dpos**pow, nneg**pow)
|
| 166 |
+
eq = eqn(nneg, dneg, -pow)
|
| 167 |
+
assert eq.is_Pow and eq.as_numer_denom() == ((-dneg)**pow, (-nneg)**pow)
|
| 168 |
+
|
| 169 |
+
assert ((1/(1 + x/3))**(-S.One)).as_numer_denom() == (3 + x, 3)
|
| 170 |
+
notp = Symbol('notp', positive=False) # not positive does not imply real
|
| 171 |
+
b = ((1 + x/notp)**-2)
|
| 172 |
+
assert (b**(-y)).as_numer_denom() == (1, b**y)
|
| 173 |
+
assert (b**(-S.One)).as_numer_denom() == ((notp + x)**2, notp**2)
|
| 174 |
+
nonp = Symbol('nonp', nonpositive=True)
|
| 175 |
+
assert (((1 + x/nonp)**-2)**(-S.One)).as_numer_denom() == ((-nonp -
|
| 176 |
+
x)**2, nonp**2)
|
| 177 |
+
|
| 178 |
+
n = Symbol('n', negative=True)
|
| 179 |
+
assert (x**n).as_numer_denom() == (1, x**-n)
|
| 180 |
+
assert sqrt(1/n).as_numer_denom() == (S.ImaginaryUnit, sqrt(-n))
|
| 181 |
+
n = Symbol('0 or neg', nonpositive=True)
|
| 182 |
+
# if x and n are split up without negating each term and n is negative
|
| 183 |
+
# then the answer might be wrong; if n is 0 it won't matter since
|
| 184 |
+
# 1/oo and 1/zoo are both zero as is sqrt(0)/sqrt(-x) unless x is also
|
| 185 |
+
# zero (in which case the negative sign doesn't matter):
|
| 186 |
+
# 1/sqrt(1/-1) = -I but sqrt(-1)/sqrt(1) = I
|
| 187 |
+
assert (1/sqrt(x/n)).as_numer_denom() == (sqrt(-n), sqrt(-x))
|
| 188 |
+
c = Symbol('c', complex=True)
|
| 189 |
+
e = sqrt(1/c)
|
| 190 |
+
assert e.as_numer_denom() == (e, 1)
|
| 191 |
+
i = Symbol('i', integer=True)
|
| 192 |
+
assert ((1 + x/y)**i).as_numer_denom() == ((x + y)**i, y**i)
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
def test_Pow_Expr_args():
|
| 196 |
+
bases = [Basic(), Poly(x, x), FiniteSet(x)]
|
| 197 |
+
for base in bases:
|
| 198 |
+
# The cache can mess with the stacklevel test
|
| 199 |
+
with warns(SymPyDeprecationWarning, test_stacklevel=False):
|
| 200 |
+
Pow(base, S.One)
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
def test_Pow_signs():
|
| 204 |
+
"""Cf. issues 4595 and 5250"""
|
| 205 |
+
n = Symbol('n', even=True)
|
| 206 |
+
assert (3 - y)**2 != (y - 3)**2
|
| 207 |
+
assert (3 - y)**n != (y - 3)**n
|
| 208 |
+
assert (-3 + y - x)**2 != (3 - y + x)**2
|
| 209 |
+
assert (y - 3)**3 != -(3 - y)**3
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
def test_power_with_noncommutative_mul_as_base():
|
| 213 |
+
x = Symbol('x', commutative=False)
|
| 214 |
+
y = Symbol('y', commutative=False)
|
| 215 |
+
assert not (x*y)**3 == x**3*y**3
|
| 216 |
+
assert (2*x*y)**3 == 8*(x*y)**3
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
@_both_exp_pow
|
| 220 |
+
def test_power_rewrite_exp():
|
| 221 |
+
assert (I**I).rewrite(exp) == exp(-pi/2)
|
| 222 |
+
|
| 223 |
+
expr = (2 + 3*I)**(4 + 5*I)
|
| 224 |
+
assert expr.rewrite(exp) == exp((4 + 5*I)*(log(sqrt(13)) + I*atan(Rational(3, 2))))
|
| 225 |
+
assert expr.rewrite(exp).expand() == \
|
| 226 |
+
169*exp(5*I*log(13)/2)*exp(4*I*atan(Rational(3, 2)))*exp(-5*atan(Rational(3, 2)))
|
| 227 |
+
|
| 228 |
+
assert ((6 + 7*I)**5).rewrite(exp) == 7225*sqrt(85)*exp(5*I*atan(Rational(7, 6)))
|
| 229 |
+
|
| 230 |
+
expr = 5**(6 + 7*I)
|
| 231 |
+
assert expr.rewrite(exp) == exp((6 + 7*I)*log(5))
|
| 232 |
+
assert expr.rewrite(exp).expand() == 15625*exp(7*I*log(5))
|
| 233 |
+
|
| 234 |
+
assert Pow(123, 789, evaluate=False).rewrite(exp) == 123**789
|
| 235 |
+
assert (1**I).rewrite(exp) == 1**I
|
| 236 |
+
assert (0**I).rewrite(exp) == 0**I
|
| 237 |
+
|
| 238 |
+
expr = (-2)**(2 + 5*I)
|
| 239 |
+
assert expr.rewrite(exp) == exp((2 + 5*I)*(log(2) + I*pi))
|
| 240 |
+
assert expr.rewrite(exp).expand() == 4*exp(-5*pi)*exp(5*I*log(2))
|
| 241 |
+
|
| 242 |
+
assert ((-2)**S(-5)).rewrite(exp) == (-2)**S(-5)
|
| 243 |
+
|
| 244 |
+
x, y = symbols('x y')
|
| 245 |
+
assert (x**y).rewrite(exp) == exp(y*log(x))
|
| 246 |
+
if global_parameters.exp_is_pow:
|
| 247 |
+
assert (7**x).rewrite(exp) == Pow(S.Exp1, x*log(7), evaluate=False)
|
| 248 |
+
else:
|
| 249 |
+
assert (7**x).rewrite(exp) == exp(x*log(7), evaluate=False)
|
| 250 |
+
assert ((2 + 3*I)**x).rewrite(exp) == exp(x*(log(sqrt(13)) + I*atan(Rational(3, 2))))
|
| 251 |
+
assert (y**(5 + 6*I)).rewrite(exp) == exp(log(y)*(5 + 6*I))
|
| 252 |
+
|
| 253 |
+
assert all((1/func(x)).rewrite(exp) == 1/(func(x).rewrite(exp)) for func in
|
| 254 |
+
(sin, cos, tan, sec, csc, sinh, cosh, tanh))
|
| 255 |
+
|
| 256 |
+
|
| 257 |
+
def test_zero():
|
| 258 |
+
assert 0**x != 0
|
| 259 |
+
assert 0**(2*x) == 0**x
|
| 260 |
+
assert 0**(1.0*x) == 0**x
|
| 261 |
+
assert 0**(2.0*x) == 0**x
|
| 262 |
+
assert (0**(2 - x)).as_base_exp() == (0, 2 - x)
|
| 263 |
+
assert 0**(x - 2) != S.Infinity**(2 - x)
|
| 264 |
+
assert 0**(2*x*y) == 0**(x*y)
|
| 265 |
+
assert 0**(-2*x*y) == S.ComplexInfinity**(x*y)
|
| 266 |
+
assert Float(0)**2 is not S.Zero
|
| 267 |
+
assert Float(0)**2 == 0.0
|
| 268 |
+
assert Float(0)**-2 is zoo
|
| 269 |
+
assert Float(0)**oo is S.Zero
|
| 270 |
+
|
| 271 |
+
#Test issue 19572
|
| 272 |
+
assert 0 ** -oo is zoo
|
| 273 |
+
assert power(0, -oo) is zoo
|
| 274 |
+
assert Float(0)**-oo is zoo
|
| 275 |
+
|
| 276 |
+
def test_pow_as_base_exp():
|
| 277 |
+
assert (S.Infinity**(2 - x)).as_base_exp() == (S.Infinity, 2 - x)
|
| 278 |
+
assert (S.Infinity**(x - 2)).as_base_exp() == (S.Infinity, x - 2)
|
| 279 |
+
p = S.Half**x
|
| 280 |
+
assert p.base, p.exp == p.as_base_exp() == (S(2), -x)
|
| 281 |
+
p = (S(3)/2)**x
|
| 282 |
+
assert p.base, p.exp == p.as_base_exp() == (3*S.Half, x)
|
| 283 |
+
p = (S(2)/3)**x
|
| 284 |
+
assert p.as_base_exp() == (S(3)/2, -x)
|
| 285 |
+
assert p.base, p.exp == (S(2)/3, x)
|
| 286 |
+
# issue 8344:
|
| 287 |
+
assert Pow(1, 2, evaluate=False).as_base_exp() == (S.One, S(2))
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
def test_nseries():
|
| 291 |
+
assert sqrt(I*x - 1)._eval_nseries(x, 4, None, 1) == I + x/2 + I*x**2/8 - x**3/16 + O(x**4)
|
| 292 |
+
assert sqrt(I*x - 1)._eval_nseries(x, 4, None, -1) == -I - x/2 - I*x**2/8 + x**3/16 + O(x**4)
|
| 293 |
+
assert cbrt(I*x - 1)._eval_nseries(x, 4, None, 1) == (-1)**(S(1)/3) - (-1)**(S(5)/6)*x/3 + \
|
| 294 |
+
(-1)**(S(1)/3)*x**2/9 + 5*(-1)**(S(5)/6)*x**3/81 + O(x**4)
|
| 295 |
+
assert cbrt(I*x - 1)._eval_nseries(x, 4, None, -1) == -(-1)**(S(2)/3) - (-1)**(S(1)/6)*x/3 - \
|
| 296 |
+
(-1)**(S(2)/3)*x**2/9 + 5*(-1)**(S(1)/6)*x**3/81 + O(x**4)
|
| 297 |
+
assert (1 / (exp(-1/x) + 1/x))._eval_nseries(x, 2, None) == x + O(x**2)
|
| 298 |
+
# test issue 23752
|
| 299 |
+
assert sqrt(-I*x**2 + x - 3)._eval_nseries(x, 4, None, 1) == -sqrt(3)*I + sqrt(3)*I*x/6 - \
|
| 300 |
+
sqrt(3)*I*x**2*(-S(1)/72 + I/6) - sqrt(3)*I*x**3*(-S(1)/432 + I/36) + O(x**4)
|
| 301 |
+
assert sqrt(-I*x**2 + x - 3)._eval_nseries(x, 4, None, -1) == -sqrt(3)*I + sqrt(3)*I*x/6 - \
|
| 302 |
+
sqrt(3)*I*x**2*(-S(1)/72 + I/6) - sqrt(3)*I*x**3*(-S(1)/432 + I/36) + O(x**4)
|
| 303 |
+
assert cbrt(-I*x**2 + x - 3)._eval_nseries(x, 4, None, 1) == -(-1)**(S(2)/3)*3**(S(1)/3) + \
|
| 304 |
+
(-1)**(S(2)/3)*3**(S(1)/3)*x/9 - (-1)**(S(2)/3)*3**(S(1)/3)*x**2*(-S(1)/81 + I/9) - \
|
| 305 |
+
(-1)**(S(2)/3)*3**(S(1)/3)*x**3*(-S(5)/2187 + 2*I/81) + O(x**4)
|
| 306 |
+
assert cbrt(-I*x**2 + x - 3)._eval_nseries(x, 4, None, -1) == -(-1)**(S(2)/3)*3**(S(1)/3) + \
|
| 307 |
+
(-1)**(S(2)/3)*3**(S(1)/3)*x/9 - (-1)**(S(2)/3)*3**(S(1)/3)*x**2*(-S(1)/81 + I/9) - \
|
| 308 |
+
(-1)**(S(2)/3)*3**(S(1)/3)*x**3*(-S(5)/2187 + 2*I/81) + O(x**4)
|
| 309 |
+
|
| 310 |
+
|
| 311 |
+
def test_issue_6100_12942_4473():
|
| 312 |
+
assert x**1.0 != x
|
| 313 |
+
assert x != x**1.0
|
| 314 |
+
assert True != x**1.0
|
| 315 |
+
assert x**1.0 is not True
|
| 316 |
+
assert x is not True
|
| 317 |
+
assert x*y != (x*y)**1.0
|
| 318 |
+
# Pow != Symbol
|
| 319 |
+
assert (x**1.0)**1.0 != x
|
| 320 |
+
assert (x**1.0)**2.0 != x**2
|
| 321 |
+
b = Expr()
|
| 322 |
+
assert Pow(b, 1.0, evaluate=False) != b
|
| 323 |
+
# if the following gets distributed as a Mul (x**1.0*y**1.0 then
|
| 324 |
+
# __eq__ methods could be added to Symbol and Pow to detect the
|
| 325 |
+
# power-of-1.0 case.
|
| 326 |
+
assert ((x*y)**1.0).func is Pow
|
| 327 |
+
|
| 328 |
+
|
| 329 |
+
def test_issue_6208():
|
| 330 |
+
from sympy.functions.elementary.miscellaneous import root
|
| 331 |
+
assert sqrt(33**(I*9/10)) == -33**(I*9/20)
|
| 332 |
+
assert root((6*I)**(2*I), 3).as_base_exp()[1] == Rational(1, 3) # != 2*I/3
|
| 333 |
+
assert root((6*I)**(I/3), 3).as_base_exp()[1] == I/9
|
| 334 |
+
assert sqrt(exp(3*I)) == exp(3*I/2)
|
| 335 |
+
assert sqrt(-sqrt(3)*(1 + 2*I)) == sqrt(sqrt(3))*sqrt(-1 - 2*I)
|
| 336 |
+
assert sqrt(exp(5*I)) == -exp(5*I/2)
|
| 337 |
+
assert root(exp(5*I), 3).exp == Rational(1, 3)
|
| 338 |
+
|
| 339 |
+
|
| 340 |
+
def test_issue_6990():
|
| 341 |
+
assert (sqrt(a + b*x + x**2)).series(x, 0, 3).removeO() == \
|
| 342 |
+
sqrt(a)*x**2*(1/(2*a) - b**2/(8*a**2)) + sqrt(a) + b*x/(2*sqrt(a))
|
| 343 |
+
|
| 344 |
+
|
| 345 |
+
def test_issue_6068():
|
| 346 |
+
assert sqrt(sin(x)).series(x, 0, 7) == \
|
| 347 |
+
sqrt(x) - x**Rational(5, 2)/12 + x**Rational(9, 2)/1440 - \
|
| 348 |
+
x**Rational(13, 2)/24192 + O(x**7)
|
| 349 |
+
assert sqrt(sin(x)).series(x, 0, 9) == \
|
| 350 |
+
sqrt(x) - x**Rational(5, 2)/12 + x**Rational(9, 2)/1440 - \
|
| 351 |
+
x**Rational(13, 2)/24192 - 67*x**Rational(17, 2)/29030400 + O(x**9)
|
| 352 |
+
assert sqrt(sin(x**3)).series(x, 0, 19) == \
|
| 353 |
+
x**Rational(3, 2) - x**Rational(15, 2)/12 + x**Rational(27, 2)/1440 + O(x**19)
|
| 354 |
+
assert sqrt(sin(x**3)).series(x, 0, 20) == \
|
| 355 |
+
x**Rational(3, 2) - x**Rational(15, 2)/12 + x**Rational(27, 2)/1440 - \
|
| 356 |
+
x**Rational(39, 2)/24192 + O(x**20)
|
| 357 |
+
|
| 358 |
+
|
| 359 |
+
def test_issue_6782():
|
| 360 |
+
assert sqrt(sin(x**3)).series(x, 0, 7) == x**Rational(3, 2) + O(x**7)
|
| 361 |
+
assert sqrt(sin(x**4)).series(x, 0, 3) == x**2 + O(x**3)
|
| 362 |
+
|
| 363 |
+
|
| 364 |
+
def test_issue_6653():
|
| 365 |
+
assert (1 / sqrt(1 + sin(x**2))).series(x, 0, 3) == 1 - x**2/2 + O(x**3)
|
| 366 |
+
|
| 367 |
+
|
| 368 |
+
def test_issue_6429():
|
| 369 |
+
f = (c**2 + x)**(0.5)
|
| 370 |
+
assert f.series(x, x0=0, n=1) == (c**2)**0.5 + O(x)
|
| 371 |
+
assert f.taylor_term(0, x) == (c**2)**0.5
|
| 372 |
+
assert f.taylor_term(1, x) == 0.5*x*(c**2)**(-0.5)
|
| 373 |
+
assert f.taylor_term(2, x) == -0.125*x**2*(c**2)**(-1.5)
|
| 374 |
+
|
| 375 |
+
|
| 376 |
+
def test_issue_7638():
|
| 377 |
+
f = pi/log(sqrt(2))
|
| 378 |
+
assert ((1 + I)**(I*f/2))**0.3 == (1 + I)**(0.15*I*f)
|
| 379 |
+
# if 1/3 -> 1.0/3 this should fail since it cannot be shown that the
|
| 380 |
+
# sign will be +/-1; for the previous "small arg" case, it didn't matter
|
| 381 |
+
# that this could not be proved
|
| 382 |
+
assert (1 + I)**(4*I*f) == ((1 + I)**(12*I*f))**Rational(1, 3)
|
| 383 |
+
|
| 384 |
+
assert (((1 + I)**(I*(1 + 7*f)))**Rational(1, 3)).exp == Rational(1, 3)
|
| 385 |
+
r = symbols('r', real=True)
|
| 386 |
+
assert sqrt(r**2) == abs(r)
|
| 387 |
+
assert cbrt(r**3) != r
|
| 388 |
+
assert sqrt(Pow(2*I, 5*S.Half)) != (2*I)**Rational(5, 4)
|
| 389 |
+
p = symbols('p', positive=True)
|
| 390 |
+
assert cbrt(p**2) == p**Rational(2, 3)
|
| 391 |
+
assert NS(((0.2 + 0.7*I)**(0.7 + 1.0*I))**(0.5 - 0.1*I), 1) == '0.4 + 0.2*I'
|
| 392 |
+
assert sqrt(1/(1 + I)) == sqrt(1 - I)/sqrt(2) # or 1/sqrt(1 + I)
|
| 393 |
+
e = 1/(1 - sqrt(2))
|
| 394 |
+
assert sqrt(e) == I/sqrt(-1 + sqrt(2))
|
| 395 |
+
assert e**Rational(-1, 2) == -I*sqrt(-1 + sqrt(2))
|
| 396 |
+
assert sqrt((cos(1)**2 + sin(1)**2 - 1)**(3 + I)).exp in [S.Half,
|
| 397 |
+
Rational(3, 2) + I/2]
|
| 398 |
+
assert sqrt(r**Rational(4, 3)) != r**Rational(2, 3)
|
| 399 |
+
assert sqrt((p + I)**Rational(4, 3)) == (p + I)**Rational(2, 3)
|
| 400 |
+
|
| 401 |
+
for q in 1+I, 1-I:
|
| 402 |
+
assert sqrt(q**2) == q
|
| 403 |
+
for q in -1+I, -1-I:
|
| 404 |
+
assert sqrt(q**2) == -q
|
| 405 |
+
|
| 406 |
+
assert sqrt((p + r*I)**2) != p + r*I
|
| 407 |
+
e = (1 + I/5)
|
| 408 |
+
assert sqrt(e**5) == e**(5*S.Half)
|
| 409 |
+
assert sqrt(e**6) == e**3
|
| 410 |
+
assert sqrt((1 + I*r)**6) != (1 + I*r)**3
|
| 411 |
+
|
| 412 |
+
|
| 413 |
+
def test_issue_8582():
|
| 414 |
+
assert 1**oo is nan
|
| 415 |
+
assert 1**(-oo) is nan
|
| 416 |
+
assert 1**zoo is nan
|
| 417 |
+
assert 1**(oo + I) is nan
|
| 418 |
+
assert 1**(1 + I*oo) is nan
|
| 419 |
+
assert 1**(oo + I*oo) is nan
|
| 420 |
+
|
| 421 |
+
|
| 422 |
+
def test_issue_8650():
|
| 423 |
+
n = Symbol('n', integer=True, nonnegative=True)
|
| 424 |
+
assert (n**n).is_positive is True
|
| 425 |
+
x = 5*n + 5
|
| 426 |
+
assert (x**(5*(n + 1))).is_positive is True
|
| 427 |
+
|
| 428 |
+
|
| 429 |
+
def test_issue_13914():
|
| 430 |
+
b = Symbol('b')
|
| 431 |
+
assert (-1)**zoo is nan
|
| 432 |
+
assert 2**zoo is nan
|
| 433 |
+
assert (S.Half)**(1 + zoo) is nan
|
| 434 |
+
assert I**(zoo + I) is nan
|
| 435 |
+
assert b**(I + zoo) is nan
|
| 436 |
+
|
| 437 |
+
|
| 438 |
+
def test_better_sqrt():
|
| 439 |
+
n = Symbol('n', integer=True, nonnegative=True)
|
| 440 |
+
assert sqrt(3 + 4*I) == 2 + I
|
| 441 |
+
assert sqrt(3 - 4*I) == 2 - I
|
| 442 |
+
assert sqrt(-3 - 4*I) == 1 - 2*I
|
| 443 |
+
assert sqrt(-3 + 4*I) == 1 + 2*I
|
| 444 |
+
assert sqrt(32 + 24*I) == 6 + 2*I
|
| 445 |
+
assert sqrt(32 - 24*I) == 6 - 2*I
|
| 446 |
+
assert sqrt(-32 - 24*I) == 2 - 6*I
|
| 447 |
+
assert sqrt(-32 + 24*I) == 2 + 6*I
|
| 448 |
+
|
| 449 |
+
# triple (3, 4, 5):
|
| 450 |
+
# parity of 3 matches parity of 5 and
|
| 451 |
+
# den, 4, is a square
|
| 452 |
+
assert sqrt((3 + 4*I)/4) == 1 + I/2
|
| 453 |
+
# triple (8, 15, 17)
|
| 454 |
+
# parity of 8 doesn't match parity of 17 but
|
| 455 |
+
# den/2, 8/2, is a square
|
| 456 |
+
assert sqrt((8 + 15*I)/8) == (5 + 3*I)/4
|
| 457 |
+
# handle the denominator
|
| 458 |
+
assert sqrt((3 - 4*I)/25) == (2 - I)/5
|
| 459 |
+
assert sqrt((3 - 4*I)/26) == (2 - I)/sqrt(26)
|
| 460 |
+
# mul
|
| 461 |
+
# issue #12739
|
| 462 |
+
assert sqrt((3 + 4*I)/(3 - 4*I)) == (3 + 4*I)/5
|
| 463 |
+
assert sqrt(2/(3 + 4*I)) == sqrt(2)/5*(2 - I)
|
| 464 |
+
assert sqrt(n/(3 + 4*I)).subs(n, 2) == sqrt(2)/5*(2 - I)
|
| 465 |
+
assert sqrt(-2/(3 + 4*I)) == sqrt(2)/5*(1 + 2*I)
|
| 466 |
+
assert sqrt(-n/(3 + 4*I)).subs(n, 2) == sqrt(2)/5*(1 + 2*I)
|
| 467 |
+
# power
|
| 468 |
+
assert sqrt(1/(3 + I*4)) == (2 - I)/5
|
| 469 |
+
assert sqrt(1/(3 - I)) == sqrt(10)*sqrt(3 + I)/10
|
| 470 |
+
# symbolic
|
| 471 |
+
i = symbols('i', imaginary=True)
|
| 472 |
+
assert sqrt(3/i) == Mul(sqrt(3), 1/sqrt(i), evaluate=False)
|
| 473 |
+
# multiples of 1/2; don't make this too automatic
|
| 474 |
+
assert sqrt(3 + 4*I)**3 == (2 + I)**3
|
| 475 |
+
assert Pow(3 + 4*I, Rational(3, 2)) == 2 + 11*I
|
| 476 |
+
assert Pow(6 + 8*I, Rational(3, 2)) == 2*sqrt(2)*(2 + 11*I)
|
| 477 |
+
n, d = (3 + 4*I), (3 - 4*I)**3
|
| 478 |
+
a = n/d
|
| 479 |
+
assert a.args == (1/d, n)
|
| 480 |
+
eq = sqrt(a)
|
| 481 |
+
assert eq.args == (a, S.Half)
|
| 482 |
+
assert expand_multinomial(eq) == sqrt((-117 + 44*I)*(3 + 4*I))/125
|
| 483 |
+
assert eq.expand() == (7 - 24*I)/125
|
| 484 |
+
|
| 485 |
+
# issue 12775
|
| 486 |
+
# pos im part
|
| 487 |
+
assert sqrt(2*I) == (1 + I)
|
| 488 |
+
assert sqrt(2*9*I) == Mul(3, 1 + I, evaluate=False)
|
| 489 |
+
assert Pow(2*I, 3*S.Half) == (1 + I)**3
|
| 490 |
+
# neg im part
|
| 491 |
+
assert sqrt(-I/2) == Mul(S.Half, 1 - I, evaluate=False)
|
| 492 |
+
# fractional im part
|
| 493 |
+
assert Pow(Rational(-9, 2)*I, Rational(3, 2)) == 27*(1 - I)**3/8
|
| 494 |
+
|
| 495 |
+
|
| 496 |
+
def test_issue_2993():
|
| 497 |
+
assert str((2.3*x - 4)**0.3) == '1.5157165665104*(0.575*x - 1)**0.3'
|
| 498 |
+
assert str((2.3*x + 4)**0.3) == '1.5157165665104*(0.575*x + 1)**0.3'
|
| 499 |
+
assert str((-2.3*x + 4)**0.3) == '1.5157165665104*(1 - 0.575*x)**0.3'
|
| 500 |
+
assert str((-2.3*x - 4)**0.3) == '1.5157165665104*(-0.575*x - 1)**0.3'
|
| 501 |
+
assert str((2.3*x - 2)**0.3) == '1.28386201800527*(x - 0.869565217391304)**0.3'
|
| 502 |
+
assert str((-2.3*x - 2)**0.3) == '1.28386201800527*(-x - 0.869565217391304)**0.3'
|
| 503 |
+
assert str((-2.3*x + 2)**0.3) == '1.28386201800527*(0.869565217391304 - x)**0.3'
|
| 504 |
+
assert str((2.3*x + 2)**0.3) == '1.28386201800527*(x + 0.869565217391304)**0.3'
|
| 505 |
+
assert str((2.3*x - 4)**Rational(1, 3)) == '2**(2/3)*(0.575*x - 1)**(1/3)'
|
| 506 |
+
eq = (2.3*x + 4)
|
| 507 |
+
assert eq**2 == 16*(0.575*x + 1)**2
|
| 508 |
+
assert (1/eq).args == (eq, -1) # don't change trivial power
|
| 509 |
+
# issue 17735
|
| 510 |
+
q=.5*exp(x) - .5*exp(-x) + 0.1
|
| 511 |
+
assert int((q**2).subs(x, 1)) == 1
|
| 512 |
+
# issue 17756
|
| 513 |
+
y = Symbol('y')
|
| 514 |
+
assert len(sqrt(x/(x + y)**2 + Float('0.008', 30)).subs(y, pi.n(25)).atoms(Float)) == 2
|
| 515 |
+
# issue 17756
|
| 516 |
+
a, b, c, d, e, f, g = symbols('a:g')
|
| 517 |
+
expr = sqrt(1 + a*(c**4 + g*d - 2*g*e - f*(-g + d))**2/
|
| 518 |
+
(c**3*b**2*(d - 3*e + 2*f)**2))/2
|
| 519 |
+
r = [
|
| 520 |
+
(a, N('0.0170992456333788667034850458615', 30)),
|
| 521 |
+
(b, N('0.0966594956075474769169134801223', 30)),
|
| 522 |
+
(c, N('0.390911862903463913632151616184', 30)),
|
| 523 |
+
(d, N('0.152812084558656566271750185933', 30)),
|
| 524 |
+
(e, N('0.137562344465103337106561623432', 30)),
|
| 525 |
+
(f, N('0.174259178881496659302933610355', 30)),
|
| 526 |
+
(g, N('0.220745448491223779615401870086', 30))]
|
| 527 |
+
tru = expr.n(30, subs=dict(r))
|
| 528 |
+
seq = expr.subs(r)
|
| 529 |
+
# although `tru` is the right way to evaluate
|
| 530 |
+
# expr with numerical values, `seq` will have
|
| 531 |
+
# significant loss of precision if extraction of
|
| 532 |
+
# the largest coefficient of a power's base's terms
|
| 533 |
+
# is done improperly
|
| 534 |
+
assert seq == tru
|
| 535 |
+
|
| 536 |
+
def test_issue_17450():
|
| 537 |
+
assert (erf(cosh(1)**7)**I).is_real is None
|
| 538 |
+
assert (erf(cosh(1)**7)**I).is_imaginary is False
|
| 539 |
+
assert (Pow(exp(1+sqrt(2)), ((1-sqrt(2))*I*pi), evaluate=False)).is_real is None
|
| 540 |
+
assert ((-10)**(10*I*pi/3)).is_real is False
|
| 541 |
+
assert ((-5)**(4*I*pi)).is_real is False
|
| 542 |
+
|
| 543 |
+
|
| 544 |
+
def test_issue_18190():
|
| 545 |
+
assert sqrt(1 / tan(1 + I)) == 1 / sqrt(tan(1 + I))
|
| 546 |
+
|
| 547 |
+
|
| 548 |
+
def test_issue_14815():
|
| 549 |
+
x = Symbol('x', real=True)
|
| 550 |
+
assert sqrt(x).is_extended_negative is False
|
| 551 |
+
x = Symbol('x', real=False)
|
| 552 |
+
assert sqrt(x).is_extended_negative is None
|
| 553 |
+
x = Symbol('x', complex=True)
|
| 554 |
+
assert sqrt(x).is_extended_negative is False
|
| 555 |
+
x = Symbol('x', extended_real=True)
|
| 556 |
+
assert sqrt(x).is_extended_negative is False
|
| 557 |
+
assert sqrt(zoo, evaluate=False).is_extended_negative is None
|
| 558 |
+
assert sqrt(nan, evaluate=False).is_extended_negative is None
|
| 559 |
+
|
| 560 |
+
|
| 561 |
+
def test_issue_18509():
|
| 562 |
+
x = Symbol('x', prime=True)
|
| 563 |
+
assert x**oo is oo
|
| 564 |
+
assert (1/x)**oo is S.Zero
|
| 565 |
+
assert (-1/x)**oo is S.Zero
|
| 566 |
+
assert (-x)**oo is zoo
|
| 567 |
+
assert (-oo)**(-1 + I) is S.Zero
|
| 568 |
+
assert (-oo)**(1 + I) is zoo
|
| 569 |
+
assert (oo)**(-1 + I) is S.Zero
|
| 570 |
+
assert (oo)**(1 + I) is zoo
|
| 571 |
+
|
| 572 |
+
|
| 573 |
+
def test_issue_18762():
|
| 574 |
+
e, p = symbols('e p')
|
| 575 |
+
g0 = sqrt(1 + e**2 - 2*e*cos(p))
|
| 576 |
+
assert len(g0.series(e, 1, 3).args) == 4
|
| 577 |
+
|
| 578 |
+
|
| 579 |
+
def test_issue_21860():
|
| 580 |
+
e = 3*2**Rational(66666666667,200000000000)*3**Rational(16666666667,50000000000)*x**Rational(66666666667, 200000000000)
|
| 581 |
+
ans = Mul(Rational(3, 2),
|
| 582 |
+
Pow(Integer(2), Rational(33333333333, 100000000000)),
|
| 583 |
+
Pow(Integer(3), Rational(26666666667, 40000000000)))
|
| 584 |
+
assert e.xreplace({x: Rational(3,8)}) == ans
|
| 585 |
+
|
| 586 |
+
|
| 587 |
+
def test_issue_21647():
|
| 588 |
+
e = log((Integer(567)/500)**(811*(Integer(567)/500)**x/100))
|
| 589 |
+
ans = log(Mul(Rational(64701150190720499096094005280169087619821081527,
|
| 590 |
+
76293945312500000000000000000000000000000000000),
|
| 591 |
+
Pow(Integer(2), Rational(396204892125479941, 781250000000000000)),
|
| 592 |
+
Pow(Integer(3), Rational(385045107874520059, 390625000000000000)),
|
| 593 |
+
Pow(Integer(5), Rational(407364676376439823, 1562500000000000000)),
|
| 594 |
+
Pow(Integer(7), Rational(385045107874520059, 1562500000000000000))))
|
| 595 |
+
assert e.xreplace({x: 6}) == ans
|
| 596 |
+
|
| 597 |
+
|
| 598 |
+
def test_issue_21762():
|
| 599 |
+
e = (x**2 + 6)**(Integer(33333333333333333)/50000000000000000)
|
| 600 |
+
ans = Mul(Rational(5, 4),
|
| 601 |
+
Pow(Integer(2), Rational(16666666666666667, 25000000000000000)),
|
| 602 |
+
Pow(Integer(5), Rational(8333333333333333, 25000000000000000)))
|
| 603 |
+
assert e.xreplace({x: S.Half}) == ans
|
| 604 |
+
|
| 605 |
+
|
| 606 |
+
def test_issue_14704():
|
| 607 |
+
a = 144**144
|
| 608 |
+
x, xexact = integer_nthroot(a,a)
|
| 609 |
+
assert x == 1 and xexact is False
|
| 610 |
+
|
| 611 |
+
|
| 612 |
+
def test_rational_powers_larger_than_one():
|
| 613 |
+
assert Rational(2, 3)**Rational(3, 2) == 2*sqrt(6)/9
|
| 614 |
+
assert Rational(1, 6)**Rational(9, 4) == 6**Rational(3, 4)/216
|
| 615 |
+
assert Rational(3, 7)**Rational(7, 3) == 9*3**Rational(1, 3)*7**Rational(2, 3)/343
|
| 616 |
+
|
| 617 |
+
|
| 618 |
+
def test_power_dispatcher():
|
| 619 |
+
|
| 620 |
+
class NewBase(Expr):
|
| 621 |
+
pass
|
| 622 |
+
class NewPow(NewBase, Pow):
|
| 623 |
+
pass
|
| 624 |
+
a, b = Symbol('a'), NewBase()
|
| 625 |
+
|
| 626 |
+
@power.register(Expr, NewBase)
|
| 627 |
+
@power.register(NewBase, Expr)
|
| 628 |
+
@power.register(NewBase, NewBase)
|
| 629 |
+
def _(a, b):
|
| 630 |
+
return NewPow(a, b)
|
| 631 |
+
|
| 632 |
+
# Pow called as fallback
|
| 633 |
+
assert power(2, 3) == 8*S.One
|
| 634 |
+
assert power(a, 2) == Pow(a, 2)
|
| 635 |
+
assert power(a, a) == Pow(a, a)
|
| 636 |
+
|
| 637 |
+
# NewPow called by dispatch
|
| 638 |
+
assert power(a, b) == NewPow(a, b)
|
| 639 |
+
assert power(b, a) == NewPow(b, a)
|
| 640 |
+
assert power(b, b) == NewPow(b, b)
|
| 641 |
+
|
| 642 |
+
|
| 643 |
+
def test_powers_of_I():
|
| 644 |
+
assert [sqrt(I)**i for i in range(13)] == [
|
| 645 |
+
1, sqrt(I), I, sqrt(I)**3, -1, -sqrt(I), -I, -sqrt(I)**3,
|
| 646 |
+
1, sqrt(I), I, sqrt(I)**3, -1]
|
| 647 |
+
assert sqrt(I)**(S(9)/2) == -I**(S(1)/4)
|
| 648 |
+
|
| 649 |
+
|
| 650 |
+
def test_issue_23918():
|
| 651 |
+
b = S(2)/3
|
| 652 |
+
assert (b**x).as_base_exp() == (1/b, -x)
|
shared/package-files/2e/2e9d04897257e83b6fec7fe1c0a06913709a4df371b9c90ebfa3c75c9f749ed2/blob
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
x,weights,x_gau_wd,x_epa_wd,x_epan2_wd,x_bi_wd,x_par_wd,x_tri_wd,x_cos_wd,x_rec_wd
|
| 2 |
+
.50370319,.60467487,.27195577,.27358917,.28859682,.30192719,.31283399,.29793749,.31904846,.25210428
|
| 3 |
+
.41308592,.60446553,.28380106,.28108376,.3181792,.32885763,.34548845,.32667957,.3553171,.3010559
|
| 4 |
+
-1.13905,.84897398,.26095184,.24941442,.32307763,.34872245,.38725314,.34866867,.42649716,.30003257
|
| 5 |
+
.66034203,.89616498,.2498343,.25886883,.24541009,.23760925,.23485521,.24529473,.23002624,.2627293
|
| 6 |
+
.46479403,.58916777,.27716742,.27709199,.30071519,.31461812,.3288969,.31115181,.33274659,.27792568
|
| 7 |
+
-.30933686,.92004553,.314696,.31804133,.34663542,.35808323,.38279667,.36339898,.44094594,.31994675
|
| 8 |
+
-.64959307,.73271562,.29736955,.31088207,.25708713,.24806417,.2539103,.26299651,.28856418,.30887871
|
| 9 |
+
.68375801,.31006212,.24646059,.25568508,.23632094,.22824775,.22264335,.23446073,.21686179,.2512418
|
| 10 |
+
-.64383424,.93079,.2977045,.3114788,.25702669,.2509086,.25709325,.26391628,.29057321,.30887871
|
| 11 |
+
.42128692,.31271088,.28277417,.28032663,.315695,.3267261,.34319264,.32450914,.35120708,.3010559
|
| 12 |
+
1.0328139,.6187646,.19865928,.20562102,.1561914,.14491215,.14684135,.15591422,.16079396,.19385198
|
| 13 |
+
-1.2904935,.95351446,.24177169,.22953008,.32501344,.38069438,.4611249,.36532316,.54515641,.23436556
|
| 14 |
+
.78787175,.32106611,.23156764,.24078401,.20218871,.19425712,.17622449,.19531208,.16070512,.21671793
|
| 15 |
+
1.5157072,.66341627,.13665126,.12703345,.17581124,.20039954,.25847706,.20674992,.35899704,.15119583
|
| 16 |
+
-.27648715,.39563784,.3158193,.31586931,.3481959,.35810566,.38200715,.36407338,.42546061,.31994675
|
| 17 |
+
-.22376217,.52433377,.31726241,.31194313,.35102832,.35601176,.37307496,.35644025,.38768768,.37555419
|
| 18 |
+
1.3974312,.51672953,.15280551,.1444295,.19194916,.21056571,.22903207,.20154176,.23748733,.15119583
|
| 19 |
+
1.5038735,.89413116,.13831766,.12874814,.17849067,.20256748,.25945018,.20968897,.3582845,.15119583
|
| 20 |
+
-.47890497,.97143796,.30692589,.32055942,.30950537,.32610177,.33693342,.31654009,.30584078,.27657124
|
| 21 |
+
-.1359496,.14135297,.31850248,.30708612,.35335067,.356503,.35032857,.34820511,.32358697,.36376222
|
| 22 |
+
-.73032662,.52783029,.29259949,.30296315,.24788827,.21783998,.2070478,.23766242,.22559505,.30464283
|
| 23 |
+
-.03327709,.86167095,.31776682,.30409739,.35990479,.35322891,.33260293,.35696834,.31130253,.35590704
|
| 24 |
+
.28115083,.95467052,.2986962,.29242144,.33561626,.34984221,.36523791,.34821892,.38413714,.30800325
|
| 25 |
+
-1.2989147,.80130654,.24054457,.228406,.3242507,.37937907,.45917069,.36459455,.5425096,.23436556
|
| 26 |
+
-2.8194873,.29377041,.03423861,.03397935,.01992567,.01845811,.02368624,.02238546,.03521327,.02886914
|
| 27 |
+
-.85198542,.07745348,.28499181,.28840952,.24395463,.21358347,.16033312,.21929099,.08660478,.27849863
|
| 28 |
+
-1.1069518,.49668391,.26433879,.25400233,.32229855,.33312293,.35156483,.33496984,.37965384,.30003257
|
| 29 |
+
-.93773148,.19808942,.27902143,.27775656,.27754821,.24108994,.1807995,.24935348,.0900434,.32253643
|
| 30 |
+
-1.5377704,.325444,.19963066,.19249631,.23509243,.22351351,.20130053,.22380662,.15481808,.23739545
|
| 31 |
+
.5557587,.24841208,.2647569,.26995034,.27512558,.28157636,.28811611,.27768035,.30157454,.27132668
|
| 32 |
+
-2.277282,.75179027,.07828852,.07873796,.07875061,.09204377,.11446709,.0922851,.15025998,.05700553
|
| 33 |
+
-.39020054,.13177808,.31133267,.32104843,.33517543,.35027672,.36907311,.34495022,.40165181,.29228903
|
| 34 |
+
1.2071225,.36595759,.17694573,.17676473,.18418833,.17480444,.15023094,.17594001,.12570809,.17381817
|
| 35 |
+
.17869009,.61706068,.30769076,.29939275,.34442456,.347134,.35602386,.34847054,.36011693,.36522916
|
| 36 |
+
-1.0041675,.1042514,.27381383,.26920255,.29856445,.27641696,.23392586,.27843723,.19447102,.29342568
|
| 37 |
+
-1.3776266,.92715643,.22828438,.21635169,.30823856,.35053859,.40838262,.34325694,.47623359,.23204453
|
| 38 |
+
.49928077,.16346328,.2725563,.27403682,.28985754,.30351024,.31480322,.2993623,.32039228,.25210428
|
| 39 |
+
-1.4052563,.96126524,.22366107,.21181391,.29911819,.33392962,.37877909,.32774722,.43913813,.23204453
|
| 40 |
+
.16256489,.38334264,.30887154,.30012656,.34572104,.34707247,.35358542,.34768253,.3560065,.35593763
|
| 41 |
+
-.06778502,.77186504,.31829891,.30559493,.35826195,.3554906,.33637638,.35551408,.305725,.34139722
|
| 42 |
+
-1.2600064,.12778838,.24607265,.2333853,.32622041,.38243622,.46216935,.3612336,.54549954,.23436556
|
| 43 |
+
-1.1328956,.49085611,.26161854,.25023928,.3231961,.34583442,.38073288,.34660716,.41805519,.30003257
|
| 44 |
+
-2.0064812,.48090321,.11322783,.12879922,.0646241,.06034824,.05482294,.06467009,.05764425,.066758
|
| 45 |
+
.30101641,.13432719,.29667228,.29063393,.33480316,.34885982,.36454689,.34424398,.38577022,.29229072
|
| 46 |
+
.05911705,.72259881,.31483242,.30162583,.360174,.34909635,.33698463,.35400964,.32926111,.3572589
|
| 47 |
+
1.1384692,.43570061,.18542783,.18785159,.17569715,.15617806,.14519084,.16879885,.15817458,.20996476
|
| 48 |
+
-2.4006338,.0702726,.0661328,.05973222,.07546614,.08153031,.09764932,.08181684,.12409822,.06580884
|
| 49 |
+
-.28085336,.91503527,.31567929,.31617356,.34821096,.35820009,.38234837,.36478543,.42807283,.31994675
|
| 50 |
+
.02565318,.21581449,.31615397,.3015383,.36059293,.34980376,.33308907,.35373627,.32250968,.37892557
|
| 51 |
+
-1.3860712,.52139452,.22688798,.21494935,.30566124,.34579032,.39987794,.33922414,.46560575,.23204453
|
| 52 |
+
.86393679,.4338506,.22096543,.22892366,.1834737,.1740142,.15644199,.17635877,.12724629,.18408431
|
| 53 |
+
.25246163,.90097287,.30146488,.29459784,.33628211,.35007398,.36442492,.34886654,.38021707,.29838197
|
| 54 |
+
1.5005706,.52615659,.13878075,.12921959,.17919626,.20313531,.25952209,.20982585,.35751304,.15119583
|
| 55 |
+
1.0532023,.23850945,.19607429,.20225294,.1596919,.1452661,.14646528,.15783051,.16537447,.19385198
|
| 56 |
+
-2.3385949,.03208453,.07201598,.06861114,.07788137,.08815269,.11183084,.08955035,.15620679,.06580884
|
| 57 |
+
-.37427851,.80847815,.31205326,.32060023,.33786515,.35297134,.37326996,.3501085,.41938363,.29228903
|
| 58 |
+
-2.3599583,.56724767,.06994132,.06564237,.07736941,.08614625,.10817961,.08872598,.14898803,.06580884
|
| 59 |
+
-1.1578862,.98669892,.25885895,.24676433,.32192541,.35726098,.40592428,.35127741,.45134312,.30003257
|
| 60 |
+
-.55186497,.1049692,.30295427,.31836946,.28119002,.29690047,.30298875,.28439032,.29007716,.24740666
|
| 61 |
+
1.5926728,.78610254,.12554701,.11550205,.15819727,.18163449,.22681772,.17941142,.29077747,.12550619
|
shared/package-files/2e/2ea3f8a48d2e0c35ef80b157a53c54c67b81d74add11c5faea827e4cb5d9562d/blob
ADDED
|
Binary file (12.3 kB). View file
|
|
|
shared/package-files/2e/2ea490b3d369e66dd002ea0133404c4a452900f17d7bf3bd6fb0661f2058055f/blob
ADDED
|
@@ -0,0 +1,318 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
6b27a881f2d07a8453c008e7092aac0cfe08fb8d80bc8a4f7e28516b3ece1bb2 FINALIZATION.json
|
| 2 |
+
ccc350f3f818fddd8e66ecaa11850b2d16fd5fd62e3c3a84117f069f7d4eab97 README.md
|
| 3 |
+
09f52a522875fdb94cbc620011af68e38234549b2fcecfc91fbc9bea7bafd7da STATIC_CHECKS.json
|
| 4 |
+
8b044597670ed62d4f353707cf5dfa7da2a159a8545e0ba3969f5cb59be8a27c additional-elastic-tensor-diagnostic.json
|
| 5 |
+
d930f63632374b852701f536bfcef561b960ba3e0e952577b38327d641896a09 additional-elasticity-predictions.jsonl
|
| 6 |
+
e666556933fa11976a51462a9953238ceff6086cd8e94517d4b5ef947a232e9d additional-elasticity-run.json
|
| 7 |
+
2873596540f394f1df1390d8ab3ad5cbd0775342b0916d5ec951c403e5204503 additional-elasticity-score.json
|
| 8 |
+
54e3278959c0c72e3a9a11a1c2cb9349449e9fb4a995d2c7c2b08d205c6cf9e4 additional-kappa-audit/README.md
|
| 9 |
+
9b6442a20759a648111c0d70f976de018596435d334c070add045419a1ef2040 additional-kappa-audit/identity.json
|
| 10 |
+
ed568b6438416cf1b4be8f0e1a2635a4bb945220a6224c5b228f08b71a41c93b additional-kappa-audit/items/mp-12779.json
|
| 11 |
+
cdba13c9ae13084197ef7982b9a66ffefd1d3219c58737bb5f34b2c3701a3e80 additional-kappa-audit/items/mp-22905.json
|
| 12 |
+
784c5791ca8b8df0f07bb91061a78a2a585ca33319ba658584041fcc53728de0 additional-kappa-audit/items/mp-569346.json
|
| 13 |
+
97cceaf3fe8ff0e0f4d6132284d3952628a770bea5cfd3cbecd39590121b88cb additional-kappa-audit/items/mp-580941.json
|
| 14 |
+
314b8675f76be9d5417341868c5db7fa89e4f34c08fdcecf13df09acfe7cfbec additional-kappa-audit/run.json
|
| 15 |
+
66c2524548199ce3040c7f3e076923c76dc4ec47f34d8f85d4f13c50a9a96ec8 additional-kappa-audit/score.json
|
| 16 |
+
3fd700ea23e69b999ffdb5165823f37921c964a5a08e8309bd548bdf0a9d4991 additional-kappa-audit/transport-selection.json
|
| 17 |
+
59194f1656bc310581cb3e1194e066c95c0f3c4bc2a1ab8c95e6019f36297f75 additional-neb-audit/README.md
|
| 18 |
+
6621841b5dfe9e02071611de60df450a59687bc2110ffcb4a7cc47bc3d76cde5 additional-neb-audit/identity.json
|
| 19 |
+
cbed98d6264e5cec710757044fa9c5bb533a77736c0c3234d0a6ca30924a5cbe additional-neb-audit/items/mp-556902_3_6_1_1_0.json
|
| 20 |
+
27602c68f2fadd3a22e26919f0c5b05dfe34d5840dc8bc7bfcd002c04e40edf8 additional-neb-audit/items/mp-569085_5_9_1_1_0.json
|
| 21 |
+
d9927abb0bd1e501e2d7aa3b776b448ce572661dbfb98cc5a4e00df41b5ffec0 additional-neb-audit/items/mp-778397_1_3_0_0_0.json
|
| 22 |
+
697a58fb95ec8e6bbefe1b000fcb098cbab1b37f662d6290e7f04b36e4096a98 additional-neb-audit/items/mp-778397_2_6_0_0_0.json
|
| 23 |
+
2f5d9382231ba56dfc8afb5f42de9c071218001217e3f85ddb6fc7b7b68e6298 additional-neb-audit/run.json
|
| 24 |
+
139e6850591f3d36be416f8473e431d0e8ad0dffd3abd81111e062e25703eb9b additional-neb-audit/score.json
|
| 25 |
+
3fd700ea23e69b999ffdb5165823f37921c964a5a08e8309bd548bdf0a9d4991 additional-neb-audit/transport-selection.json
|
| 26 |
+
adeca46ec93eca52e2cb119b0d2b0867528d23e65c571b5c9a453020df18182c additional-neb57-cuda-diagnostic/README.md
|
| 27 |
+
a4de75de449322fbacc0c701da959624251bf8b9f0898172c0b2d19d5aa1dd45 additional-neb57-cuda-diagnostic/all57/references.json
|
| 28 |
+
b74d217c7f61ee9310be711ef597bac0b0385bbcb6480090a20621e15586baab additional-neb57-cuda-diagnostic/barriers.pdf
|
| 29 |
+
f70ec31af394751e7a2fdcadceeb7a048836b9caed1402f89e76d43db5f39610 additional-neb57-cuda-diagnostic/barriers.png
|
| 30 |
+
9fd85a3b9d8a7d35d4e1af0a902effc42837d4fd0a09038dce6ec06dfb697159 additional-neb57-cuda-diagnostic/gap1/references.json
|
| 31 |
+
7663623b7a44355d5b5e6969af9c6e89b63dd311c0f4403e8af8070f9fc2977a additional-neb57-cuda-diagnostic/gap2/references.json
|
| 32 |
+
f7a5641bfa3af2fd4436d00869da01feb13b25e0137df480c99fc78b671c2306 additional-neb57-cuda-diagnostic/gap3/references.json
|
| 33 |
+
5a84371b007dc9a923dbc27c270958eebec6bea17b8e8f86d064d3a513d77e90 additional-neb57-cuda-diagnostic/gap4/references.json
|
| 34 |
+
eadd306e0c03358578123de88a4bdce0be11631c2f9fbc3f5e8e2ce89f716691 additional-neb57-cuda-diagnostic/plan.json
|
| 35 |
+
9ae1ef774cde90d60a22dcc1436a764e1de070f08f0987bdbe4a473a61851d9a additional-neb57-cuda-diagnostic/report.json
|
| 36 |
+
3076fc3787acc4c4bc35a9405c151d808c6d03753e735a71a01e8524bbe5074a additional-neb57-cuda-diagnostic/review_cached_neb57_v1.py
|
| 37 |
+
cfa0ec5dd3f9b3efbe044e53ed14f1911a34b391f384e41821d71e3e18cf6c5c additional-neb57-cuda-diagnostic/source-caches/gap1/items/mp-556902_7_6_0_0_1.json
|
| 38 |
+
e893abf0b04210f2d928be923aa28a3b99bb50405679cd9115b17b04e68e4991 additional-neb57-cuda-diagnostic/source-caches/gap1/items/mp-778397_0_2_0_0_0.json
|
| 39 |
+
586ec9e003fbf0c13fbaca46db872276c062468f94d2dd726df114e99ef42d7f additional-neb57-cuda-diagnostic/source-caches/gap1/items/mp-778397_0_3_0_0_0.json
|
| 40 |
+
c6473e5dfccd7d3ed139559e82ca4247f8dc0b1c2856074c089a00343555ff65 additional-neb57-cuda-diagnostic/source-caches/gap1/plan.json
|
| 41 |
+
a6ff900f910d2bf59c6e3b7c3cbddb229546ef0ae44738459cc254d4c448e133 additional-neb57-cuda-diagnostic/source-caches/gap1/report.json
|
| 42 |
+
d296835ebc563495b7dfea0e8aa816e5177d48fe7ec007014318fcbf35aed45c additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-1020030_0_1_0_0_0.json
|
| 43 |
+
ed96c414931cd2a3227c9a0427135481caae3ce9b84a010bc72de8e79585cc38 additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-1199122_0_18_0_0_0.json
|
| 44 |
+
dbbc61dd1b220b280ee091e68e189def77ae226132284ced3d055a4b2f57f991 additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-1199122_0_5_0_0_1.json
|
| 45 |
+
2b8f952d305ff6bc9bd6f449c974a6a3f38d7122edaacf68bba79590af77c307 additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-1222482_0_1_0_0_0.json
|
| 46 |
+
2258584bdf17b6fe17b64cf2bd278791229a99639c2dde9700a9efed54d9bf09 additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-1222482_0_2_0_0_0.json
|
| 47 |
+
7b54c5b4a8a2f5555b3ec54e49e7517ca993291b8c888492ade80379bd7370e5 additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-1222482_0_5_0_0_0.json
|
| 48 |
+
ab21ac708fd26de1c35e23ffa55454a3343a5d75b8e3bf3249baa9d5694c2c3d additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-1222482_2_3_0_0_0.json
|
| 49 |
+
ff7ec30542800c422524ceba1b6591e90143e76c493334922d2bfef1e0e356ae additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-1222482_3_4_0_0_0.json
|
| 50 |
+
f3b291dc7802f513e9e4eb1fed3dc13dbe46cd726b80897a195b8c70e1c60180 additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-1222482_3_5_0_0_0.json
|
| 51 |
+
70944aecb8547cd55d11114af0878c1bdfad781d9ce4aa44794d9e9656f3e9e9 additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-1222575_0_2_0_0_0.json
|
| 52 |
+
c1d7bd56f8146120e0216919937ecdaef335914e3e5f9273845c9efa683d8bcb additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-1222575_1_2_0_0_0.json
|
| 53 |
+
f75736b162b085a80ea84b0f594cc280bce694392299053d130307c632ec6171 additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-29040_1_3_0_0_0.json
|
| 54 |
+
8dd56454180f74f0b98054f8a1c9a56faa9c6b180ba7fc644d036652b71ec8e5 additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-29040_4_3_0_1_1.json
|
| 55 |
+
7f1f042436e2283cf1cbe7a98516b0dcd6587490f887cb9d7aa1438ef0f5ceb6 additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-561294_1_2_0_0_0.json
|
| 56 |
+
a75cc45d8cc057c2f3aab44e237f68f2b0572967dd0ecec0d8bbb8929752870b additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-755352_0_1_0_0_0.json
|
| 57 |
+
24b3aae70f0b9d382a6c25f75a51afae02e3273fa36515837b7fc8dbaca0f7c7 additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-756639_0_4_0_0_0.json
|
| 58 |
+
97869cdfe3a348633a41e07d1d97992ca472fd85dc5f7beef0dd70e1c310a4aa additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-756639_1_3_1_0_0.json
|
| 59 |
+
d6a2e7ae857d55aa485ed402b3cae42c22438b7880398dfa3914e9c621115827 additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-760791_1_3_1_1_0.json
|
| 60 |
+
3253cdfd8014d4e540cc3c85e5a5f6279d92efe60c590eb391c19094c9986e44 additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-760791_1_4_0_0_0.json
|
| 61 |
+
efd003c93738c7d217b12b2d3e5c165c259181bb0ac0dca2bf8d92410014f048 additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-760791_1_6_0_1_0.json
|
| 62 |
+
4ef342095c8e89823c3d2c969622ef83f9bca3527ef63d0e71e3f6adeb745988 additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-761849_5_7_0_0_1.json
|
| 63 |
+
ad502250b1b332beb24437bcc6385159d24f9b031c23ccb69fe59994e2698e7f additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-761849_6_5_1_0_0.json
|
| 64 |
+
9a6d73f9d03fe5dac069e059dca91e6da8c7f4950828131a6d620c13647fd8d7 additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-762240_8_13_0_0_0.json
|
| 65 |
+
f140ec6ad27ef06c59e6ed245127a62e1a8f0d3aba9347f73805fdf9f182249b additional-neb57-cuda-diagnostic/source-caches/gap2/items/mp-772260_4_15_0_1_-1.json
|
| 66 |
+
f5d5688e38960598c457024f8bdfd34321324118e119a9c7e4e2268c43997100 additional-neb57-cuda-diagnostic/source-caches/gap2/plan.json
|
| 67 |
+
74d141f8546500159b5fadfb2acc1b59d15a589ed2833f744924e831d8fc090e additional-neb57-cuda-diagnostic/source-caches/gap2/report.json
|
| 68 |
+
9ece10cdaa075e2a106763e52e9d283ffd6af6f12ecf9269bcd7171db6ee0be2 additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-1176566_0_2_0_0_0.json
|
| 69 |
+
8dbc36df07c319abf6bd68a0c6606b834bfd85228581005f2dc554ebc253051d additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-1222512_0_3_0_0_1.json
|
| 70 |
+
eada026ecb2ad17c832916e88d4f9e51e3bb2eeae6c6aea009eccb2db1f6ba7b additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-23384_0_6_1_0_0.json
|
| 71 |
+
ba0b30d8b36d6a655e0cbd5053f32d4a3a73931bd82d696d48897dc16664923f additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-27417_0_1_0_0_0.json
|
| 72 |
+
3b5e1911558c2102d5d55878e8896c8831c54eda9c81086f8b8a7e853169fead additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-27417_0_2_0_1_0.json
|
| 73 |
+
8393555260eeba07c0f0e0e39ff7de3692c76c1effb2db97219e309d79ebc912 additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-27417_0_6_0_1_1.json
|
| 74 |
+
af33e858aba6562b08da5d3501e41f31105b884c82cab2dd4f01f2a9df65e073 additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-27417_0_8_0_0_1.json
|
| 75 |
+
c285a32cc70771c63bd023570b105d65d54ba3204d62656fbba15692e03a81c5 additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-27417_0_8_0_1_1.json
|
| 76 |
+
fe53db2bf23f3f7cff31bff4de19740c16b2083a2f3d08d1a86057cd3e9a9244 additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-28548_0_8_0_0_0.json
|
| 77 |
+
c5d5bb3394eb4e8da3ed3693bd08ecd59ac424fcbc6b20609fbcf1f475afb0e2 additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-5418_2_8_1_-1_0.json
|
| 78 |
+
5f4ca375697503a1f05aa8f3b91672a717d295ee25b38c3dab1564cabea64013 additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-560189_10_13_0_0_0.json
|
| 79 |
+
1d629b8e7f58c61952f872e29ccd7d4e6178182dc19655ec65a5403e73e1a6c2 additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-560189_14_22_0_0_0.json
|
| 80 |
+
c29337b1f5a9cf413752c5148e8b19f10aaa974048457f7e537e7b9e4ce21582 additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-560189_9_11_0_0_0.json
|
| 81 |
+
1354537ddff339f74921e5316ea260779c101a2b27ba32a0812256fb4fffd782 additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-6326_0_11_1_0_0.json
|
| 82 |
+
a37d8965b1f3010a67e42d45e134186da5a659509b2c6e56c527ef561ed71a44 additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-6327_0_0_0_1_0.json
|
| 83 |
+
0d75c9d9747181c7b4bea23b4f15bde04e1b63d93ce8c0c8ba3c589396856ee5 additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-753520_2_6_0_0_0.json
|
| 84 |
+
69333ca3487096cd20306e8c1a5602f33ed3f48edbfaf6663fba2f0be20256e1 additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-755559_0_0_0_0_1.json
|
| 85 |
+
83d2f8f69964c1bd387ac831e28762a1def0b1235f852f841db2f10f763da7e5 additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-757905_0_2_0_1_1.json
|
| 86 |
+
a53311b74e3b09333665342eed5a73333837cc37fd610140814acdde545b89c9 additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-760701_0_1_0_0_0.json
|
| 87 |
+
a0542e0adb7ee0f6b9062e2cb1d81d643a20ca1718f323243aeb1f5b32b3f7fb additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-768982_2_6_0_0_0.json
|
| 88 |
+
cb828c1327f6dbb4e9032fa44d52c5350388cd5ff140faabb4e829215fd55726 additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-780226_0_6_0_0_0.json
|
| 89 |
+
e464fba7666174863322d66001f892f039e5e501b1273747b216eebf547fbf5a additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-780226_1_2_1_0_0.json
|
| 90 |
+
d5ab368d8f8f227d3ac54d87815a5fdff89e973f62409f4182a529dae3586653 additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-780226_4_11_0_1_0.json
|
| 91 |
+
1cfae77d0015b526627d89a71422e3eed9749645f864cdad46a35def923f01cf additional-neb57-cuda-diagnostic/source-caches/gap3/items/mp-780226_5_0_1_1_0.json
|
| 92 |
+
a396e1fa123a6cdeff95fe61ce612387e5075aca4ac30cbd8f619768f2df42f4 additional-neb57-cuda-diagnostic/source-caches/gap3/plan.json
|
| 93 |
+
77298a731088934bfeb4893a361bbd45ccec6f72bf93e0e5f4d429e544c179bf additional-neb57-cuda-diagnostic/source-caches/gap3/report.json
|
| 94 |
+
054d8a855bcc77e3487d106b791358dbe7091c403e2899b145a1abeade5b7081 additional-neb57-cuda-diagnostic/source-caches/gap4/items/mp-1147685_5_17_0_0_0.json
|
| 95 |
+
9642c47a3c2f71bbb5e2a7db093489043ac66981a6202723deec8ec80e73cf82 additional-neb57-cuda-diagnostic/source-caches/gap4/items/mp-5418_3_9_1_-1_1.json
|
| 96 |
+
0bb24f4a7373448e725f7c42d86847ffd0e57c4aa5dce8b08840804615c9ce04 additional-neb57-cuda-diagnostic/source-caches/gap4/items/mp-5418_7_5_1_0_0.json
|
| 97 |
+
559da223167a74586193fa8c654c89c76be15c850f5e7586c9f9bbb31fbcc255 additional-neb57-cuda-diagnostic/source-caches/gap4/items/mp-755225_0_3_0_0_0.json
|
| 98 |
+
fff1ee5ef54a55e39a6b4670b84d5fe1b818970919350f64c06ce0f010d3f5d2 additional-neb57-cuda-diagnostic/source-caches/gap4/items/mp-772185_0_2_0_0_0.json
|
| 99 |
+
1dd71e20e63f3dd36445f8e62f5b25d5f0eefb0a453049b48e529b894d02027a additional-neb57-cuda-diagnostic/source-caches/gap4/items/mp-772185_3_2_1_-1_0.json
|
| 100 |
+
3d22ae7d5a0f1abf01dbd6adfe938f04282757fcbf6b19d68c990510f814b089 additional-neb57-cuda-diagnostic/source-caches/gap4/plan.json
|
| 101 |
+
cea3f30ebdb81402ec197d9ba405b073365e626a6bd8c85926e0947a308573dd additional-neb57-cuda-diagnostic/source-caches/gap4/report.json
|
| 102 |
+
e8981584d852f6608e8dc915a9825b3c7d24569c16458b3d0de90ae65d1f1f02 additional-phonons-predictions.jsonl
|
| 103 |
+
3f02f845eb7778f1cd0d6cfccc59a559d9fd037b7d16ab803a35ab8ebb97790b additional-phonons-run.json
|
| 104 |
+
828b6345710c407b652a9356a5121a8dba67ffabd9e64ee19b7e39e15081cb2c additional-phonons-score.json
|
| 105 |
+
f4c2bf293c514e6085e4ee0e7a21d2a2e57cffe6fb4f394520bfb5ee083e71d9 amorphous-energy-decomposition.json
|
| 106 |
+
f7ce67284512c19666bd64a0ab93c5f7f281aff022b7cb3025cdf9f2ba6ae950 audit_continuation.py
|
| 107 |
+
e8020b08c19ac43607476db20f2dde9a83458339184b808c1672d00f4a7d99ae background-suspension.json
|
| 108 |
+
93a7e0bbdb816bb86bb1b27dc451d42025a637b227b33dd58077af69c1381b5a broader-OMat-comparison.json
|
| 109 |
+
7b08c354083cb24910b058e8580466488c5f1aebaa39ba39ba6e050e1e4c37c8 broader-elasticity-comparison.json
|
| 110 |
+
6517f1839ba5c2a8aa200330e035869aca8884ee27bae42eff0ce4ac20a80137 broader-labeled-diagnostic-summary.json
|
| 111 |
+
9ff832696f76d3fce9a0b0524b33030404a6417dd165c6aa8eab6881a1c92fe3 broader-labeled-diagnostic.json
|
| 112 |
+
4e86bca6127f03a81984a08c6f86a8d20bac0d07b102d41a305dffa8ad9d36b8 broader-metadata-update.json
|
| 113 |
+
78aae19ada53b2fbcd7d6fccd34e2f568a672daaed2ca3802dea94376f7372b1 broader-phonon-comparison.json
|
| 114 |
+
02aaeeda3d67f6f0b4750125b254f8eb38ac3443af8ace4bf6f60ed74a54681c calculator.py
|
| 115 |
+
b5c16b0631fc8bd04237d41af809b681a3881d5fe63dee11c5effabbafaca311 check_package.py
|
| 116 |
+
79fb4236ae6620e1e858d5a0d8c4021dbf4ade013e569354b040c58a208abe2c completed-full-suite-comparison/README.md
|
| 117 |
+
7b4571e223254461bf99f341612c1d9356f25936483102688f14d063c615ecfc completed-full-suite-comparison/compare_completed100k_suites_v2.py
|
| 118 |
+
c27ea455bc1f1ae8ed4692c21deca2d9897d7b0b9583946e1433b8114763996e completed-full-suite-comparison/comparison.pdf
|
| 119 |
+
cf29c06f38f49698a3ddb99efb84350a83295fec6af06a0dc8dfffba01771a54 completed-full-suite-comparison/comparison.png
|
| 120 |
+
2e1d293de166306f5e245c7049cf0dd212bdd8eefce9ee25ee3603537bed96ce completed-full-suite-comparison/report.json
|
| 121 |
+
489e815b900ef7790e67012fc43b5d26c624a90af416bc759146174379fb60cc completed-six-suite-comparison/README.md
|
| 122 |
+
d160442b44aa9756b12dc575c427b09fa39bf838522e6ee6aa0f8acfc9e04b30 completed-six-suite-comparison/compare_completed100k_suites_v3.py
|
| 123 |
+
127fa452f5b72883f53c9998494d143d7c05366a03b34e1c0fb5309a369de5e9 completed-six-suite-comparison/comparison.pdf
|
| 124 |
+
326f7950937ae1bdd50169bf8a604bde6c2e1a758b32d015a4dc5996eac1e9e2 completed-six-suite-comparison/comparison.png
|
| 125 |
+
b7b64174d1dd8dffc44c4558a6adf77ae2ca10530ea12a361c91a9b4f503d211 completed-six-suite-comparison/report.json
|
| 126 |
+
bf511bcc8a5de55dc406bd75df67e2d35f586f5865b10ae98838641a078a7d78 consistency.json
|
| 127 |
+
c66fc6463d9ab433aee2fbb20f0b87ebe4e458bbd57981f589924827b3682dcd continuation_stage.py
|
| 128 |
+
3b91b17e20ca5d25a237de5d3412d5a12f2046929dc248f2ce01787c4f7b2cf2 curate_environments.py
|
| 129 |
+
79ef38898294ea1db1a288316f5ae48eb008c9f13d6ef41428c36c02cc761221 curate_hydrogen.py
|
| 130 |
+
ed7036a6069bca1b06a7f9e09a9a80d65727d7132ad465eadff387963552ad17 development-registry.json
|
| 131 |
+
86bf2dfb859aa4621964206cf3662e431c37bdf02f32abd6f0b7c0d5afb1a0c4 discovery-metadata-update.json
|
| 132 |
+
f9f35cfa199dd23096a446ca0d8dd34020f5a788d311141288562b12b92f3a13 effective-config.yaml
|
| 133 |
+
165e29f52cc761278bc9e3b979bdbfb0a0da196282e1f21d54deff5c63ef389a elastic-tensor-diagnostic.json
|
| 134 |
+
245f0b63d23b93a741ffe2e7a603709b0eb16df3743e177a02498e554d15e885 experiment.json
|
| 135 |
+
16d011ab077d9b8ef75c33c5b5eadac8c664c08897148e838a96d0f14fb344f5 export.json
|
| 136 |
+
64abf01febead6a296358011fa24e13e21e330b86d975975a553ef3df6ce1531 finalization-records/README-before-finalization.md
|
| 137 |
+
9c43ced1908d435650ce5a94b437e74dfd1af35f9b563549143d5a44fab7faaf finalization-records/auxiliary-energy-floor150k-v1-decision.json
|
| 138 |
+
dbe108ce91809d357ddd84b8c9535b1ad98b5b6bc28ee67c3a3478ecf115c9b7 finalization-records/cell-stress-replay-v1-decision.json
|
| 139 |
+
fbce46942b540402d81aad75cea5d3edc2e36f42e622f4e2451bd16725ee6675 finalization-records/contract.md
|
| 140 |
+
6853ac53076a7768659f43596e1ba2f3a6201d9b32649006581021354da51224 finalization-records/duration150k-floor-v1-decision.json
|
| 141 |
+
b5b98fdd12b17b20fa1ccd5384d05a4e4f27cad28731a936e1250018e740676f finalization-records/duration150k-segment-v1-decision.json
|
| 142 |
+
27b7ad61c92703dbd8afd9c27e784951a5ba877bb90c9a522d654fdab3991d26 finalization-records/finite-cell-force-floor150k-v1-decision.json
|
| 143 |
+
3c175c11e93402407cfcc0f5e6cb1ea0a7008359bdb24991effc06b57fd388bb finalization-records/force-increment-floor150k-v1-decision.json
|
| 144 |
+
cb28aae4485dbd81a75310601874948aef32d647433ae5d080b39c38a26bd645 finalization-records/prior-strain-components-v1-decision.json
|
| 145 |
+
417262466780cf3fc465e91f02c578d049d7ff1b5e7b016533f2dcfc66db9834 finalization-records/rattled6000-floor150k-v1-decision.json
|
| 146 |
+
661d9a8633f5c178f3e6c9b449f4ff79192b588302e2c2fcd9cd3ca4dfcf0643 finalization-records/rattled6000-segment150k-v1-decision.json
|
| 147 |
+
90fc0f0a2d45fd5da4240a63494d0d9dff4119d4c6754173e659a13e37b23fb7 finalization-records/source-context-v1-decision.json
|
| 148 |
+
81cd7d01fdfa145aef89d25b1f9c072c0b4e047c4591ca4e99ec48442665e123 finalize_coverage_v2.py
|
| 149 |
+
d81879fd1f40120fe8eca865c2db60e7e1c54b4d6ba8ddf415fdea18628112d0 finalize_curation.py
|
| 150 |
+
9b28a4c7fadd009a90eebf95b5e76427ebf23a9e7085d8a20d6341e3207baabe full-amorphous-comparison.json
|
| 151 |
+
87ea0c734166173ad64ba09bc29f82da4bb3c1c147e8d08fe06cc436b389f7b4 full-amorphous-diagnostic.json
|
| 152 |
+
080af7e77c4f682523b4e33965301aa41df1c55e2793116807a9a5abeef7398e full-amorphous-identity.json
|
| 153 |
+
17e71dc7d0b87b19a58e6bf8796b5ac1b75bc26a37ac70d607fa1095d304fb84 full-amorphous-metadata-update.json
|
| 154 |
+
1868b5265dceead98b11653e7f1fe81a40fe8239995b32a2361fdc9f6d7e2539 full-amorphous-predictions.json.gz
|
| 155 |
+
52184d9d257c77b9d3d56724abc1259ddbc4364ea5da43b1dc3d21e8ca3a2ae4 full-amorphous-run.json
|
| 156 |
+
8ed595af11fc06c4c1200744976b736404bf4ba6ade39f18ea02d19d96a6a306 full-amorphous-score.json
|
| 157 |
+
adff399c6628ae18949358f9c2e993df6dbabdcc2f10cf820a0559c8b7005736 full-carbon-duration-comparison.json
|
| 158 |
+
37c06477d596bb3502af98965e14b87748028f23dc1597e37822de3e9514706e full-carbon-duration-comparison.pdf
|
| 159 |
+
661dc6977b108085c076cd167a13931a7c76c051edabbb974a82a8620f85693b full-discovery-cpu-published-panel-overlap.json
|
| 160 |
+
657ca37ee7ee41e64fd359eff4501af044831f0c6a7945d606623b0ef1b532d1 full-discovery-duration-comparison.json
|
| 161 |
+
c91473f9d283909f17e339f39f81bdb6d3e74c392afdd1558f6c65d8d4d31066 full-discovery-duration-comparison.pdf
|
| 162 |
+
fa7685839d95ab727e8ff0558ff592899c7960100455be7ce8fbaffa1662b58d full-discovery-duration-comparison.png
|
| 163 |
+
b05c67a1ceb3ca6f5caec89575ecad39725261fcd722f304fce8cdd2fa278999 full-discovery-predictions.jsonl.gz
|
| 164 |
+
3249018347c2b00ed3c2d72f9775efd3bf25b75bc03d17d7df3ccf2c90511ffc full-discovery-run.json
|
| 165 |
+
ea2ec565aa31c64311e0a87d0cc7c234a9b6981f93dda948399f422c18dd7e87 full-discovery-score.json
|
| 166 |
+
dc98283ac0fe23c366ea4558a92eac8b808c82fff97491c057a062b51fa870a0 full-discovery-selection.json
|
| 167 |
+
464f1bd0ef29b4fa39e4297dc5ac7ccb718725cbbc5d349442238a9d12c1385b full-elasticity-metadata-update.json
|
| 168 |
+
aa2d98fc1151125adbb33c615ec4ebc1b5f080876a7e7d75502c831e7b3ac713 full-elasticity-summary-metadata-update.json
|
| 169 |
+
f314b1723dbaeeb9620b3489e86442f4c37140125d6f99683678f33a22da7121 full-elasticity-validation/README.md
|
| 170 |
+
29d44ca50d6d6345fde901deec3bf3749f24b7aa5be950d9130ded832e688c17 full-elasticity-validation/diagnostic.json
|
| 171 |
+
ce0cbed7638706df3d5a9e3d944523b9f8a7aa41746abd4a249fb6b390b989fe full-elasticity-validation/identity.json
|
| 172 |
+
38e57e50a717a1d907fbfb1f2b2652dc0cf7df089fa534094869703189d89c9c full-elasticity-validation/predictions.jsonl
|
| 173 |
+
6e9638cb94dd5063fcadcb1b18f00f677399ae0d860081f10554674bce4b58e2 full-elasticity-validation/priority-plan.json
|
| 174 |
+
e800d22eed47fcf5be3287486a33de7f3bc10f162dc0fa18c9fca7487b137112 full-elasticity-validation/run.json
|
| 175 |
+
f04f8a920d242247206fe496c8cfc235b15f7ce725d4298f15f6f01f55ef6146 full-elasticity-validation/score.json
|
| 176 |
+
a22ca38a96d93b219a1f9fecfb0ed08ba214db4203ed391a9c318647d0937ecb full-elasticity-validation/selection.json
|
| 177 |
+
7eb2e44b5af79420055af8c58b70e8365338c59249964df0d5b0c8b22e7885a3 full-kappa-metadata-update.json
|
| 178 |
+
fe1b03c0221b4622619debf557b697793b27efd548f20b2d6ffb024ebbf8f81f full-kappa-validation/README.md
|
| 179 |
+
5ffed54198e9d639d852744e0162074cfbbc35fe51ae82c7ee1abb255989d8ce full-kappa-validation/documentation-plan.json
|
| 180 |
+
9292416602ba7296c164ae6519a1b9dd5337628c5955df25aced7536691a3e5b full-kappa-validation/identity.json
|
| 181 |
+
b6248623cdc7308a8fdec1a93f678b31d263f75e4eaeb6088435b9711730359d full-kappa-validation/items/mp-1039.json
|
| 182 |
+
587cd4a0e4855d2788bf94e55c6b3c1c915f5d40f508b35c9e2289b2605d951c full-kappa-validation/items/mp-1132.json
|
| 183 |
+
654e6ac81515afd67c3fe43232039ec229963bc1f49458af1dd18838f724aa09 full-kappa-validation/items/mp-1253.json
|
| 184 |
+
ed568b6438416cf1b4be8f0e1a2635a4bb945220a6224c5b228f08b71a41c93b full-kappa-validation/items/mp-12779.json
|
| 185 |
+
d64f0a27f9d38ff533132d30040d1d50a88e3a02e3eb9e17ee9641e34957ef44 full-kappa-validation/items/mp-1342.json
|
| 186 |
+
0e36aa1aae925715fcb08c99c0fcebeeb125fae439f55be423608a4f903e2fe4 full-kappa-validation/items/mp-1415.json
|
| 187 |
+
b9790be2b82f0c9865a030012ab8687bb4dd6445ac451b1cd84764a68f597d9e full-kappa-validation/items/mp-1479.json
|
| 188 |
+
59feb2678256f631b6049cd5dc66eae6df591f7950fbe6482b545d2c8b7f2649 full-kappa-validation/items/mp-1541.json
|
| 189 |
+
90297f221976c2499906a9d420280f5c0a6e7fe3afb95e67de5e1410b7bf9d89 full-kappa-validation/items/mp-1672.json
|
| 190 |
+
bc9d722e3d4a5e88871e8123cde6e8c7964e8557832a852fccb74f570009790b full-kappa-validation/items/mp-20012.json
|
| 191 |
+
12060875b2e64cb0f1d6e14acbda917a7abde68e673126048c47d1a660363c85 full-kappa-validation/items/mp-20305.json
|
| 192 |
+
bfe0c4ae5ea8f06483c09eff7fc15d5dbf7b41f9e0bfdcd4ae5657433ca30967 full-kappa-validation/items/mp-20411.json
|
| 193 |
+
0f38ad5e40cbb07a83f699650e6ac0c01837e2b74719bd45e82c28d7499533a6 full-kappa-validation/items/mp-2133.json
|
| 194 |
+
a19545470eee3db16b60645fed8d26b3958d41e683e6e80290078562a70652cc full-kappa-validation/items/mp-2176.json
|
| 195 |
+
1c96b79dcf321bb94c2266b7f24d96f0136d9cfeb53eea36b22bd2dc16edc8b6 full-kappa-validation/items/mp-2201.json
|
| 196 |
+
6b8d6917ff6102e3549959d183085e7e180a35e91b22cbbfbf99703b3c207dc7 full-kappa-validation/items/mp-22205.json
|
| 197 |
+
f22109858d8098bd740a88437975a1f879c93c02ebef926d532acc1b4b5d1904 full-kappa-validation/items/mp-22903.json
|
| 198 |
+
cdba13c9ae13084197ef7982b9a66ffefd1d3219c58737bb5f34b2c3701a3e80 full-kappa-validation/items/mp-22905.json
|
| 199 |
+
2244c45767fd28551f7e523bda118e0656d8c779c80f20a28c8563c9423a1018 full-kappa-validation/items/mp-22914.json
|
| 200 |
+
6672f9de900601bf34b4d4969bfc883c6dd824e39790341f50e893d42f8ed5a9 full-kappa-validation/items/mp-22916.json
|
| 201 |
+
5cfe8819530e434da26959eace2aaef8cfa5372610a1b39515b9cfd8cc3e37ed full-kappa-validation/items/mp-23193.json
|
| 202 |
+
64a9e0d8417376a33b5c25e26227fbea0ae11d7d3464db2529b730285ccc9160 full-kappa-validation/items/mp-23251.json
|
| 203 |
+
f3a5408a35c9734e2262b516fb3a7098e43e4f5725dad7b3e61ac8aaad1b66ab full-kappa-validation/items/mp-23259.json
|
| 204 |
+
0a991e4254df35f40ce3410803a771f37e8750d24080e54c3333bce4aaaa0322 full-kappa-validation/items/mp-23703.json
|
| 205 |
+
56f5b44573c5af68cb93ffb4e9ec228c61dbccfa0a1408daf106915f8d5c6eba full-kappa-validation/items/mp-24093.json
|
| 206 |
+
1b2541d6fd5f3fd1bcdeeeba0192b11a4c29f66f70848943d8886557aa19836f full-kappa-validation/items/mp-2490.json
|
| 207 |
+
9cde80d5ed95c86ba5efc90024f107e1a2f3e96e6105c3c2fa929628ed6a1be1 full-kappa-validation/items/mp-2534.json
|
| 208 |
+
845df40827e3df5d8f108bf88bcf8f0ee6f4493b4d990a6f93178edfa308927c full-kappa-validation/items/mp-2624.json
|
| 209 |
+
3a75a9e46e1ae27403267a96e92b881093c0ab1095c95d2ba79da1a46f5db2f5 full-kappa-validation/items/mp-2653.json
|
| 210 |
+
f03c572107ded4e61112aceb49a7ca635efd53ed67a00f8e531376eb792649b9 full-kappa-validation/items/mp-2691.json
|
| 211 |
+
2f0e038b5e4239676e47f373c0f7b6807e9dfd173edd15308fb9bd01f27cf49a full-kappa-validation/items/mp-422.json
|
| 212 |
+
1ca0d6e74ce4e8c76cf0c981cae130812bb5048e0a2c61abd3770bc461f991ff full-kappa-validation/items/mp-463.json
|
| 213 |
+
784c5791ca8b8df0f07bb91061a78a2a585ca33319ba658584041fcc53728de0 full-kappa-validation/items/mp-569346.json
|
| 214 |
+
97cceaf3fe8ff0e0f4d6132284d3952628a770bea5cfd3cbecd39590121b88cb full-kappa-validation/items/mp-580941.json
|
| 215 |
+
3070df21e12e434caf9dbd1c7b5f3fe1076f9792eb256f7694691ffc85585acc full-kappa-validation/items/mp-672.json
|
| 216 |
+
652a090b10880132f5fffc2ca61a6e5d8821133695102bdb3195043155244f59 full-kappa-validation/items/mp-830.json
|
| 217 |
+
b5c43c83ddad8d869a12cb025bcebfc4b7ff5145ed8f5d4eec87eb12d82c9a13 full-kappa-validation/items/mp-8880.json
|
| 218 |
+
0c50c93ddc4de3a5acd35a95b6ad9c5d6696c84c97a91a318ec8aa478f58f77b full-kappa-validation/items/mp-8881.json
|
| 219 |
+
bbcaa0ff45e4a001dc16a2a87f48efe1135c8f373627545a248bd9c531911ba6 full-kappa-validation/items/mp-8882.json
|
| 220 |
+
70483edbf3253e914fb4452649fecb0833d9452fc308b1ec042be667a31690f7 full-kappa-validation/items/no-mp-3.json
|
| 221 |
+
0f2c2f924844805b9e5addbd9807ccf4c585cf1eabdad31ade0c44f9da49cb7f full-kappa-validation/recovery-1-before.json
|
| 222 |
+
d7565fede082a971d7815d6096215d93c7818887609e2003520c41fe91ce6ba9 full-kappa-validation/recovery-1-plan.json
|
| 223 |
+
b8baac30b4a872b74033d922364d0927e12a503cabf095520761c7b6849d96c3 full-kappa-validation/recovery-1-progress.json
|
| 224 |
+
30a38c479af08dbe98fcc17295597537c7dac481a971b4ff9f791960517d5b12 full-kappa-validation/recovery-1-stage-before.json
|
| 225 |
+
eba16ad8724753a45e9ad949ecc66d0f98d04d7f171afa0b4300f52e40e6561e full-kappa-validation/recovery-2-before.json
|
| 226 |
+
c0a5191007d013ddd07c9185bbfbfb26a0d02e93e352e38943af29318305c751 full-kappa-validation/recovery-2-plan.json
|
| 227 |
+
4de738b9d1da9856a8c2a148cf4327555bbb2667d4d181b71062bcf0b2e4ea6e full-kappa-validation/recovery-2-progress.json
|
| 228 |
+
14632891a7d5b5fccbf3a7398671ae88783ac3fb1cdc46940c69eb67f100073c full-kappa-validation/recovery-2-stage-before.json
|
| 229 |
+
5eaee11bcbdeda01f8006bca1383d31a5e22ba1887c44433c8d82cf0638249c1 full-kappa-validation/recovery-summary.json
|
| 230 |
+
6fdb895646fc84955fc8deb1480ab1411b6babc8957813e6b0d94e11cbd7f92f full-kappa-validation/run.json
|
| 231 |
+
bae1968d6b64254c9917ae3e69b012d1185c953c93698e4eb49f0579852c9996 full-kappa-validation/score.json
|
| 232 |
+
d33b2ba9637886ff83385c8a1ba9dd2f539b6a5197a95af662add0633d51e5c7 full-kappa-validation/transport-plan.json
|
| 233 |
+
ba04ed6a17745e6c87e2b2a8af30a24ef11de1993a13a75f195b23ce917b2159 full-phonons-metadata-update.json
|
| 234 |
+
b01b79e50321a623e07a7ebcf287b71e4e784775854731026826aa7e2c26dbc2 full-phonons-validation/README.md
|
| 235 |
+
e78164868927192432ba2c060738cbeeeae0abf399a21b1107467649eccec997 full-phonons-validation/diagnostic.json
|
| 236 |
+
ccb55839ad98f578ade8e6af02bc07e44af273c1086bd288543780a1a9126503 full-phonons-validation/identity.json
|
| 237 |
+
7fa53ebe1395bf03e86d0f727fd388c19ff56d270e26499f8c796846169933a6 full-phonons-validation/predictions.jsonl
|
| 238 |
+
6e9638cb94dd5063fcadcb1b18f00f677399ae0d860081f10554674bce4b58e2 full-phonons-validation/priority-plan.json
|
| 239 |
+
32c8ccd94dbdb544c346ded3a16dd9800e40c74745753bedf2aff640a2733265 full-phonons-validation/recovery-1-before.json
|
| 240 |
+
d7565fede082a971d7815d6096215d93c7818887609e2003520c41fe91ce6ba9 full-phonons-validation/recovery-1-plan.json
|
| 241 |
+
5847ea1bf79f0e496ed7f34c7e2b8d18a2a70e90416f0222d7660d965a987487 full-phonons-validation/recovery-1-progress.json
|
| 242 |
+
2d94967ef8222fb2e3d8228806194878815398329615573c787400b2d23a7223 full-phonons-validation/recovery-1-stage-before.json
|
| 243 |
+
d472d01ddc8b87bff79624a0ff533b0ea1d38c236ca6054f046d14502590a8bd full-phonons-validation/recovery-2-before.json
|
| 244 |
+
7530e549d548ca9827ad3f86ff5347bdcd5381ced80a6d86265cf8910222a52d full-phonons-validation/recovery-2-completion.json
|
| 245 |
+
c0a5191007d013ddd07c9185bbfbfb26a0d02e93e352e38943af29318305c751 full-phonons-validation/recovery-2-plan.json
|
| 246 |
+
f404e7449f848c9b934a67f92ff57a91ac14598082a7a2f067f37679ae8f3e63 full-phonons-validation/recovery-2-progress.json
|
| 247 |
+
635be0206f79d608becfe048c46939d34d7be405c1b5c3c6e52ec86128e34ad4 full-phonons-validation/recovery-2-stage-before.json
|
| 248 |
+
41632525baa5120c0eeedb5e4bb94cf6a602b97c7da3834100c87486652f5902 full-phonons-validation/recovery-documentation-plan.json
|
| 249 |
+
dd2c4c98d32fd6ce62596b63ae88ef51f2f2ff3d35aab8ca4fd3d20b8bb692a9 full-phonons-validation/recovery-documentation.json
|
| 250 |
+
0a1270110ebdc5aeccbb2ab71ef3830bc9c0d2d8e16a2ad92597ced9098a0ab0 full-phonons-validation/run.json
|
| 251 |
+
cf650c679d1d0f48e10d80d5f6a67aac61146b6ae84d694a8d403ea89f599c22 full-phonons-validation/score.json
|
| 252 |
+
0617df92f372a781d8eabb7e4bafe2ed8c1a55b16e4eaed29b3507248de7ad9c full-phonons-validation/selection.json
|
| 253 |
+
b510cab6383afcf3fdfd30aa437d9a33d329693493ffd26009c3e2508a178375 full-surface-duration-comparison.json
|
| 254 |
+
cd490e2ceab3ff1c6ed85b17f0cea54aefd797d7e768b1c6940656affdabf90f full-surface-duration-comparison.pdf
|
| 255 |
+
02327be235c219a32e65e8a13426d8cadf6f82bc19a11c27df8085d3a89da490 full-surfaces-identity.json
|
| 256 |
+
cf6d241b27a1ba3fe3bf38a927549d904a2baa63bc18a9963b0f3c427d664ad2 full-surfaces-predictions.jsonl.gz
|
| 257 |
+
c4840d7bdaf56af150b65106c31c2cdf5ab6644071ca02cfdb7f5d20506a300f full-surfaces-progress.json
|
| 258 |
+
1de4933f1718fcdf8cb44ceff1b3ed0c7cfc5612c111879732af2879b9e08d80 full-surfaces-score.json
|
| 259 |
+
3e0cef6620a19f5415ec4a947bd2dde42ee75509bf02697336db20e84aed97e7 kappa-audit-metadata-update.json
|
| 260 |
+
b61eb6401edfdefd979d36017e4209bb3a7b907010e1a9985a6af9e507815969 loader-audit.json
|
| 261 |
+
aed46a96a909a2c5ed20f94c26252dc290e94d5551a4a8d9800a971328a32f83 matched-runtime-control-validation.json
|
| 262 |
+
81b3a176ec847c1c1be0bf8ed80058c0b8bcaffdfa3c873f1ad97d6e8b566f79 matched-runtime-publication-review.json
|
| 263 |
+
ff109bae525fad5a87d10ad1bc55a9be3450a427c42dc0b8da82056be8dfd902 matched_controls.py
|
| 264 |
+
de8d12af689868c9baebb2054e64cfb38d583c224078aa8e95b829b57524f848 metadata-update.json
|
| 265 |
+
e9114f3f1647fc56a61162ce30b78ce12d0657143166dc1d51dc8213a3400cec model.pt
|
| 266 |
+
6378e5c54ab2c826195cbdfeecdd9057b3a2090a38e30cc0ac36319bd9e5bac3 mof-backend-sensitivity/README.md
|
| 267 |
+
520d2bf8a0e8406442eac52bd90030f775509d994869d8a8e87febda49148189 mof-backend-sensitivity/duration100k-runtime12-step100000-case.json
|
| 268 |
+
5d82738956186ea0ae6c30a6cc57f232b2f2b4e592cdb48dc191c64bf52ef1b3 mof-backend-sensitivity/duration100k-step100000-case.json
|
| 269 |
+
bb2c46b082f325e3a12d996e45bccdf65638f21005a91c89559bef5591ce11a9 mof-backend-sensitivity/duration100k-step100000-cpu-case.json
|
| 270 |
+
77d278cad12e9a4c528a555de7f2d7e7ea9ea1138387b5c52f4b21b0380cd4e9 mof-backend-sensitivity/report.json
|
| 271 |
+
aabdd288d22ddbc3b0e9cdb0ba3ac71f24c148daabede11e8af4544a33324f66 mof-backend-sensitivity/review_mof100k_backend_scans.py
|
| 272 |
+
7e2e2733e66a123ecfa0ef9cabf5354487cf4fda6aa44ff9ffea367409250172 mof-backend-sensitivity/scans.pdf
|
| 273 |
+
01e0d376352c8f8de9e5e13cf97756480f3a3a3244ea4d681b96c966af352e17 mof-backend-sensitivity/scans.png
|
| 274 |
+
1240d2eb13064b5c1615b73b5820587faaa9979fa29f7c55bd3b19a0b3582508 mof-scan-diagnostic.json
|
| 275 |
+
07b4355232fe7d67669c674e0bff0162bea2169226c1ac679caf9806d737941c mof-sensitivity-metadata-update.json
|
| 276 |
+
5fc18c2a57f3d1b7664fa52f566812a0a558c3a0d7a078e0817bb16d319be749 neb-audit-metadata-update.json
|
| 277 |
+
aa808c28a59b033e65dcdfbf0b24acd46053426534620cef5de39632decc0ffc neb57-diagnostic-metadata-update.json
|
| 278 |
+
be353f6ff845951df65bdf1bb84cc34b21b84891d82cb51686572f3854522f61 neighbor-coverage-metadata-update.json
|
| 279 |
+
8f228561566c04d3ef44d566658c158890bf9280a3b025246ddc328fed2d871c parent-training-and-validation.md
|
| 280 |
+
3b48a7431c65fb73188e1019a0e8977caf04dbbe9c69cd389d43b1d894724e45 pause_background_workers.py
|
| 281 |
+
dc7eb169056d4cecf365acc075da76cb52b0e523a10048fed8bd2f7747d12439 pipeline-orchestration-update.json
|
| 282 |
+
b870c0492a2f9e1bfbbcd292717928459fcf2b10891678f61e9098831497477e pool-stress-path-audit.json
|
| 283 |
+
7ee370190036a302d8c27f9e396f9bd1c8669c2689cc57d44f27fc6bf58b9377 predecessor-control-repeatability.json
|
| 284 |
+
534403ed3f7c41a4e8ece63d62619ac156162622982fe3ef301f7af4c4823f5a preparation.json
|
| 285 |
+
f24557a332118ef8a9063881564c3f05a00e5ca2d62c7df330888022728c20b9 prepare_continuation.py
|
| 286 |
+
28929714f5aed5a870a5e3d1e7062e49965c460089b893b8e9a9237b0203bcb6 prepare_coverage_config.py
|
| 287 |
+
637675084e7d9a09a9a6d035fb2357803df5e4eaed2fc2e4a65d99a0f52d766c prepare_coverage_h_config.py
|
| 288 |
+
a12b1aa4774852346113bc350cfe6ffe97c0aa93293e5ce2cf1b766d79fb3d59 prepare_omat_dev_diagnostic.py
|
| 289 |
+
a69395bca75158076ef549d82205e3f41083a871e5c1da747d1ed6446df101f7 prepare_training.py
|
| 290 |
+
a69395bca75158076ef549d82205e3f41083a871e5c1da747d1ed6446df101f7 prepare_v1.py
|
| 291 |
+
50473f06807de0241fc959d558c1b61199b41116d7b5e9e259ffcfbe3ba9f277 publication-review.json
|
| 292 |
+
335127beca52f68b64c720624349feec4312e0b78c763b634e50bc02a831753b relative_energy.py
|
| 293 |
+
683c1a88378806bb1374caa48a8fdfc4b8efbcbc9faf1c78e807cc7acb28cb19 relative_training.py
|
| 294 |
+
a0f7033adebd46911a57c8df2487a13108c1c58774040d5fe9dc8ff83cb96b97 resource-scientific-review.json
|
| 295 |
+
7aa5409c3556eec576e7a0fcdcef25a4fe764f9932f21efa8a3ffaad4f56f6c0 run_mof_logged.py
|
| 296 |
+
e3472bbbf7b64b283d2162bce39c8a964dfef38911454fd6e2963d22b9b1cb99 run_panel.py
|
| 297 |
+
e052d936ae5cee824602d876fb0f989d114c993180d37970550114a42137501e runtime-experiment-plan.json
|
| 298 |
+
5a7aaf419ad9bb6719f47c4af93e1f41c879491638efabfb362bca8f5069de81 runtime-profile-provenance.json
|
| 299 |
+
f42d4de3a0703aae19562afaf92cdf7ab953c038413d8e5f5ed5f74eb6f37834 runtime-thread-observation.json
|
| 300 |
+
5f992fea43279081319d94509ba9b9484dea3d49620c3a7b02060ffff5b8506e runtime12_stage.py
|
| 301 |
+
e81e3f0f8da139ef4755193317882c8aa6a958df67123909e8baac1392838ce1 selection-plan.json
|
| 302 |
+
ca2bb6e294cd73be4b60f7f28aa3e04d4b4358a19a54fca84ab54b1baddd81b9 selection.jsonl.gz
|
| 303 |
+
6ceadefcebfb794d378cabc249da571e0b52aa8913e74ef6d5a972cec9fd619a six-suite-status-metadata-update.json
|
| 304 |
+
f24e92ffc7963d6b022a26ed7c2d8cbeeaabc12395556dbd3db79fe495fe7b5f smoke.yaml
|
| 305 |
+
ce7e36ec4e9ec838dc0b0988aeba284e2d31ad4de94cfb9f58a577c227b4f03d source-stress-decomposition.json
|
| 306 |
+
37cb7efbe6e795b21c80c8e5bcd08afe2d0fbf59d097f76b6b565fa85dc8c5c8 split-audit.json
|
| 307 |
+
4fe23321a1e15186bac0fd3d9e84c3f14df65115d72801b711aea3339cf65014 surfaces-metadata-update.json
|
| 308 |
+
d082e67d20666f85927512a44ca7657b2cfd869e9f579cd4976046aa7233fc20 train_single.py
|
| 309 |
+
4edb51c2f8006cd3a32378914f49231bfdc59db44c68a4e519eafeb942680b7e training-neighbor-coverage/README.md
|
| 310 |
+
9533fd3a50134f522350c75340b8371ae011965a33bc3e04fa667f75de4dcaac training-neighbor-coverage/confirmed-empty-graph-failure.json
|
| 311 |
+
214158d1dfe5fce49ec24b7047eafaab9259e4c3557ed0e80e3262ae63ea2629 training-neighbor-coverage/isolated-atom-review/README.md
|
| 312 |
+
d5be3401bc5f8f77f87da9f66de6f1d4516392bc1bc27a17a2caa5e4610c9569 training-neighbor-coverage/isolated-atom-review/plan.json
|
| 313 |
+
7c68ebc11e20ad8e5aa918b3a99dd175016e5d47ac350f4490a6d3b619fde6e4 training-neighbor-coverage/isolated-atom-review/report.json
|
| 314 |
+
bb84e1ee0567694c139577c3e3aa55395a350361ab0f0e9ddf1834d49033fef6 training-neighbor-coverage/plan.json
|
| 315 |
+
8463b5b2bab690e8d445398db1b8bb213ead18b52ef2858948ddffbe8170c7e9 training-neighbor-coverage/report.json
|
| 316 |
+
68c99d90fa22cc28dc5208eb13fe341289d5523e4e3871cd82f8efafb53456be training-summary.json
|
| 317 |
+
5de3a59493b8f6166833006612b06c82f3e7c060515da59b0445b6a6303f1eb1 validation-panel.json
|
| 318 |
+
6297922ca40f5361d89397dd70813bf90aea55ec478770af4a7b2a26bd7582b2 validation.json
|
shared/package-files/2e/2ea4a717a746c15cfa898719b58815519482e2875a2119c5457e6f0885af589d/blob
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2ea4a717a746c15cfa898719b58815519482e2875a2119c5457e6f0885af589d
|
| 3 |
+
size 353320
|
shared/package-files/2e/2eab602cade8e09484ac61e8c813333e531828c91cfe2e4ffdef8f2908dcb7f7/blob
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 convolution_overrideable {
|
| 18 |
+
using schema = at::Tensor (const at::Tensor &, const at::Tensor &, const c10::optional<at::Tensor> &, c10::SymIntArrayRef, c10::SymIntArrayRef, c10::SymIntArrayRef, bool, c10::SymIntArrayRef, c10::SymInt);
|
| 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::convolution_overrideable")
|
| 22 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
|
| 23 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "convolution_overrideable(Tensor input, Tensor weight, Tensor? bias, SymInt[] stride, SymInt[] padding, SymInt[] dilation, bool transposed, SymInt[] output_padding, SymInt groups) -> Tensor")
|
| 24 |
+
static at::Tensor call(const at::Tensor & input, const at::Tensor & weight, const c10::optional<at::Tensor> & bias, c10::SymIntArrayRef stride, c10::SymIntArrayRef padding, c10::SymIntArrayRef dilation, bool transposed, c10::SymIntArrayRef output_padding, c10::SymInt groups);
|
| 25 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & input, const at::Tensor & weight, const c10::optional<at::Tensor> & bias, c10::SymIntArrayRef stride, c10::SymIntArrayRef padding, c10::SymIntArrayRef dilation, bool transposed, c10::SymIntArrayRef output_padding, c10::SymInt groups);
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
struct TORCH_API convolution_overrideable_out {
|
| 29 |
+
using schema = at::Tensor & (const at::Tensor &, const at::Tensor &, const c10::optional<at::Tensor> &, c10::SymIntArrayRef, c10::SymIntArrayRef, c10::SymIntArrayRef, bool, c10::SymIntArrayRef, c10::SymInt, 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::convolution_overrideable")
|
| 33 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out")
|
| 34 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "convolution_overrideable.out(Tensor input, Tensor weight, Tensor? bias, SymInt[] stride, SymInt[] padding, SymInt[] dilation, bool transposed, SymInt[] output_padding, SymInt groups, *, Tensor(a!) out) -> Tensor(a!)")
|
| 35 |
+
static at::Tensor & call(const at::Tensor & input, const at::Tensor & weight, const c10::optional<at::Tensor> & bias, c10::SymIntArrayRef stride, c10::SymIntArrayRef padding, c10::SymIntArrayRef dilation, bool transposed, c10::SymIntArrayRef output_padding, c10::SymInt groups, at::Tensor & out);
|
| 36 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & input, const at::Tensor & weight, const c10::optional<at::Tensor> & bias, c10::SymIntArrayRef stride, c10::SymIntArrayRef padding, c10::SymIntArrayRef dilation, bool transposed, c10::SymIntArrayRef output_padding, c10::SymInt groups, at::Tensor & out);
|
| 37 |
+
};
|
| 38 |
+
|
| 39 |
+
}} // namespace at::_ops
|
shared/package-files/2e/2eabb41cdb7633a98cb0d49f3d7938f87853397075d0d4c49227a3abde1d063f/blob
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 avg_pool1d(const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef stride={}, at::IntArrayRef padding=0, bool ceil_mode=false, bool count_include_pad=true);
|
| 20 |
+
} // namespace native
|
| 21 |
+
} // namespace at
|
shared/package-files/2e/2eabb4ac0bbc238804fe01626bb3b94c9711d1653350382481b886a819cb3640/blob
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 detach(const at::Tensor & self);
|
| 20 |
+
TORCH_API at::Tensor & detach_(at::Tensor & self);
|
| 21 |
+
} // namespace native
|
| 22 |
+
} // namespace at
|
shared/package-files/2e/2ead4cdad023d0c362f960157422c50f36596e151be4090d0e1d3ccb83aefe15/blob
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/mps_convolution_backward_ops.h>
|
| 21 |
+
|
| 22 |
+
namespace at {
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
// aten::mps_convolution_backward(Tensor self, Tensor grad_output, Tensor weight, SymInt[] padding, SymInt[] stride, SymInt[] dilation, SymInt groups, bool[3] output_mask) -> (Tensor, Tensor, Tensor)
|
| 26 |
+
inline ::std::tuple<at::Tensor,at::Tensor,at::Tensor> mps_convolution_backward(const at::Tensor & self, const at::Tensor & grad_output, const at::Tensor & weight, at::IntArrayRef padding, at::IntArrayRef stride, at::IntArrayRef dilation, int64_t groups, ::std::array<bool,3> output_mask) {
|
| 27 |
+
return at::_ops::mps_convolution_backward::call(self, grad_output, weight, c10::fromIntArrayRefSlow(padding), c10::fromIntArrayRefSlow(stride), c10::fromIntArrayRefSlow(dilation), groups, output_mask);
|
| 28 |
+
}
|
| 29 |
+
namespace symint {
|
| 30 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
|
| 31 |
+
::std::tuple<at::Tensor,at::Tensor,at::Tensor> mps_convolution_backward(const at::Tensor & self, const at::Tensor & grad_output, const at::Tensor & weight, at::IntArrayRef padding, at::IntArrayRef stride, at::IntArrayRef dilation, int64_t groups, ::std::array<bool,3> output_mask) {
|
| 32 |
+
return at::_ops::mps_convolution_backward::call(self, grad_output, weight, c10::fromIntArrayRefSlow(padding), c10::fromIntArrayRefSlow(stride), c10::fromIntArrayRefSlow(dilation), groups, output_mask);
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
// aten::mps_convolution_backward(Tensor self, Tensor grad_output, Tensor weight, SymInt[] padding, SymInt[] stride, SymInt[] dilation, SymInt groups, bool[3] output_mask) -> (Tensor, Tensor, Tensor)
|
| 37 |
+
inline ::std::tuple<at::Tensor,at::Tensor,at::Tensor> mps_convolution_backward_symint(const at::Tensor & self, const at::Tensor & grad_output, const at::Tensor & weight, c10::SymIntArrayRef padding, c10::SymIntArrayRef stride, c10::SymIntArrayRef dilation, c10::SymInt groups, ::std::array<bool,3> output_mask) {
|
| 38 |
+
return at::_ops::mps_convolution_backward::call(self, grad_output, weight, padding, stride, dilation, groups, output_mask);
|
| 39 |
+
}
|
| 40 |
+
namespace symint {
|
| 41 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
|
| 42 |
+
::std::tuple<at::Tensor,at::Tensor,at::Tensor> mps_convolution_backward(const at::Tensor & self, const at::Tensor & grad_output, const at::Tensor & weight, c10::SymIntArrayRef padding, c10::SymIntArrayRef stride, c10::SymIntArrayRef dilation, c10::SymInt groups, ::std::array<bool,3> output_mask) {
|
| 43 |
+
return at::_ops::mps_convolution_backward::call(self, grad_output, weight, padding, stride, dilation, groups, output_mask);
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
// aten::mps_convolution_backward.out(Tensor self, Tensor grad_output, Tensor weight, SymInt[] padding, SymInt[] stride, SymInt[] dilation, SymInt groups, bool[3] output_mask, *, Tensor(a!) out0, Tensor(b!) out1, Tensor(c!) out2) -> (Tensor(a!), Tensor(b!), Tensor(c!))
|
| 48 |
+
inline ::std::tuple<at::Tensor &,at::Tensor &,at::Tensor &> mps_convolution_backward_out(at::Tensor & out0, at::Tensor & out1, at::Tensor & out2, const at::Tensor & self, const at::Tensor & grad_output, const at::Tensor & weight, at::IntArrayRef padding, at::IntArrayRef stride, at::IntArrayRef dilation, int64_t groups, ::std::array<bool,3> output_mask) {
|
| 49 |
+
return at::_ops::mps_convolution_backward_out::call(self, grad_output, weight, c10::fromIntArrayRefSlow(padding), c10::fromIntArrayRefSlow(stride), c10::fromIntArrayRefSlow(dilation), groups, output_mask, out0, out1, out2);
|
| 50 |
+
}
|
| 51 |
+
namespace symint {
|
| 52 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
|
| 53 |
+
::std::tuple<at::Tensor &,at::Tensor &,at::Tensor &> mps_convolution_backward_out(at::Tensor & out0, at::Tensor & out1, at::Tensor & out2, const at::Tensor & self, const at::Tensor & grad_output, const at::Tensor & weight, at::IntArrayRef padding, at::IntArrayRef stride, at::IntArrayRef dilation, int64_t groups, ::std::array<bool,3> output_mask) {
|
| 54 |
+
return at::_ops::mps_convolution_backward_out::call(self, grad_output, weight, c10::fromIntArrayRefSlow(padding), c10::fromIntArrayRefSlow(stride), c10::fromIntArrayRefSlow(dilation), groups, output_mask, out0, out1, out2);
|
| 55 |
+
}
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
// aten::mps_convolution_backward.out(Tensor self, Tensor grad_output, Tensor weight, SymInt[] padding, SymInt[] stride, SymInt[] dilation, SymInt groups, bool[3] output_mask, *, Tensor(a!) out0, Tensor(b!) out1, Tensor(c!) out2) -> (Tensor(a!), Tensor(b!), Tensor(c!))
|
| 59 |
+
inline ::std::tuple<at::Tensor &,at::Tensor &,at::Tensor &> mps_convolution_backward_outf(const at::Tensor & self, const at::Tensor & grad_output, const at::Tensor & weight, at::IntArrayRef padding, at::IntArrayRef stride, at::IntArrayRef dilation, int64_t groups, ::std::array<bool,3> output_mask, at::Tensor & out0, at::Tensor & out1, at::Tensor & out2) {
|
| 60 |
+
return at::_ops::mps_convolution_backward_out::call(self, grad_output, weight, c10::fromIntArrayRefSlow(padding), c10::fromIntArrayRefSlow(stride), c10::fromIntArrayRefSlow(dilation), groups, output_mask, out0, out1, out2);
|
| 61 |
+
}
|
| 62 |
+
namespace symint {
|
| 63 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
|
| 64 |
+
::std::tuple<at::Tensor &,at::Tensor &,at::Tensor &> mps_convolution_backward_outf(const at::Tensor & self, const at::Tensor & grad_output, const at::Tensor & weight, at::IntArrayRef padding, at::IntArrayRef stride, at::IntArrayRef dilation, int64_t groups, ::std::array<bool,3> output_mask, at::Tensor & out0, at::Tensor & out1, at::Tensor & out2) {
|
| 65 |
+
return at::_ops::mps_convolution_backward_out::call(self, grad_output, weight, c10::fromIntArrayRefSlow(padding), c10::fromIntArrayRefSlow(stride), c10::fromIntArrayRefSlow(dilation), groups, output_mask, out0, out1, out2);
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
// aten::mps_convolution_backward.out(Tensor self, Tensor grad_output, Tensor weight, SymInt[] padding, SymInt[] stride, SymInt[] dilation, SymInt groups, bool[3] output_mask, *, Tensor(a!) out0, Tensor(b!) out1, Tensor(c!) out2) -> (Tensor(a!), Tensor(b!), Tensor(c!))
|
| 70 |
+
inline ::std::tuple<at::Tensor &,at::Tensor &,at::Tensor &> mps_convolution_backward_symint_out(at::Tensor & out0, at::Tensor & out1, at::Tensor & out2, const at::Tensor & self, const at::Tensor & grad_output, const at::Tensor & weight, c10::SymIntArrayRef padding, c10::SymIntArrayRef stride, c10::SymIntArrayRef dilation, c10::SymInt groups, ::std::array<bool,3> output_mask) {
|
| 71 |
+
return at::_ops::mps_convolution_backward_out::call(self, grad_output, weight, padding, stride, dilation, groups, output_mask, out0, out1, out2);
|
| 72 |
+
}
|
| 73 |
+
namespace symint {
|
| 74 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
|
| 75 |
+
::std::tuple<at::Tensor &,at::Tensor &,at::Tensor &> mps_convolution_backward_out(at::Tensor & out0, at::Tensor & out1, at::Tensor & out2, const at::Tensor & self, const at::Tensor & grad_output, const at::Tensor & weight, c10::SymIntArrayRef padding, c10::SymIntArrayRef stride, c10::SymIntArrayRef dilation, c10::SymInt groups, ::std::array<bool,3> output_mask) {
|
| 76 |
+
return at::_ops::mps_convolution_backward_out::call(self, grad_output, weight, padding, stride, dilation, groups, output_mask, out0, out1, out2);
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
// aten::mps_convolution_backward.out(Tensor self, Tensor grad_output, Tensor weight, SymInt[] padding, SymInt[] stride, SymInt[] dilation, SymInt groups, bool[3] output_mask, *, Tensor(a!) out0, Tensor(b!) out1, Tensor(c!) out2) -> (Tensor(a!), Tensor(b!), Tensor(c!))
|
| 81 |
+
inline ::std::tuple<at::Tensor &,at::Tensor &,at::Tensor &> mps_convolution_backward_symint_outf(const at::Tensor & self, const at::Tensor & grad_output, const at::Tensor & weight, c10::SymIntArrayRef padding, c10::SymIntArrayRef stride, c10::SymIntArrayRef dilation, c10::SymInt groups, ::std::array<bool,3> output_mask, at::Tensor & out0, at::Tensor & out1, at::Tensor & out2) {
|
| 82 |
+
return at::_ops::mps_convolution_backward_out::call(self, grad_output, weight, padding, stride, dilation, groups, output_mask, out0, out1, out2);
|
| 83 |
+
}
|
| 84 |
+
namespace symint {
|
| 85 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
|
| 86 |
+
::std::tuple<at::Tensor &,at::Tensor &,at::Tensor &> mps_convolution_backward_outf(const at::Tensor & self, const at::Tensor & grad_output, const at::Tensor & weight, c10::SymIntArrayRef padding, c10::SymIntArrayRef stride, c10::SymIntArrayRef dilation, c10::SymInt groups, ::std::array<bool,3> output_mask, at::Tensor & out0, at::Tensor & out1, at::Tensor & out2) {
|
| 87 |
+
return at::_ops::mps_convolution_backward_out::call(self, grad_output, weight, padding, stride, dilation, groups, output_mask, out0, out1, out2);
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
}
|
shared/package-files/2e/2eb0e1b96a4fa1f4fcc3edbaefaf5094c583a852ee0bcf8715b1cce911477b3b/blob
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2eb0e1b96a4fa1f4fcc3edbaefaf5094c583a852ee0bcf8715b1cce911477b3b
|
| 3 |
+
size 5916984
|
shared/package-files/2e/2eb40044553fffc467aaf31fad117e24949cfd62b4dfd2a2d94dbad5e0f2151d/blob
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 compositeimplicitautograd {
|
| 19 |
+
|
| 20 |
+
TORCH_API at::Tensor view_as(const at::Tensor & self, const at::Tensor & other);
|
| 21 |
+
|
| 22 |
+
} // namespace compositeimplicitautograd
|
| 23 |
+
} // namespace at
|
shared/package-files/2e/2eb44462c9e559c11b14a7bc2c1d088a551566f12f76d73d3b9672326a8cd5c8/blob
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import copy
|
| 2 |
+
import warnings
|
| 3 |
+
from torch.utils.data.datapipes.datapipe import IterDataPipe
|
| 4 |
+
|
| 5 |
+
__all__ = ["IterableWrapperIterDataPipe", ]
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class IterableWrapperIterDataPipe(IterDataPipe):
|
| 9 |
+
r"""
|
| 10 |
+
Wraps an iterable object to create an IterDataPipe.
|
| 11 |
+
|
| 12 |
+
Args:
|
| 13 |
+
iterable: Iterable object to be wrapped into an IterDataPipe
|
| 14 |
+
deepcopy: Option to deepcopy input iterable object for each
|
| 15 |
+
iterator. The copy is made when the first element is read in ``iter()``.
|
| 16 |
+
|
| 17 |
+
.. note::
|
| 18 |
+
If ``deepcopy`` is explicitly set to ``False``, users should ensure
|
| 19 |
+
that the data pipeline doesn't contain any in-place operations over
|
| 20 |
+
the iterable instance to prevent data inconsistency across iterations.
|
| 21 |
+
|
| 22 |
+
Example:
|
| 23 |
+
>>> # xdoctest: +SKIP
|
| 24 |
+
>>> from torchdata.datapipes.iter import IterableWrapper
|
| 25 |
+
>>> dp = IterableWrapper(range(10))
|
| 26 |
+
>>> list(dp)
|
| 27 |
+
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
| 28 |
+
"""
|
| 29 |
+
|
| 30 |
+
def __init__(self, iterable, deepcopy=True):
|
| 31 |
+
self.iterable = iterable
|
| 32 |
+
self.deepcopy = deepcopy
|
| 33 |
+
|
| 34 |
+
def __iter__(self):
|
| 35 |
+
source_data = self.iterable
|
| 36 |
+
if self.deepcopy:
|
| 37 |
+
try:
|
| 38 |
+
source_data = copy.deepcopy(self.iterable)
|
| 39 |
+
# For the case that data cannot be deep-copied,
|
| 40 |
+
# all in-place operations will affect iterable variable.
|
| 41 |
+
# When this DataPipe is iterated second time, it will
|
| 42 |
+
# yield modified items.
|
| 43 |
+
except TypeError:
|
| 44 |
+
warnings.warn(
|
| 45 |
+
"The input iterable can not be deepcopied, "
|
| 46 |
+
"please be aware of in-place modification would affect source data."
|
| 47 |
+
)
|
| 48 |
+
yield from source_data
|
| 49 |
+
|
| 50 |
+
def __len__(self):
|
| 51 |
+
return len(self.iterable)
|
shared/package-files/2e/2eb6246b0764da26e8e0c408cdab10aff3cf03be070dbd5ad8c7dd2e79c470d2/blob
ADDED
|
@@ -0,0 +1,555 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
|
| 3 |
+
# Copyright (c) Facebook, Inc. and its affiliates.
|
| 4 |
+
# All rights reserved.
|
| 5 |
+
#
|
| 6 |
+
# This source code is licensed under the BSD-style license found in the
|
| 7 |
+
# LICENSE file in the root directory of this source tree.
|
| 8 |
+
|
| 9 |
+
import abc
|
| 10 |
+
import logging
|
| 11 |
+
import os
|
| 12 |
+
import re
|
| 13 |
+
import signal
|
| 14 |
+
import subprocess
|
| 15 |
+
import sys
|
| 16 |
+
import time
|
| 17 |
+
from contextlib import nullcontext
|
| 18 |
+
from dataclasses import dataclass, field
|
| 19 |
+
from enum import IntFlag
|
| 20 |
+
from typing import Any, Callable, Dict, Optional, Set, Tuple, Union
|
| 21 |
+
|
| 22 |
+
import torch.multiprocessing as mp
|
| 23 |
+
from torchelastic.multiprocessing.errors import ProcessFailure, record
|
| 24 |
+
from torchelastic.multiprocessing.redirects import redirect_stderr, redirect_stdout
|
| 25 |
+
from torchelastic.multiprocessing.tail_log import TailLog
|
| 26 |
+
|
| 27 |
+
log = logging.getLogger(__name__)
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def _validate_full_rank(d: Dict[int, Any], nprocs: int, what: str):
|
| 31 |
+
actual_keys = set(d.keys())
|
| 32 |
+
expected_keys = set(range(nprocs))
|
| 33 |
+
|
| 34 |
+
if actual_keys != expected_keys:
|
| 35 |
+
raise RuntimeError(
|
| 36 |
+
f"{what}, local rank mapping mismatch,"
|
| 37 |
+
f" expected: {expected_keys}, actual: {actual_keys}"
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
_MAPPING_REGEX = r"^(\d:[0123],)*(\d:[0123])$"
|
| 42 |
+
_VALUE_REGEX = r"^[0123]$"
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
class Std(IntFlag):
|
| 46 |
+
NONE = 0
|
| 47 |
+
OUT = 1
|
| 48 |
+
ERR = 2
|
| 49 |
+
ALL = OUT | ERR
|
| 50 |
+
|
| 51 |
+
@classmethod
|
| 52 |
+
def from_str(cls, vm: str) -> Union["Std", Dict[int, "Std"]]:
|
| 53 |
+
"""
|
| 54 |
+
Example:
|
| 55 |
+
|
| 56 |
+
::
|
| 57 |
+
|
| 58 |
+
from_str("0") -> Std.NONE
|
| 59 |
+
from_str("1") -> Std.OUT
|
| 60 |
+
from_str("0:3,1:0,2:1,3:2") -> {0: Std.ALL, 1: Std.NONE, 2: Std.OUT, 3: Std.ERR}
|
| 61 |
+
|
| 62 |
+
Any other input raises an exception
|
| 63 |
+
"""
|
| 64 |
+
|
| 65 |
+
def to_std(v):
|
| 66 |
+
v = int(v)
|
| 67 |
+
for s in Std:
|
| 68 |
+
if s == v:
|
| 69 |
+
return s
|
| 70 |
+
# return None -> should NEVER reach here since we regex check input
|
| 71 |
+
|
| 72 |
+
if re.match(_VALUE_REGEX, vm): # vm is a number (e.g. 0)
|
| 73 |
+
return to_std(vm)
|
| 74 |
+
elif re.match(_MAPPING_REGEX, vm): # vm is a mapping (e.g. 0:1,1:2)
|
| 75 |
+
d: Dict[int, Std] = {}
|
| 76 |
+
for m in vm.split(","):
|
| 77 |
+
i, v = m.split(":")
|
| 78 |
+
d[int(i)] = to_std(v)
|
| 79 |
+
return d
|
| 80 |
+
else:
|
| 81 |
+
raise ValueError(
|
| 82 |
+
f"{vm} does not match: <{_VALUE_REGEX}> or <{_MAPPING_REGEX}>"
|
| 83 |
+
)
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
def to_map(
|
| 87 |
+
val_or_map: Union[Std, Dict[int, Std]], local_world_size: int
|
| 88 |
+
) -> Dict[int, Std]:
|
| 89 |
+
"""
|
| 90 |
+
Certain APIs take redirect settings either as a single value (e.g. apply to all
|
| 91 |
+
local ranks) or as an explicit user-provided mapping. This method is a convenience
|
| 92 |
+
method that converts a value or mapping into a mapping.
|
| 93 |
+
|
| 94 |
+
Example:
|
| 95 |
+
|
| 96 |
+
::
|
| 97 |
+
|
| 98 |
+
to_map(Std.OUT, local_world_size=2) # returns: {0: Std.OUT, 1: Std.OUT}
|
| 99 |
+
to_map({1: Std.OUT}, local_world_size=2) # returns: {0: Std.NONE, 1: Std.OUT}
|
| 100 |
+
to_map({0: Std.OUT, 1: Std.OUT}, local_world_size=2) # returns: {0: Std.OUT, 1: Std.OUT}
|
| 101 |
+
"""
|
| 102 |
+
if isinstance(val_or_map, Std):
|
| 103 |
+
return {i: val_or_map for i in range(local_world_size)}
|
| 104 |
+
else:
|
| 105 |
+
map = {}
|
| 106 |
+
for i in range(local_world_size):
|
| 107 |
+
map[i] = val_or_map.get(i, Std.NONE)
|
| 108 |
+
return map
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
@dataclass
|
| 112 |
+
class RunProcsResult:
|
| 113 |
+
"""
|
| 114 |
+
Results of a completed run of processes started with ``start_processes()``.
|
| 115 |
+
Returned by ``PContext``.
|
| 116 |
+
|
| 117 |
+
Note the following:
|
| 118 |
+
|
| 119 |
+
1. All fields are mapped by local rank
|
| 120 |
+
2. ``return_values`` - only populated for functions (not the binaries).
|
| 121 |
+
3. ``stdouts`` - path to stdout.log (empty string if no redirect)
|
| 122 |
+
4. ``stderrs`` - path to stderr.log (empty string if no redirect)
|
| 123 |
+
|
| 124 |
+
"""
|
| 125 |
+
|
| 126 |
+
return_values: Dict[int, Any] = field(default_factory=dict)
|
| 127 |
+
failures: Dict[int, ProcessFailure] = field(default_factory=dict)
|
| 128 |
+
stdouts: Dict[int, str] = field(default_factory=dict)
|
| 129 |
+
stderrs: Dict[int, str] = field(default_factory=dict)
|
| 130 |
+
|
| 131 |
+
def is_failed(self) -> bool:
|
| 132 |
+
return len(self.failures) > 0
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
class PContext(abc.ABC):
|
| 136 |
+
"""
|
| 137 |
+
The base class that standardizes operations over a set of processes
|
| 138 |
+
that are launched via different mechanisms. The name ``PContext``
|
| 139 |
+
is intentional to disambiguate with ``torch.multiprocessing.ProcessContext``.
|
| 140 |
+
|
| 141 |
+
.. warning:: stdouts and stderrs should ALWAYS be a superset of
|
| 142 |
+
tee_stdouts and tee_stderrs (respectively) this is b/c
|
| 143 |
+
tee is implemented as a redirect + tail -f <stdout/stderr.log>
|
| 144 |
+
"""
|
| 145 |
+
|
| 146 |
+
def __init__(
|
| 147 |
+
self,
|
| 148 |
+
name: str,
|
| 149 |
+
entrypoint: Union[Callable, str],
|
| 150 |
+
args: Dict[int, Tuple],
|
| 151 |
+
envs: Dict[int, Dict[str, str]],
|
| 152 |
+
stdouts: Dict[int, str],
|
| 153 |
+
stderrs: Dict[int, str],
|
| 154 |
+
tee_stdouts: Dict[int, str],
|
| 155 |
+
tee_stderrs: Dict[int, str],
|
| 156 |
+
error_files: Dict[int, str],
|
| 157 |
+
):
|
| 158 |
+
self.name = name
|
| 159 |
+
# validate that all mappings have the same number of keys and
|
| 160 |
+
# all local ranks are accounted for
|
| 161 |
+
nprocs = len(args)
|
| 162 |
+
_validate_full_rank(stdouts, nprocs, "stdouts")
|
| 163 |
+
_validate_full_rank(stderrs, nprocs, "stderrs")
|
| 164 |
+
|
| 165 |
+
self.entrypoint = entrypoint
|
| 166 |
+
self.args = args
|
| 167 |
+
self.envs = envs
|
| 168 |
+
self.stdouts = stdouts
|
| 169 |
+
self.stderrs = stderrs
|
| 170 |
+
self.error_files = error_files
|
| 171 |
+
self.nprocs = nprocs
|
| 172 |
+
|
| 173 |
+
self._stdout_tail = TailLog(name, tee_stdouts, sys.stdout)
|
| 174 |
+
self._stderr_tail = TailLog(name, tee_stderrs, sys.stderr)
|
| 175 |
+
|
| 176 |
+
def start(self) -> None:
|
| 177 |
+
"""
|
| 178 |
+
Start processes using parameters defined in the constructor.
|
| 179 |
+
"""
|
| 180 |
+
self._start()
|
| 181 |
+
self._stdout_tail.start()
|
| 182 |
+
self._stderr_tail.start()
|
| 183 |
+
|
| 184 |
+
@abc.abstractmethod
|
| 185 |
+
def _start(self) -> None:
|
| 186 |
+
"""
|
| 187 |
+
Start processes using strategy defined in a particular context.
|
| 188 |
+
"""
|
| 189 |
+
raise NotImplementedError()
|
| 190 |
+
|
| 191 |
+
@abc.abstractmethod
|
| 192 |
+
def _poll(self) -> Optional[RunProcsResult]:
|
| 193 |
+
"""
|
| 194 |
+
Polls the run status of the processes running under this context.
|
| 195 |
+
This method follows an "all-or-nothing" policy and returns
|
| 196 |
+
a ``RunProcessResults`` object if either all processes complete
|
| 197 |
+
successfully or any process fails. Returns ``None`` if
|
| 198 |
+
all processes are still running.
|
| 199 |
+
"""
|
| 200 |
+
raise NotImplementedError()
|
| 201 |
+
|
| 202 |
+
def wait(self, timeout: float = -1, period: float = 1) -> Optional[RunProcsResult]:
|
| 203 |
+
"""
|
| 204 |
+
Waits for the specified ``timeout`` seconds, polling every ``period`` seconds
|
| 205 |
+
for the processes to be done. Returns ``None`` if the processes are still running
|
| 206 |
+
on timeout expiry. Negative timeout values are interpreted as "wait-forever".
|
| 207 |
+
A timeout value of zero simply queries the status of the processes (e.g. equivalent
|
| 208 |
+
to a poll).
|
| 209 |
+
"""
|
| 210 |
+
|
| 211 |
+
if timeout == 0:
|
| 212 |
+
return self._poll()
|
| 213 |
+
|
| 214 |
+
if timeout < 0:
|
| 215 |
+
timeout = sys.maxsize
|
| 216 |
+
|
| 217 |
+
expiry = time.time() + timeout
|
| 218 |
+
while time.time() < expiry:
|
| 219 |
+
pr = self._poll()
|
| 220 |
+
if pr:
|
| 221 |
+
return pr
|
| 222 |
+
time.sleep(period)
|
| 223 |
+
|
| 224 |
+
return None
|
| 225 |
+
|
| 226 |
+
@abc.abstractmethod
|
| 227 |
+
def pids(self) -> Dict[int, int]:
|
| 228 |
+
"""
|
| 229 |
+
Returns pids of processes mapped by their respective local_ranks
|
| 230 |
+
"""
|
| 231 |
+
raise NotImplementedError()
|
| 232 |
+
|
| 233 |
+
@abc.abstractmethod
|
| 234 |
+
def _close(self) -> None:
|
| 235 |
+
r"""
|
| 236 |
+
Terminates all processes managed by this context and cleans up any
|
| 237 |
+
meta resources (e.g. redirect, error_file files).
|
| 238 |
+
"""
|
| 239 |
+
raise NotImplementedError()
|
| 240 |
+
|
| 241 |
+
def close(self) -> None:
|
| 242 |
+
self._close()
|
| 243 |
+
if self._stdout_tail:
|
| 244 |
+
self._stdout_tail.stop()
|
| 245 |
+
if self._stderr_tail:
|
| 246 |
+
self._stderr_tail.stop()
|
| 247 |
+
|
| 248 |
+
|
| 249 |
+
def _wrap(
|
| 250 |
+
local_rank: int,
|
| 251 |
+
fn: Callable,
|
| 252 |
+
args: Dict[int, Tuple],
|
| 253 |
+
envs: Dict[int, Dict[str, str]],
|
| 254 |
+
stdout_redirects: Dict[int, str], # redirect file for stdout (to console if None)
|
| 255 |
+
stderr_redirects: Dict[int, str], # redirect file for stderr (to console if None)
|
| 256 |
+
ret_vals: Dict[int, mp.SimpleQueue],
|
| 257 |
+
) -> None:
|
| 258 |
+
# get the per-rank params up front so we fail fast if no mapping is found
|
| 259 |
+
args_ = args[local_rank]
|
| 260 |
+
env_ = envs[local_rank]
|
| 261 |
+
ret_val_ = ret_vals[local_rank]
|
| 262 |
+
|
| 263 |
+
stdout_rd = stdout_redirects[local_rank]
|
| 264 |
+
stderr_rd = stderr_redirects[local_rank]
|
| 265 |
+
|
| 266 |
+
stdout_cm = redirect_stdout(stdout_rd) if stdout_rd else nullcontext()
|
| 267 |
+
stderr_cm = redirect_stderr(stderr_rd) if stderr_rd else nullcontext()
|
| 268 |
+
|
| 269 |
+
for k, v in env_.items():
|
| 270 |
+
os.environ[k] = v
|
| 271 |
+
|
| 272 |
+
with stdout_cm, stderr_cm:
|
| 273 |
+
ret = record(fn)(*args_)
|
| 274 |
+
ret_val_.put(ret)
|
| 275 |
+
|
| 276 |
+
|
| 277 |
+
class MultiprocessContext(PContext):
|
| 278 |
+
"""
|
| 279 |
+
``PContext`` holding worker processes invoked as a function.
|
| 280 |
+
"""
|
| 281 |
+
|
| 282 |
+
def __init__(
|
| 283 |
+
self,
|
| 284 |
+
name: str,
|
| 285 |
+
entrypoint: Callable,
|
| 286 |
+
args: Dict[int, Tuple],
|
| 287 |
+
envs: Dict[int, Dict[str, str]],
|
| 288 |
+
stdouts: Dict[int, str],
|
| 289 |
+
stderrs: Dict[int, str],
|
| 290 |
+
tee_stdouts: Dict[int, str],
|
| 291 |
+
tee_stderrs: Dict[int, str],
|
| 292 |
+
error_files: Dict[int, str],
|
| 293 |
+
start_method: str,
|
| 294 |
+
):
|
| 295 |
+
super().__init__(
|
| 296 |
+
name,
|
| 297 |
+
entrypoint,
|
| 298 |
+
args,
|
| 299 |
+
envs,
|
| 300 |
+
stdouts,
|
| 301 |
+
stderrs,
|
| 302 |
+
tee_stdouts,
|
| 303 |
+
tee_stderrs,
|
| 304 |
+
error_files,
|
| 305 |
+
)
|
| 306 |
+
|
| 307 |
+
self.start_method = start_method
|
| 308 |
+
# each ret_val queue will always contain a single element.
|
| 309 |
+
self._ret_vals = {
|
| 310 |
+
local_rank: mp.get_context(self.start_method).SimpleQueue()
|
| 311 |
+
for local_rank in range(self.nprocs)
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
# see comments in ``join()`` for what this is
|
| 315 |
+
self._return_values: Dict[int, Any] = {}
|
| 316 |
+
# pyre-fixme[8]: The attribute is defined in _start method
|
| 317 |
+
self._pc: mp.ProcessContext = None
|
| 318 |
+
|
| 319 |
+
def _start(self):
|
| 320 |
+
if self._pc:
|
| 321 |
+
raise ValueError(
|
| 322 |
+
"The process context already initialized. Most likely the start method got called twice."
|
| 323 |
+
)
|
| 324 |
+
self._pc: mp.ProcessContext = mp.start_processes(
|
| 325 |
+
fn=_wrap,
|
| 326 |
+
args=(
|
| 327 |
+
self.entrypoint,
|
| 328 |
+
self.args,
|
| 329 |
+
self.envs,
|
| 330 |
+
self.stdouts,
|
| 331 |
+
self.stderrs,
|
| 332 |
+
self._ret_vals,
|
| 333 |
+
),
|
| 334 |
+
nprocs=self.nprocs,
|
| 335 |
+
join=False,
|
| 336 |
+
daemon=False,
|
| 337 |
+
start_method=self.start_method,
|
| 338 |
+
)
|
| 339 |
+
|
| 340 |
+
def _poll(self) -> Optional[RunProcsResult]:
|
| 341 |
+
try:
|
| 342 |
+
# torch.mp.ProcessContext returns True if all the workers have
|
| 343 |
+
# successfully finished, False if some/all are still running
|
| 344 |
+
# and throws an Exception if some/all of them failed
|
| 345 |
+
# timeout < 0 checks worker status and return immediately
|
| 346 |
+
done = self._pc.join(-1)
|
| 347 |
+
|
| 348 |
+
# IMPORTANT: we use multiprocessing.Queue to carry worker return values
|
| 349 |
+
# back to the parent, the worker process will wait before terminating
|
| 350 |
+
# until all the buffered items are fed by the feeder thread to the underlying
|
| 351 |
+
# pipe. Hence to prevent deadlocks on large return values,
|
| 352 |
+
# we opportunistically try queue.get on each join call
|
| 353 |
+
# See: https://docs.python.org/2/library/multiprocessing.html#all-platforms
|
| 354 |
+
for local_rank in range(0, self.nprocs):
|
| 355 |
+
return_queue = self._ret_vals[local_rank]
|
| 356 |
+
if not return_queue.empty():
|
| 357 |
+
# save the return values temporarily into a member var
|
| 358 |
+
self._return_values[local_rank] = return_queue.get()
|
| 359 |
+
|
| 360 |
+
if done:
|
| 361 |
+
# we should ALWAYS have ALL the return values when all the processes are done
|
| 362 |
+
_validate_full_rank(
|
| 363 |
+
self._return_values, self.nprocs, "return_value queue"
|
| 364 |
+
)
|
| 365 |
+
self.close()
|
| 366 |
+
return RunProcsResult(
|
| 367 |
+
return_values=self._return_values,
|
| 368 |
+
stdouts=self.stdouts,
|
| 369 |
+
stderrs=self.stderrs,
|
| 370 |
+
)
|
| 371 |
+
else:
|
| 372 |
+
return None
|
| 373 |
+
except (mp.ProcessRaisedException, mp.ProcessExitedException) as e:
|
| 374 |
+
failed_local_rank = e.error_index
|
| 375 |
+
# pyre-ignore entrypoint fn has a __qualname__.
|
| 376 |
+
fn_name = self.entrypoint.__qualname__
|
| 377 |
+
failed_proc = self._pc.processes[failed_local_rank]
|
| 378 |
+
error_filepath = self.error_files[failed_local_rank]
|
| 379 |
+
|
| 380 |
+
log.error(
|
| 381 |
+
f"failed (exitcode: {failed_proc.exitcode})"
|
| 382 |
+
f" local_rank: {failed_local_rank} (pid: {e.pid})"
|
| 383 |
+
f" of fn: {fn_name} (start_method: {self.start_method})",
|
| 384 |
+
exc_info=True,
|
| 385 |
+
)
|
| 386 |
+
|
| 387 |
+
self.close()
|
| 388 |
+
return RunProcsResult(
|
| 389 |
+
failures={
|
| 390 |
+
failed_local_rank: ProcessFailure(
|
| 391 |
+
local_rank=failed_local_rank,
|
| 392 |
+
pid=e.pid,
|
| 393 |
+
exitcode=failed_proc.exitcode,
|
| 394 |
+
error_file=error_filepath,
|
| 395 |
+
)
|
| 396 |
+
},
|
| 397 |
+
stdouts=self.stdouts,
|
| 398 |
+
stderrs=self.stderrs,
|
| 399 |
+
)
|
| 400 |
+
|
| 401 |
+
def pids(self) -> Dict[int, int]:
|
| 402 |
+
return {local_rank: pid for local_rank, pid in enumerate(self._pc.pids())}
|
| 403 |
+
|
| 404 |
+
def _close(self) -> None:
|
| 405 |
+
if self._pc:
|
| 406 |
+
for proc in self._pc.processes:
|
| 407 |
+
proc.terminate()
|
| 408 |
+
proc.join()
|
| 409 |
+
|
| 410 |
+
|
| 411 |
+
class SubprocessHandler:
|
| 412 |
+
"""
|
| 413 |
+
Convenience wrapper around python's ``subprocess.Popen``. Keeps track of
|
| 414 |
+
meta-objects associated to the process (e.g. stdout and stderr redirect fds).
|
| 415 |
+
"""
|
| 416 |
+
|
| 417 |
+
def __init__(
|
| 418 |
+
self,
|
| 419 |
+
entrypoint: str,
|
| 420 |
+
args: Tuple,
|
| 421 |
+
env: Dict[str, str],
|
| 422 |
+
preexec_fn: Callable,
|
| 423 |
+
stdout: str,
|
| 424 |
+
stderr: str,
|
| 425 |
+
):
|
| 426 |
+
self._stdout = open(stdout, "w") if stdout else None
|
| 427 |
+
self._stderr = open(stderr, "w") if stderr else None
|
| 428 |
+
args_str = [str(e) for e in args]
|
| 429 |
+
|
| 430 |
+
# inherit parent environment vars
|
| 431 |
+
env_vars = os.environ.copy()
|
| 432 |
+
env_vars.update(env)
|
| 433 |
+
|
| 434 |
+
self.proc: subprocess.Popen = subprocess.Popen(
|
| 435 |
+
args=(entrypoint, *args_str),
|
| 436 |
+
env=env_vars,
|
| 437 |
+
preexec_fn=preexec_fn,
|
| 438 |
+
stdout=self._stdout,
|
| 439 |
+
stderr=self._stderr,
|
| 440 |
+
)
|
| 441 |
+
|
| 442 |
+
def close(self):
|
| 443 |
+
self.proc.terminate()
|
| 444 |
+
self.proc.wait()
|
| 445 |
+
if self._stdout:
|
| 446 |
+
self._stdout.close()
|
| 447 |
+
if self._stderr:
|
| 448 |
+
self._stderr.close()
|
| 449 |
+
|
| 450 |
+
|
| 451 |
+
class SubprocessContext(PContext):
|
| 452 |
+
"""
|
| 453 |
+
``PContext`` holding worker processes invoked as a binary.
|
| 454 |
+
"""
|
| 455 |
+
|
| 456 |
+
def __init__(
|
| 457 |
+
self,
|
| 458 |
+
name: str,
|
| 459 |
+
entrypoint: str,
|
| 460 |
+
args: Dict[int, Tuple],
|
| 461 |
+
envs: Dict[int, Dict[str, str]],
|
| 462 |
+
stdouts: Dict[int, str],
|
| 463 |
+
stderrs: Dict[int, str],
|
| 464 |
+
tee_stdouts: Dict[int, str],
|
| 465 |
+
tee_stderrs: Dict[int, str],
|
| 466 |
+
error_files: Dict[int, str],
|
| 467 |
+
):
|
| 468 |
+
super().__init__(
|
| 469 |
+
name,
|
| 470 |
+
entrypoint,
|
| 471 |
+
args,
|
| 472 |
+
envs,
|
| 473 |
+
stdouts,
|
| 474 |
+
stderrs,
|
| 475 |
+
tee_stdouts,
|
| 476 |
+
tee_stderrs,
|
| 477 |
+
error_files,
|
| 478 |
+
)
|
| 479 |
+
|
| 480 |
+
# state vector; _vdone[local_rank] -> is local_rank finished or not
|
| 481 |
+
self._running_local_ranks: Set[int] = set(range(self.nprocs))
|
| 482 |
+
self._failures: Dict[int, ProcessFailure] = {}
|
| 483 |
+
# pyre-fixme[8]: The attribute is defined in _start method
|
| 484 |
+
self.subprocess_handlers: Dict[int, SubprocessHandler] = None
|
| 485 |
+
|
| 486 |
+
def _start(self):
|
| 487 |
+
if self.subprocess_handlers:
|
| 488 |
+
raise ValueError(
|
| 489 |
+
"The subprocess handlers already initialized. Most likely the start method got called twice."
|
| 490 |
+
)
|
| 491 |
+
self.subprocess_handlers: Dict[int, SubprocessHandler] = {
|
| 492 |
+
local_rank: SubprocessHandler(
|
| 493 |
+
entrypoint=self.entrypoint,
|
| 494 |
+
args=self.args[local_rank],
|
| 495 |
+
env=self.envs[local_rank],
|
| 496 |
+
preexec_fn=mp._prctl_pr_set_pdeathsig(signal.SIGTERM),
|
| 497 |
+
stdout=self.stdouts[local_rank],
|
| 498 |
+
stderr=self.stderrs[local_rank],
|
| 499 |
+
)
|
| 500 |
+
for local_rank in range(self.nprocs)
|
| 501 |
+
}
|
| 502 |
+
|
| 503 |
+
def _poll(self) -> Optional[RunProcsResult]:
|
| 504 |
+
done_local_ranks = set()
|
| 505 |
+
for local_rank in self._running_local_ranks:
|
| 506 |
+
handler = self.subprocess_handlers[local_rank]
|
| 507 |
+
exitcode = handler.proc.poll()
|
| 508 |
+
if exitcode is not None:
|
| 509 |
+
done_local_ranks.add(local_rank)
|
| 510 |
+
if exitcode != 0: # failed or signaled
|
| 511 |
+
self._failures[local_rank] = ProcessFailure(
|
| 512 |
+
local_rank=local_rank,
|
| 513 |
+
pid=handler.proc.pid,
|
| 514 |
+
exitcode=exitcode,
|
| 515 |
+
error_file=self.error_files[local_rank],
|
| 516 |
+
)
|
| 517 |
+
# else: --> succeeded; nothing to do
|
| 518 |
+
|
| 519 |
+
self._running_local_ranks.difference_update(done_local_ranks)
|
| 520 |
+
|
| 521 |
+
# if ALL procs are finished or ANY have failed
|
| 522 |
+
if not self._running_local_ranks or self._failures:
|
| 523 |
+
self.close() # terminate all running procs
|
| 524 |
+
result = RunProcsResult(
|
| 525 |
+
failures=self._failures,
|
| 526 |
+
stdouts=self.stdouts,
|
| 527 |
+
stderrs=self.stderrs,
|
| 528 |
+
)
|
| 529 |
+
if result.is_failed():
|
| 530 |
+
first_failure = min(result.failures.values(), key=lambda f: f.timestamp)
|
| 531 |
+
log.error(
|
| 532 |
+
f"failed (exitcode: {first_failure.exitcode})"
|
| 533 |
+
f" local_rank: {first_failure.local_rank} (pid: {first_failure.pid})"
|
| 534 |
+
f" of binary: {self.entrypoint}"
|
| 535 |
+
)
|
| 536 |
+
else:
|
| 537 |
+
# Populate return with dummy values. This provides consistency with MultiprocessingHandler
|
| 538 |
+
result.return_values = {
|
| 539 |
+
local_rank: None for local_rank in range(self.nprocs)
|
| 540 |
+
}
|
| 541 |
+
|
| 542 |
+
return result
|
| 543 |
+
else: # there are no failures and procs still running
|
| 544 |
+
return None
|
| 545 |
+
|
| 546 |
+
def pids(self) -> Dict[int, int]:
|
| 547 |
+
return {
|
| 548 |
+
local_rank: sh.proc.pid
|
| 549 |
+
for local_rank, sh in self.subprocess_handlers.items()
|
| 550 |
+
}
|
| 551 |
+
|
| 552 |
+
def _close(self) -> None:
|
| 553 |
+
if self.subprocess_handlers:
|
| 554 |
+
for handler in self.subprocess_handlers.values():
|
| 555 |
+
handler.close()
|
shared/package-files/2e/2eb9c84a7741917b5dba0bce59e464f59198425ced148e72ab2b6869988a3909/blob
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#define TORCH_ASSERT_NO_OPERATORS
|
| 2 |
+
|
| 3 |
+
#include <ATen/native/DispatchStub.h>
|
| 4 |
+
#include <ATen/TensorIterator.h>
|
| 5 |
+
#include <ATen/TensorMeta.h>
|
| 6 |
+
|
| 7 |
+
namespace at {
|
| 8 |
+
|
| 9 |
+
// NB: this is explicitly copied here (via codegen) rather than
|
| 10 |
+
// included via NativeFunctions.h to avoid recompiling this file when
|
| 11 |
+
// NativeFunctions.h changes
|
| 12 |
+
namespace meta {
|
| 13 |
+
${meta_declaration}
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
namespace native {
|
| 17 |
+
${native_declaration}
|
| 18 |
+
${native_definitions}
|
| 19 |
+
}} // namespace at::native
|
shared/package-files/2e/2ebd6a872ab2c28a1b3648fdb007dda2fa05cbdbc17e4cf678775309ceec651b/blob
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
|
| 2 |
+
|
| 3 |
+
# Copyright (C) 2003-2017 Nominum, Inc.
|
| 4 |
+
#
|
| 5 |
+
# Permission to use, copy, modify, and distribute this software and its
|
| 6 |
+
# documentation for any purpose with or without fee is hereby granted,
|
| 7 |
+
# provided that the above copyright notice and this permission notice
|
| 8 |
+
# appear in all copies.
|
| 9 |
+
#
|
| 10 |
+
# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES
|
| 11 |
+
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
| 12 |
+
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR
|
| 13 |
+
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
| 14 |
+
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
| 15 |
+
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
| 16 |
+
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
| 17 |
+
|
| 18 |
+
import itertools
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class Set:
|
| 22 |
+
"""A simple set class.
|
| 23 |
+
|
| 24 |
+
This class was originally used to deal with sets being missing in
|
| 25 |
+
ancient versions of python, but dnspython will continue to use it
|
| 26 |
+
as these sets are based on lists and are thus indexable, and this
|
| 27 |
+
ability is widely used in dnspython applications.
|
| 28 |
+
"""
|
| 29 |
+
|
| 30 |
+
__slots__ = ["items"]
|
| 31 |
+
|
| 32 |
+
def __init__(self, items=None):
|
| 33 |
+
"""Initialize the set.
|
| 34 |
+
|
| 35 |
+
*items*, an iterable or ``None``, the initial set of items.
|
| 36 |
+
"""
|
| 37 |
+
|
| 38 |
+
self.items = dict()
|
| 39 |
+
if items is not None:
|
| 40 |
+
for item in items:
|
| 41 |
+
# This is safe for how we use set, but if other code
|
| 42 |
+
# subclasses it could be a legitimate issue.
|
| 43 |
+
self.add(item) # lgtm[py/init-calls-subclass]
|
| 44 |
+
|
| 45 |
+
def __repr__(self):
|
| 46 |
+
return "dns.set.Set(%s)" % repr(list(self.items.keys()))
|
| 47 |
+
|
| 48 |
+
def add(self, item):
|
| 49 |
+
"""Add an item to the set."""
|
| 50 |
+
|
| 51 |
+
if item not in self.items:
|
| 52 |
+
self.items[item] = None
|
| 53 |
+
|
| 54 |
+
def remove(self, item):
|
| 55 |
+
"""Remove an item from the set."""
|
| 56 |
+
|
| 57 |
+
try:
|
| 58 |
+
del self.items[item]
|
| 59 |
+
except KeyError:
|
| 60 |
+
raise ValueError
|
| 61 |
+
|
| 62 |
+
def discard(self, item):
|
| 63 |
+
"""Remove an item from the set if present."""
|
| 64 |
+
|
| 65 |
+
self.items.pop(item, None)
|
| 66 |
+
|
| 67 |
+
def pop(self):
|
| 68 |
+
"""Remove an arbitrary item from the set."""
|
| 69 |
+
(k, _) = self.items.popitem()
|
| 70 |
+
return k
|
| 71 |
+
|
| 72 |
+
def _clone(self) -> "Set":
|
| 73 |
+
"""Make a (shallow) copy of the set.
|
| 74 |
+
|
| 75 |
+
There is a 'clone protocol' that subclasses of this class
|
| 76 |
+
should use. To make a copy, first call your super's _clone()
|
| 77 |
+
method, and use the object returned as the new instance. Then
|
| 78 |
+
make shallow copies of the attributes defined in the subclass.
|
| 79 |
+
|
| 80 |
+
This protocol allows us to write the set algorithms that
|
| 81 |
+
return new instances (e.g. union) once, and keep using them in
|
| 82 |
+
subclasses.
|
| 83 |
+
"""
|
| 84 |
+
|
| 85 |
+
if hasattr(self, "_clone_class"):
|
| 86 |
+
cls = self._clone_class # type: ignore
|
| 87 |
+
else:
|
| 88 |
+
cls = self.__class__
|
| 89 |
+
obj = cls.__new__(cls)
|
| 90 |
+
obj.items = dict()
|
| 91 |
+
obj.items.update(self.items)
|
| 92 |
+
return obj
|
| 93 |
+
|
| 94 |
+
def __copy__(self):
|
| 95 |
+
"""Make a (shallow) copy of the set."""
|
| 96 |
+
|
| 97 |
+
return self._clone()
|
| 98 |
+
|
| 99 |
+
def copy(self):
|
| 100 |
+
"""Make a (shallow) copy of the set."""
|
| 101 |
+
|
| 102 |
+
return self._clone()
|
| 103 |
+
|
| 104 |
+
def union_update(self, other):
|
| 105 |
+
"""Update the set, adding any elements from other which are not
|
| 106 |
+
already in the set.
|
| 107 |
+
"""
|
| 108 |
+
|
| 109 |
+
if not isinstance(other, Set):
|
| 110 |
+
raise ValueError("other must be a Set instance")
|
| 111 |
+
if self is other: # lgtm[py/comparison-using-is]
|
| 112 |
+
return
|
| 113 |
+
for item in other.items:
|
| 114 |
+
self.add(item)
|
| 115 |
+
|
| 116 |
+
def intersection_update(self, other):
|
| 117 |
+
"""Update the set, removing any elements from other which are not
|
| 118 |
+
in both sets.
|
| 119 |
+
"""
|
| 120 |
+
|
| 121 |
+
if not isinstance(other, Set):
|
| 122 |
+
raise ValueError("other must be a Set instance")
|
| 123 |
+
if self is other: # lgtm[py/comparison-using-is]
|
| 124 |
+
return
|
| 125 |
+
# we make a copy of the list so that we can remove items from
|
| 126 |
+
# the list without breaking the iterator.
|
| 127 |
+
for item in list(self.items):
|
| 128 |
+
if item not in other.items:
|
| 129 |
+
del self.items[item]
|
| 130 |
+
|
| 131 |
+
def difference_update(self, other):
|
| 132 |
+
"""Update the set, removing any elements from other which are in
|
| 133 |
+
the set.
|
| 134 |
+
"""
|
| 135 |
+
|
| 136 |
+
if not isinstance(other, Set):
|
| 137 |
+
raise ValueError("other must be a Set instance")
|
| 138 |
+
if self is other: # lgtm[py/comparison-using-is]
|
| 139 |
+
self.items.clear()
|
| 140 |
+
else:
|
| 141 |
+
for item in other.items:
|
| 142 |
+
self.discard(item)
|
| 143 |
+
|
| 144 |
+
def symmetric_difference_update(self, other):
|
| 145 |
+
"""Update the set, retaining only elements unique to both sets."""
|
| 146 |
+
|
| 147 |
+
if not isinstance(other, Set):
|
| 148 |
+
raise ValueError("other must be a Set instance")
|
| 149 |
+
if self is other: # lgtm[py/comparison-using-is]
|
| 150 |
+
self.items.clear()
|
| 151 |
+
else:
|
| 152 |
+
overlap = self.intersection(other)
|
| 153 |
+
self.union_update(other)
|
| 154 |
+
self.difference_update(overlap)
|
| 155 |
+
|
| 156 |
+
def union(self, other):
|
| 157 |
+
"""Return a new set which is the union of ``self`` and ``other``.
|
| 158 |
+
|
| 159 |
+
Returns the same Set type as this set.
|
| 160 |
+
"""
|
| 161 |
+
|
| 162 |
+
obj = self._clone()
|
| 163 |
+
obj.union_update(other)
|
| 164 |
+
return obj
|
| 165 |
+
|
| 166 |
+
def intersection(self, other):
|
| 167 |
+
"""Return a new set which is the intersection of ``self`` and
|
| 168 |
+
``other``.
|
| 169 |
+
|
| 170 |
+
Returns the same Set type as this set.
|
| 171 |
+
"""
|
| 172 |
+
|
| 173 |
+
obj = self._clone()
|
| 174 |
+
obj.intersection_update(other)
|
| 175 |
+
return obj
|
| 176 |
+
|
| 177 |
+
def difference(self, other):
|
| 178 |
+
"""Return a new set which ``self`` - ``other``, i.e. the items
|
| 179 |
+
in ``self`` which are not also in ``other``.
|
| 180 |
+
|
| 181 |
+
Returns the same Set type as this set.
|
| 182 |
+
"""
|
| 183 |
+
|
| 184 |
+
obj = self._clone()
|
| 185 |
+
obj.difference_update(other)
|
| 186 |
+
return obj
|
| 187 |
+
|
| 188 |
+
def symmetric_difference(self, other):
|
| 189 |
+
"""Return a new set which (``self`` - ``other``) | (``other``
|
| 190 |
+
- ``self), ie: the items in either ``self`` or ``other`` which
|
| 191 |
+
are not contained in their intersection.
|
| 192 |
+
|
| 193 |
+
Returns the same Set type as this set.
|
| 194 |
+
"""
|
| 195 |
+
|
| 196 |
+
obj = self._clone()
|
| 197 |
+
obj.symmetric_difference_update(other)
|
| 198 |
+
return obj
|
| 199 |
+
|
| 200 |
+
def __or__(self, other):
|
| 201 |
+
return self.union(other)
|
| 202 |
+
|
| 203 |
+
def __and__(self, other):
|
| 204 |
+
return self.intersection(other)
|
| 205 |
+
|
| 206 |
+
def __add__(self, other):
|
| 207 |
+
return self.union(other)
|
| 208 |
+
|
| 209 |
+
def __sub__(self, other):
|
| 210 |
+
return self.difference(other)
|
| 211 |
+
|
| 212 |
+
def __xor__(self, other):
|
| 213 |
+
return self.symmetric_difference(other)
|
| 214 |
+
|
| 215 |
+
def __ior__(self, other):
|
| 216 |
+
self.union_update(other)
|
| 217 |
+
return self
|
| 218 |
+
|
| 219 |
+
def __iand__(self, other):
|
| 220 |
+
self.intersection_update(other)
|
| 221 |
+
return self
|
| 222 |
+
|
| 223 |
+
def __iadd__(self, other):
|
| 224 |
+
self.union_update(other)
|
| 225 |
+
return self
|
| 226 |
+
|
| 227 |
+
def __isub__(self, other):
|
| 228 |
+
self.difference_update(other)
|
| 229 |
+
return self
|
| 230 |
+
|
| 231 |
+
def __ixor__(self, other):
|
| 232 |
+
self.symmetric_difference_update(other)
|
| 233 |
+
return self
|
| 234 |
+
|
| 235 |
+
def update(self, other):
|
| 236 |
+
"""Update the set, adding any elements from other which are not
|
| 237 |
+
already in the set.
|
| 238 |
+
|
| 239 |
+
*other*, the collection of items with which to update the set, which
|
| 240 |
+
may be any iterable type.
|
| 241 |
+
"""
|
| 242 |
+
|
| 243 |
+
for item in other:
|
| 244 |
+
self.add(item)
|
| 245 |
+
|
| 246 |
+
def clear(self):
|
| 247 |
+
"""Make the set empty."""
|
| 248 |
+
self.items.clear()
|
| 249 |
+
|
| 250 |
+
def __eq__(self, other):
|
| 251 |
+
return self.items == other.items
|
| 252 |
+
|
| 253 |
+
def __ne__(self, other):
|
| 254 |
+
return not self.__eq__(other)
|
| 255 |
+
|
| 256 |
+
def __len__(self):
|
| 257 |
+
return len(self.items)
|
| 258 |
+
|
| 259 |
+
def __iter__(self):
|
| 260 |
+
return iter(self.items)
|
| 261 |
+
|
| 262 |
+
def __getitem__(self, i):
|
| 263 |
+
if isinstance(i, slice):
|
| 264 |
+
return list(itertools.islice(self.items, i.start, i.stop, i.step))
|
| 265 |
+
else:
|
| 266 |
+
return next(itertools.islice(self.items, i, i + 1))
|
| 267 |
+
|
| 268 |
+
def __delitem__(self, i):
|
| 269 |
+
if isinstance(i, slice):
|
| 270 |
+
for elt in list(self[i]):
|
| 271 |
+
del self.items[elt]
|
| 272 |
+
else:
|
| 273 |
+
del self.items[self[i]]
|
| 274 |
+
|
| 275 |
+
def issubset(self, other):
|
| 276 |
+
"""Is this set a subset of *other*?
|
| 277 |
+
|
| 278 |
+
Returns a ``bool``.
|
| 279 |
+
"""
|
| 280 |
+
|
| 281 |
+
if not isinstance(other, Set):
|
| 282 |
+
raise ValueError("other must be a Set instance")
|
| 283 |
+
for item in self.items:
|
| 284 |
+
if item not in other.items:
|
| 285 |
+
return False
|
| 286 |
+
return True
|
| 287 |
+
|
| 288 |
+
def issuperset(self, other):
|
| 289 |
+
"""Is this set a superset of *other*?
|
| 290 |
+
|
| 291 |
+
Returns a ``bool``.
|
| 292 |
+
"""
|
| 293 |
+
|
| 294 |
+
if not isinstance(other, Set):
|
| 295 |
+
raise ValueError("other must be a Set instance")
|
| 296 |
+
for item in other.items:
|
| 297 |
+
if item not in self.items:
|
| 298 |
+
return False
|
| 299 |
+
return True
|
| 300 |
+
|
| 301 |
+
def isdisjoint(self, other):
|
| 302 |
+
if not isinstance(other, Set):
|
| 303 |
+
raise ValueError("other must be a Set instance")
|
| 304 |
+
for item in other.items:
|
| 305 |
+
if item in self.items:
|
| 306 |
+
return False
|
| 307 |
+
return True
|
shared/package-files/2e/2ebdb2ff589719bc9cd931b5d7f2dec8183b217151fbed270d48fbd8a30d69a5/blob
ADDED
|
@@ -0,0 +1,540 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""
|
| 3 |
+
Defines a variety of Pygments lexers for highlighting IPython code.
|
| 4 |
+
|
| 5 |
+
This includes:
|
| 6 |
+
|
| 7 |
+
IPythonLexer, IPython3Lexer
|
| 8 |
+
Lexers for pure IPython (python + magic/shell commands)
|
| 9 |
+
|
| 10 |
+
IPythonPartialTracebackLexer, IPythonTracebackLexer
|
| 11 |
+
Supports 2.x and 3.x via keyword `python3`. The partial traceback
|
| 12 |
+
lexer reads everything but the Python code appearing in a traceback.
|
| 13 |
+
The full lexer combines the partial lexer with an IPython lexer.
|
| 14 |
+
|
| 15 |
+
IPythonConsoleLexer
|
| 16 |
+
A lexer for IPython console sessions, with support for tracebacks.
|
| 17 |
+
|
| 18 |
+
IPyLexer
|
| 19 |
+
A friendly lexer which examines the first line of text and from it,
|
| 20 |
+
decides whether to use an IPython lexer or an IPython console lexer.
|
| 21 |
+
This is probably the only lexer that needs to be explicitly added
|
| 22 |
+
to Pygments.
|
| 23 |
+
|
| 24 |
+
"""
|
| 25 |
+
#-----------------------------------------------------------------------------
|
| 26 |
+
# Copyright (c) 2013, the IPython Development Team.
|
| 27 |
+
#
|
| 28 |
+
# Distributed under the terms of the Modified BSD License.
|
| 29 |
+
#
|
| 30 |
+
# The full license is in the file COPYING.txt, distributed with this software.
|
| 31 |
+
#-----------------------------------------------------------------------------
|
| 32 |
+
|
| 33 |
+
# Standard library
|
| 34 |
+
import re
|
| 35 |
+
|
| 36 |
+
# Third party
|
| 37 |
+
from pygments.lexers import (
|
| 38 |
+
BashLexer, HtmlLexer, JavascriptLexer, RubyLexer, PerlLexer, PythonLexer,
|
| 39 |
+
Python3Lexer, TexLexer)
|
| 40 |
+
from pygments.lexer import (
|
| 41 |
+
Lexer, DelegatingLexer, RegexLexer, do_insertions, bygroups, using,
|
| 42 |
+
)
|
| 43 |
+
from pygments.token import (
|
| 44 |
+
Generic, Keyword, Literal, Name, Operator, Other, Text, Error,
|
| 45 |
+
)
|
| 46 |
+
from pygments.util import get_bool_opt
|
| 47 |
+
|
| 48 |
+
# Local
|
| 49 |
+
|
| 50 |
+
line_re = re.compile('.*?\n')
|
| 51 |
+
|
| 52 |
+
__all__ = ['build_ipy_lexer', 'IPython3Lexer', 'IPythonLexer',
|
| 53 |
+
'IPythonPartialTracebackLexer', 'IPythonTracebackLexer',
|
| 54 |
+
'IPythonConsoleLexer', 'IPyLexer']
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def build_ipy_lexer(python3):
|
| 58 |
+
"""Builds IPython lexers depending on the value of `python3`.
|
| 59 |
+
|
| 60 |
+
The lexer inherits from an appropriate Python lexer and then adds
|
| 61 |
+
information about IPython specific keywords (i.e. magic commands,
|
| 62 |
+
shell commands, etc.)
|
| 63 |
+
|
| 64 |
+
Parameters
|
| 65 |
+
----------
|
| 66 |
+
python3 : bool
|
| 67 |
+
If `True`, then build an IPython lexer from a Python 3 lexer.
|
| 68 |
+
|
| 69 |
+
"""
|
| 70 |
+
# It would be nice to have a single IPython lexer class which takes
|
| 71 |
+
# a boolean `python3`. But since there are two Python lexer classes,
|
| 72 |
+
# we will also have two IPython lexer classes.
|
| 73 |
+
if python3:
|
| 74 |
+
PyLexer = Python3Lexer
|
| 75 |
+
name = 'IPython3'
|
| 76 |
+
aliases = ['ipython3']
|
| 77 |
+
doc = """IPython3 Lexer"""
|
| 78 |
+
else:
|
| 79 |
+
PyLexer = PythonLexer
|
| 80 |
+
name = 'IPython'
|
| 81 |
+
aliases = ['ipython2', 'ipython']
|
| 82 |
+
doc = """IPython Lexer"""
|
| 83 |
+
|
| 84 |
+
ipython_tokens = [
|
| 85 |
+
(r'(?s)(\s*)(%%capture)([^\n]*\n)(.*)', bygroups(Text, Operator, Text, using(PyLexer))),
|
| 86 |
+
(r'(?s)(\s*)(%%debug)([^\n]*\n)(.*)', bygroups(Text, Operator, Text, using(PyLexer))),
|
| 87 |
+
(r'(?is)(\s*)(%%html)([^\n]*\n)(.*)', bygroups(Text, Operator, Text, using(HtmlLexer))),
|
| 88 |
+
(r'(?s)(\s*)(%%javascript)([^\n]*\n)(.*)', bygroups(Text, Operator, Text, using(JavascriptLexer))),
|
| 89 |
+
(r'(?s)(\s*)(%%js)([^\n]*\n)(.*)', bygroups(Text, Operator, Text, using(JavascriptLexer))),
|
| 90 |
+
(r'(?s)(\s*)(%%latex)([^\n]*\n)(.*)', bygroups(Text, Operator, Text, using(TexLexer))),
|
| 91 |
+
(r'(?s)(\s*)(%%perl)([^\n]*\n)(.*)', bygroups(Text, Operator, Text, using(PerlLexer))),
|
| 92 |
+
(r'(?s)(\s*)(%%prun)([^\n]*\n)(.*)', bygroups(Text, Operator, Text, using(PyLexer))),
|
| 93 |
+
(r'(?s)(\s*)(%%pypy)([^\n]*\n)(.*)', bygroups(Text, Operator, Text, using(PyLexer))),
|
| 94 |
+
(r'(?s)(\s*)(%%python)([^\n]*\n)(.*)', bygroups(Text, Operator, Text, using(PyLexer))),
|
| 95 |
+
(r'(?s)(\s*)(%%python2)([^\n]*\n)(.*)', bygroups(Text, Operator, Text, using(PythonLexer))),
|
| 96 |
+
(r'(?s)(\s*)(%%python3)([^\n]*\n)(.*)', bygroups(Text, Operator, Text, using(Python3Lexer))),
|
| 97 |
+
(r'(?s)(\s*)(%%ruby)([^\n]*\n)(.*)', bygroups(Text, Operator, Text, using(RubyLexer))),
|
| 98 |
+
(r'(?s)(\s*)(%%time)([^\n]*\n)(.*)', bygroups(Text, Operator, Text, using(PyLexer))),
|
| 99 |
+
(r'(?s)(\s*)(%%timeit)([^\n]*\n)(.*)', bygroups(Text, Operator, Text, using(PyLexer))),
|
| 100 |
+
(r'(?s)(\s*)(%%writefile)([^\n]*\n)(.*)', bygroups(Text, Operator, Text, using(PyLexer))),
|
| 101 |
+
(r'(?s)(\s*)(%%file)([^\n]*\n)(.*)', bygroups(Text, Operator, Text, using(PyLexer))),
|
| 102 |
+
(r"(?s)(\s*)(%%)(\w+)(.*)", bygroups(Text, Operator, Keyword, Text)),
|
| 103 |
+
(r'(?s)(^\s*)(%%!)([^\n]*\n)(.*)', bygroups(Text, Operator, Text, using(BashLexer))),
|
| 104 |
+
(r"(%%?)(\w+)(\?\??)$", bygroups(Operator, Keyword, Operator)),
|
| 105 |
+
(r"\b(\?\??)(\s*)$", bygroups(Operator, Text)),
|
| 106 |
+
(r'(%)(sx|sc|system)(.*)(\n)', bygroups(Operator, Keyword,
|
| 107 |
+
using(BashLexer), Text)),
|
| 108 |
+
(r'(%)(\w+)(.*\n)', bygroups(Operator, Keyword, Text)),
|
| 109 |
+
(r'^(!!)(.+)(\n)', bygroups(Operator, using(BashLexer), Text)),
|
| 110 |
+
(r'(!)(?!=)(.+)(\n)', bygroups(Operator, using(BashLexer), Text)),
|
| 111 |
+
(r'^(\s*)(\?\??)(\s*%{0,2}[\w\.\*]*)', bygroups(Text, Operator, Text)),
|
| 112 |
+
(r'(\s*%{0,2}[\w\.\*]*)(\?\??)(\s*)$', bygroups(Text, Operator, Text)),
|
| 113 |
+
]
|
| 114 |
+
|
| 115 |
+
tokens = PyLexer.tokens.copy()
|
| 116 |
+
tokens['root'] = ipython_tokens + tokens['root']
|
| 117 |
+
|
| 118 |
+
attrs = {'name': name, 'aliases': aliases, 'filenames': [],
|
| 119 |
+
'__doc__': doc, 'tokens': tokens}
|
| 120 |
+
|
| 121 |
+
return type(name, (PyLexer,), attrs)
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
IPython3Lexer = build_ipy_lexer(python3=True)
|
| 125 |
+
IPythonLexer = build_ipy_lexer(python3=False)
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
class IPythonPartialTracebackLexer(RegexLexer):
|
| 129 |
+
"""
|
| 130 |
+
Partial lexer for IPython tracebacks.
|
| 131 |
+
|
| 132 |
+
Handles all the non-python output.
|
| 133 |
+
|
| 134 |
+
"""
|
| 135 |
+
name = 'IPython Partial Traceback'
|
| 136 |
+
|
| 137 |
+
tokens = {
|
| 138 |
+
'root': [
|
| 139 |
+
# Tracebacks for syntax errors have a different style.
|
| 140 |
+
# For both types of tracebacks, we mark the first line with
|
| 141 |
+
# Generic.Traceback. For syntax errors, we mark the filename
|
| 142 |
+
# as we mark the filenames for non-syntax tracebacks.
|
| 143 |
+
#
|
| 144 |
+
# These two regexps define how IPythonConsoleLexer finds a
|
| 145 |
+
# traceback.
|
| 146 |
+
#
|
| 147 |
+
## Non-syntax traceback
|
| 148 |
+
(r'^(\^C)?(-+\n)', bygroups(Error, Generic.Traceback)),
|
| 149 |
+
## Syntax traceback
|
| 150 |
+
(r'^( File)(.*)(, line )(\d+\n)',
|
| 151 |
+
bygroups(Generic.Traceback, Name.Namespace,
|
| 152 |
+
Generic.Traceback, Literal.Number.Integer)),
|
| 153 |
+
|
| 154 |
+
# (Exception Identifier)(Whitespace)(Traceback Message)
|
| 155 |
+
(r'(?u)(^[^\d\W]\w*)(\s*)(Traceback.*?\n)',
|
| 156 |
+
bygroups(Name.Exception, Generic.Whitespace, Text)),
|
| 157 |
+
# (Module/Filename)(Text)(Callee)(Function Signature)
|
| 158 |
+
# Better options for callee and function signature?
|
| 159 |
+
(r'(.*)( in )(.*)(\(.*\)\n)',
|
| 160 |
+
bygroups(Name.Namespace, Text, Name.Entity, Name.Tag)),
|
| 161 |
+
# Regular line: (Whitespace)(Line Number)(Python Code)
|
| 162 |
+
(r'(\s*?)(\d+)(.*?\n)',
|
| 163 |
+
bygroups(Generic.Whitespace, Literal.Number.Integer, Other)),
|
| 164 |
+
# Emphasized line: (Arrow)(Line Number)(Python Code)
|
| 165 |
+
# Using Exception token so arrow color matches the Exception.
|
| 166 |
+
(r'(-*>?\s?)(\d+)(.*?\n)',
|
| 167 |
+
bygroups(Name.Exception, Literal.Number.Integer, Other)),
|
| 168 |
+
# (Exception Identifier)(Message)
|
| 169 |
+
(r'(?u)(^[^\d\W]\w*)(:.*?\n)',
|
| 170 |
+
bygroups(Name.Exception, Text)),
|
| 171 |
+
# Tag everything else as Other, will be handled later.
|
| 172 |
+
(r'.*\n', Other),
|
| 173 |
+
],
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
class IPythonTracebackLexer(DelegatingLexer):
|
| 178 |
+
"""
|
| 179 |
+
IPython traceback lexer.
|
| 180 |
+
|
| 181 |
+
For doctests, the tracebacks can be snipped as much as desired with the
|
| 182 |
+
exception to the lines that designate a traceback. For non-syntax error
|
| 183 |
+
tracebacks, this is the line of hyphens. For syntax error tracebacks,
|
| 184 |
+
this is the line which lists the File and line number.
|
| 185 |
+
|
| 186 |
+
"""
|
| 187 |
+
# The lexer inherits from DelegatingLexer. The "root" lexer is an
|
| 188 |
+
# appropriate IPython lexer, which depends on the value of the boolean
|
| 189 |
+
# `python3`. First, we parse with the partial IPython traceback lexer.
|
| 190 |
+
# Then, any code marked with the "Other" token is delegated to the root
|
| 191 |
+
# lexer.
|
| 192 |
+
#
|
| 193 |
+
name = 'IPython Traceback'
|
| 194 |
+
aliases = ['ipythontb']
|
| 195 |
+
|
| 196 |
+
def __init__(self, **options):
|
| 197 |
+
"""
|
| 198 |
+
A subclass of `DelegatingLexer` which delegates to the appropriate to either IPyLexer,
|
| 199 |
+
IPythonPartialTracebackLexer.
|
| 200 |
+
"""
|
| 201 |
+
# note we need a __init__ doc, as otherwise it inherits the doc from the super class
|
| 202 |
+
# which will fail the documentation build as it references section of the pygments docs that
|
| 203 |
+
# do not exists when building IPython's docs.
|
| 204 |
+
self.python3 = get_bool_opt(options, 'python3', False)
|
| 205 |
+
if self.python3:
|
| 206 |
+
self.aliases = ['ipython3tb']
|
| 207 |
+
else:
|
| 208 |
+
self.aliases = ['ipython2tb', 'ipythontb']
|
| 209 |
+
|
| 210 |
+
if self.python3:
|
| 211 |
+
IPyLexer = IPython3Lexer
|
| 212 |
+
else:
|
| 213 |
+
IPyLexer = IPythonLexer
|
| 214 |
+
|
| 215 |
+
DelegatingLexer.__init__(self, IPyLexer,
|
| 216 |
+
IPythonPartialTracebackLexer, **options)
|
| 217 |
+
|
| 218 |
+
class IPythonConsoleLexer(Lexer):
|
| 219 |
+
"""
|
| 220 |
+
An IPython console lexer for IPython code-blocks and doctests, such as:
|
| 221 |
+
|
| 222 |
+
.. code-block:: rst
|
| 223 |
+
|
| 224 |
+
.. code-block:: ipythonconsole
|
| 225 |
+
|
| 226 |
+
In [1]: a = 'foo'
|
| 227 |
+
|
| 228 |
+
In [2]: a
|
| 229 |
+
Out[2]: 'foo'
|
| 230 |
+
|
| 231 |
+
In [3]: print(a)
|
| 232 |
+
foo
|
| 233 |
+
|
| 234 |
+
|
| 235 |
+
Support is also provided for IPython exceptions:
|
| 236 |
+
|
| 237 |
+
.. code-block:: rst
|
| 238 |
+
|
| 239 |
+
.. code-block:: ipythonconsole
|
| 240 |
+
|
| 241 |
+
In [1]: raise Exception
|
| 242 |
+
Traceback (most recent call last):
|
| 243 |
+
...
|
| 244 |
+
Exception
|
| 245 |
+
|
| 246 |
+
"""
|
| 247 |
+
name = 'IPython console session'
|
| 248 |
+
aliases = ['ipythonconsole']
|
| 249 |
+
mimetypes = ['text/x-ipython-console']
|
| 250 |
+
|
| 251 |
+
# The regexps used to determine what is input and what is output.
|
| 252 |
+
# The default prompts for IPython are:
|
| 253 |
+
#
|
| 254 |
+
# in = 'In [#]: '
|
| 255 |
+
# continuation = ' .D.: '
|
| 256 |
+
# template = 'Out[#]: '
|
| 257 |
+
#
|
| 258 |
+
# Where '#' is the 'prompt number' or 'execution count' and 'D'
|
| 259 |
+
# D is a number of dots matching the width of the execution count
|
| 260 |
+
#
|
| 261 |
+
in1_regex = r'In \[[0-9]+\]: '
|
| 262 |
+
in2_regex = r' \.\.+\.: '
|
| 263 |
+
out_regex = r'Out\[[0-9]+\]: '
|
| 264 |
+
|
| 265 |
+
#: The regex to determine when a traceback starts.
|
| 266 |
+
ipytb_start = re.compile(r'^(\^C)?(-+\n)|^( File)(.*)(, line )(\d+\n)')
|
| 267 |
+
|
| 268 |
+
def __init__(self, **options):
|
| 269 |
+
"""Initialize the IPython console lexer.
|
| 270 |
+
|
| 271 |
+
Parameters
|
| 272 |
+
----------
|
| 273 |
+
python3 : bool
|
| 274 |
+
If `True`, then the console inputs are parsed using a Python 3
|
| 275 |
+
lexer. Otherwise, they are parsed using a Python 2 lexer.
|
| 276 |
+
in1_regex : RegexObject
|
| 277 |
+
The compiled regular expression used to detect the start
|
| 278 |
+
of inputs. Although the IPython configuration setting may have a
|
| 279 |
+
trailing whitespace, do not include it in the regex. If `None`,
|
| 280 |
+
then the default input prompt is assumed.
|
| 281 |
+
in2_regex : RegexObject
|
| 282 |
+
The compiled regular expression used to detect the continuation
|
| 283 |
+
of inputs. Although the IPython configuration setting may have a
|
| 284 |
+
trailing whitespace, do not include it in the regex. If `None`,
|
| 285 |
+
then the default input prompt is assumed.
|
| 286 |
+
out_regex : RegexObject
|
| 287 |
+
The compiled regular expression used to detect outputs. If `None`,
|
| 288 |
+
then the default output prompt is assumed.
|
| 289 |
+
|
| 290 |
+
"""
|
| 291 |
+
self.python3 = get_bool_opt(options, 'python3', False)
|
| 292 |
+
if self.python3:
|
| 293 |
+
self.aliases = ['ipython3console']
|
| 294 |
+
else:
|
| 295 |
+
self.aliases = ['ipython2console', 'ipythonconsole']
|
| 296 |
+
|
| 297 |
+
in1_regex = options.get('in1_regex', self.in1_regex)
|
| 298 |
+
in2_regex = options.get('in2_regex', self.in2_regex)
|
| 299 |
+
out_regex = options.get('out_regex', self.out_regex)
|
| 300 |
+
|
| 301 |
+
# So that we can work with input and output prompts which have been
|
| 302 |
+
# rstrip'd (possibly by editors) we also need rstrip'd variants. If
|
| 303 |
+
# we do not do this, then such prompts will be tagged as 'output'.
|
| 304 |
+
# The reason can't just use the rstrip'd variants instead is because
|
| 305 |
+
# we want any whitespace associated with the prompt to be inserted
|
| 306 |
+
# with the token. This allows formatted code to be modified so as hide
|
| 307 |
+
# the appearance of prompts, with the whitespace included. One example
|
| 308 |
+
# use of this is in copybutton.js from the standard lib Python docs.
|
| 309 |
+
in1_regex_rstrip = in1_regex.rstrip() + '\n'
|
| 310 |
+
in2_regex_rstrip = in2_regex.rstrip() + '\n'
|
| 311 |
+
out_regex_rstrip = out_regex.rstrip() + '\n'
|
| 312 |
+
|
| 313 |
+
# Compile and save them all.
|
| 314 |
+
attrs = ['in1_regex', 'in2_regex', 'out_regex',
|
| 315 |
+
'in1_regex_rstrip', 'in2_regex_rstrip', 'out_regex_rstrip']
|
| 316 |
+
for attr in attrs:
|
| 317 |
+
self.__setattr__(attr, re.compile(locals()[attr]))
|
| 318 |
+
|
| 319 |
+
Lexer.__init__(self, **options)
|
| 320 |
+
|
| 321 |
+
if self.python3:
|
| 322 |
+
pylexer = IPython3Lexer
|
| 323 |
+
tblexer = IPythonTracebackLexer
|
| 324 |
+
else:
|
| 325 |
+
pylexer = IPythonLexer
|
| 326 |
+
tblexer = IPythonTracebackLexer
|
| 327 |
+
|
| 328 |
+
self.pylexer = pylexer(**options)
|
| 329 |
+
self.tblexer = tblexer(**options)
|
| 330 |
+
|
| 331 |
+
self.reset()
|
| 332 |
+
|
| 333 |
+
def reset(self):
|
| 334 |
+
self.mode = 'output'
|
| 335 |
+
self.index = 0
|
| 336 |
+
self.buffer = u''
|
| 337 |
+
self.insertions = []
|
| 338 |
+
|
| 339 |
+
def buffered_tokens(self):
|
| 340 |
+
"""
|
| 341 |
+
Generator of unprocessed tokens after doing insertions and before
|
| 342 |
+
changing to a new state.
|
| 343 |
+
|
| 344 |
+
"""
|
| 345 |
+
if self.mode == 'output':
|
| 346 |
+
tokens = [(0, Generic.Output, self.buffer)]
|
| 347 |
+
elif self.mode == 'input':
|
| 348 |
+
tokens = self.pylexer.get_tokens_unprocessed(self.buffer)
|
| 349 |
+
else: # traceback
|
| 350 |
+
tokens = self.tblexer.get_tokens_unprocessed(self.buffer)
|
| 351 |
+
|
| 352 |
+
for i, t, v in do_insertions(self.insertions, tokens):
|
| 353 |
+
# All token indexes are relative to the buffer.
|
| 354 |
+
yield self.index + i, t, v
|
| 355 |
+
|
| 356 |
+
# Clear it all
|
| 357 |
+
self.index += len(self.buffer)
|
| 358 |
+
self.buffer = u''
|
| 359 |
+
self.insertions = []
|
| 360 |
+
|
| 361 |
+
def get_mci(self, line):
|
| 362 |
+
"""
|
| 363 |
+
Parses the line and returns a 3-tuple: (mode, code, insertion).
|
| 364 |
+
|
| 365 |
+
`mode` is the next mode (or state) of the lexer, and is always equal
|
| 366 |
+
to 'input', 'output', or 'tb'.
|
| 367 |
+
|
| 368 |
+
`code` is a portion of the line that should be added to the buffer
|
| 369 |
+
corresponding to the next mode and eventually lexed by another lexer.
|
| 370 |
+
For example, `code` could be Python code if `mode` were 'input'.
|
| 371 |
+
|
| 372 |
+
`insertion` is a 3-tuple (index, token, text) representing an
|
| 373 |
+
unprocessed "token" that will be inserted into the stream of tokens
|
| 374 |
+
that are created from the buffer once we change modes. This is usually
|
| 375 |
+
the input or output prompt.
|
| 376 |
+
|
| 377 |
+
In general, the next mode depends on current mode and on the contents
|
| 378 |
+
of `line`.
|
| 379 |
+
|
| 380 |
+
"""
|
| 381 |
+
# To reduce the number of regex match checks, we have multiple
|
| 382 |
+
# 'if' blocks instead of 'if-elif' blocks.
|
| 383 |
+
|
| 384 |
+
# Check for possible end of input
|
| 385 |
+
in2_match = self.in2_regex.match(line)
|
| 386 |
+
in2_match_rstrip = self.in2_regex_rstrip.match(line)
|
| 387 |
+
if (in2_match and in2_match.group().rstrip() == line.rstrip()) or \
|
| 388 |
+
in2_match_rstrip:
|
| 389 |
+
end_input = True
|
| 390 |
+
else:
|
| 391 |
+
end_input = False
|
| 392 |
+
if end_input and self.mode != 'tb':
|
| 393 |
+
# Only look for an end of input when not in tb mode.
|
| 394 |
+
# An ellipsis could appear within the traceback.
|
| 395 |
+
mode = 'output'
|
| 396 |
+
code = u''
|
| 397 |
+
insertion = (0, Generic.Prompt, line)
|
| 398 |
+
return mode, code, insertion
|
| 399 |
+
|
| 400 |
+
# Check for output prompt
|
| 401 |
+
out_match = self.out_regex.match(line)
|
| 402 |
+
out_match_rstrip = self.out_regex_rstrip.match(line)
|
| 403 |
+
if out_match or out_match_rstrip:
|
| 404 |
+
mode = 'output'
|
| 405 |
+
if out_match:
|
| 406 |
+
idx = out_match.end()
|
| 407 |
+
else:
|
| 408 |
+
idx = out_match_rstrip.end()
|
| 409 |
+
code = line[idx:]
|
| 410 |
+
# Use the 'heading' token for output. We cannot use Generic.Error
|
| 411 |
+
# since it would conflict with exceptions.
|
| 412 |
+
insertion = (0, Generic.Heading, line[:idx])
|
| 413 |
+
return mode, code, insertion
|
| 414 |
+
|
| 415 |
+
|
| 416 |
+
# Check for input or continuation prompt (non stripped version)
|
| 417 |
+
in1_match = self.in1_regex.match(line)
|
| 418 |
+
if in1_match or (in2_match and self.mode != 'tb'):
|
| 419 |
+
# New input or when not in tb, continued input.
|
| 420 |
+
# We do not check for continued input when in tb since it is
|
| 421 |
+
# allowable to replace a long stack with an ellipsis.
|
| 422 |
+
mode = 'input'
|
| 423 |
+
if in1_match:
|
| 424 |
+
idx = in1_match.end()
|
| 425 |
+
else: # in2_match
|
| 426 |
+
idx = in2_match.end()
|
| 427 |
+
code = line[idx:]
|
| 428 |
+
insertion = (0, Generic.Prompt, line[:idx])
|
| 429 |
+
return mode, code, insertion
|
| 430 |
+
|
| 431 |
+
# Check for input or continuation prompt (stripped version)
|
| 432 |
+
in1_match_rstrip = self.in1_regex_rstrip.match(line)
|
| 433 |
+
if in1_match_rstrip or (in2_match_rstrip and self.mode != 'tb'):
|
| 434 |
+
# New input or when not in tb, continued input.
|
| 435 |
+
# We do not check for continued input when in tb since it is
|
| 436 |
+
# allowable to replace a long stack with an ellipsis.
|
| 437 |
+
mode = 'input'
|
| 438 |
+
if in1_match_rstrip:
|
| 439 |
+
idx = in1_match_rstrip.end()
|
| 440 |
+
else: # in2_match
|
| 441 |
+
idx = in2_match_rstrip.end()
|
| 442 |
+
code = line[idx:]
|
| 443 |
+
insertion = (0, Generic.Prompt, line[:idx])
|
| 444 |
+
return mode, code, insertion
|
| 445 |
+
|
| 446 |
+
# Check for traceback
|
| 447 |
+
if self.ipytb_start.match(line):
|
| 448 |
+
mode = 'tb'
|
| 449 |
+
code = line
|
| 450 |
+
insertion = None
|
| 451 |
+
return mode, code, insertion
|
| 452 |
+
|
| 453 |
+
# All other stuff...
|
| 454 |
+
if self.mode in ('input', 'output'):
|
| 455 |
+
# We assume all other text is output. Multiline input that
|
| 456 |
+
# does not use the continuation marker cannot be detected.
|
| 457 |
+
# For example, the 3 in the following is clearly output:
|
| 458 |
+
#
|
| 459 |
+
# In [1]: print 3
|
| 460 |
+
# 3
|
| 461 |
+
#
|
| 462 |
+
# But the following second line is part of the input:
|
| 463 |
+
#
|
| 464 |
+
# In [2]: while True:
|
| 465 |
+
# print True
|
| 466 |
+
#
|
| 467 |
+
# In both cases, the 2nd line will be 'output'.
|
| 468 |
+
#
|
| 469 |
+
mode = 'output'
|
| 470 |
+
else:
|
| 471 |
+
mode = 'tb'
|
| 472 |
+
|
| 473 |
+
code = line
|
| 474 |
+
insertion = None
|
| 475 |
+
|
| 476 |
+
return mode, code, insertion
|
| 477 |
+
|
| 478 |
+
def get_tokens_unprocessed(self, text):
|
| 479 |
+
self.reset()
|
| 480 |
+
for match in line_re.finditer(text):
|
| 481 |
+
line = match.group()
|
| 482 |
+
mode, code, insertion = self.get_mci(line)
|
| 483 |
+
|
| 484 |
+
if mode != self.mode:
|
| 485 |
+
# Yield buffered tokens before transitioning to new mode.
|
| 486 |
+
for token in self.buffered_tokens():
|
| 487 |
+
yield token
|
| 488 |
+
self.mode = mode
|
| 489 |
+
|
| 490 |
+
if insertion:
|
| 491 |
+
self.insertions.append((len(self.buffer), [insertion]))
|
| 492 |
+
self.buffer += code
|
| 493 |
+
|
| 494 |
+
for token in self.buffered_tokens():
|
| 495 |
+
yield token
|
| 496 |
+
|
| 497 |
+
class IPyLexer(Lexer):
|
| 498 |
+
r"""
|
| 499 |
+
Primary lexer for all IPython-like code.
|
| 500 |
+
|
| 501 |
+
This is a simple helper lexer. If the first line of the text begins with
|
| 502 |
+
"In \[[0-9]+\]:", then the entire text is parsed with an IPython console
|
| 503 |
+
lexer. If not, then the entire text is parsed with an IPython lexer.
|
| 504 |
+
|
| 505 |
+
The goal is to reduce the number of lexers that are registered
|
| 506 |
+
with Pygments.
|
| 507 |
+
|
| 508 |
+
"""
|
| 509 |
+
name = 'IPy session'
|
| 510 |
+
aliases = ['ipy']
|
| 511 |
+
|
| 512 |
+
def __init__(self, **options):
|
| 513 |
+
"""
|
| 514 |
+
Create a new IPyLexer instance which dispatch to either an
|
| 515 |
+
IPythonCOnsoleLexer (if In prompts are present) or and IPythonLexer (if
|
| 516 |
+
In prompts are not present).
|
| 517 |
+
"""
|
| 518 |
+
# init docstring is necessary for docs not to fail to build do to parent
|
| 519 |
+
# docs referenceing a section in pygments docs.
|
| 520 |
+
self.python3 = get_bool_opt(options, 'python3', False)
|
| 521 |
+
if self.python3:
|
| 522 |
+
self.aliases = ['ipy3']
|
| 523 |
+
else:
|
| 524 |
+
self.aliases = ['ipy2', 'ipy']
|
| 525 |
+
|
| 526 |
+
Lexer.__init__(self, **options)
|
| 527 |
+
|
| 528 |
+
self.IPythonLexer = IPythonLexer(**options)
|
| 529 |
+
self.IPythonConsoleLexer = IPythonConsoleLexer(**options)
|
| 530 |
+
|
| 531 |
+
def get_tokens_unprocessed(self, text):
|
| 532 |
+
# Search for the input prompt anywhere...this allows code blocks to
|
| 533 |
+
# begin with comments as well.
|
| 534 |
+
if re.match(r'.*(In \[[0-9]+\]:)', text.strip(), re.DOTALL):
|
| 535 |
+
lex = self.IPythonConsoleLexer
|
| 536 |
+
else:
|
| 537 |
+
lex = self.IPythonLexer
|
| 538 |
+
for token in lex.get_tokens_unprocessed(text):
|
| 539 |
+
yield token
|
| 540 |
+
|
shared/package-files/2e/2ec42712829628685d7aa1a131cebc02ac33e0cad39c4b36d0a0186c58941f3a/blob
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
###############################################################################
|
| 2 |
+
# Modification of concurrent.futures.Future
|
| 3 |
+
#
|
| 4 |
+
# author: Thomas Moreau and Olivier Grisel
|
| 5 |
+
#
|
| 6 |
+
# adapted from concurrent/futures/_base.py (17/02/2017)
|
| 7 |
+
# * Do not use yield from
|
| 8 |
+
# * Use old super syntax
|
| 9 |
+
#
|
| 10 |
+
# Copyright 2009 Brian Quinlan. All Rights Reserved.
|
| 11 |
+
# Licensed to PSF under a Contributor Agreement.
|
| 12 |
+
|
| 13 |
+
from concurrent.futures import Future as _BaseFuture
|
| 14 |
+
from concurrent.futures._base import LOGGER
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
# To make loky._base.Future instances awaitable by concurrent.futures.wait,
|
| 18 |
+
# derive our custom Future class from _BaseFuture. _invoke_callback is the only
|
| 19 |
+
# modification made to this class in loky.
|
| 20 |
+
# TODO investigate why using `concurrent.futures.Future` directly does not
|
| 21 |
+
# always work in our test suite.
|
| 22 |
+
class Future(_BaseFuture):
|
| 23 |
+
def _invoke_callbacks(self):
|
| 24 |
+
for callback in self._done_callbacks:
|
| 25 |
+
try:
|
| 26 |
+
callback(self)
|
| 27 |
+
except BaseException:
|
| 28 |
+
LOGGER.exception(f"exception calling callback for {self!r}")
|
shared/package-files/2e/2ec7d9373df55b89d3f35d5c1ebb6f82a85598f4e0f6b062a189c1781010379b/blob
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Tests for numba.core.codegen.
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
import warnings
|
| 7 |
+
import base64
|
| 8 |
+
import ctypes
|
| 9 |
+
import pickle
|
| 10 |
+
import re
|
| 11 |
+
import subprocess
|
| 12 |
+
import sys
|
| 13 |
+
import weakref
|
| 14 |
+
|
| 15 |
+
import llvmlite.binding as ll
|
| 16 |
+
|
| 17 |
+
import unittest
|
| 18 |
+
from numba import njit
|
| 19 |
+
from numba.core.codegen import JITCPUCodegen
|
| 20 |
+
from numba.core.compiler_lock import global_compiler_lock
|
| 21 |
+
from numba.tests.support import TestCase
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
asm_sum = r"""
|
| 25 |
+
define i32 @sum(i32 %.1, i32 %.2) {
|
| 26 |
+
%.3 = add i32 %.1, %.2
|
| 27 |
+
ret i32 %.3
|
| 28 |
+
}
|
| 29 |
+
"""
|
| 30 |
+
|
| 31 |
+
# Note we're using a rather mangled function name to check that it
|
| 32 |
+
# is compatible with object serialization.
|
| 33 |
+
|
| 34 |
+
asm_sum_inner = """
|
| 35 |
+
define i32 @"__main__.ising_element_update$1.array(int8,_2d,_C).int64.int64"(i32 %.1, i32 %.2) {
|
| 36 |
+
%.3 = add i32 %.1, %.2
|
| 37 |
+
ret i32 %.3
|
| 38 |
+
}
|
| 39 |
+
""" # noqa: E501
|
| 40 |
+
|
| 41 |
+
asm_sum_outer = """
|
| 42 |
+
declare i32 @"__main__.ising_element_update$1.array(int8,_2d,_C).int64.int64"(i32 %.1, i32 %.2)
|
| 43 |
+
|
| 44 |
+
define i32 @sum(i32 %.1, i32 %.2) {
|
| 45 |
+
%.3 = call i32 @"__main__.ising_element_update$1.array(int8,_2d,_C).int64.int64"(i32 %.1, i32 %.2)
|
| 46 |
+
ret i32 %.3
|
| 47 |
+
}
|
| 48 |
+
""" # noqa: E501
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
ctypes_sum_ty = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int, ctypes.c_int)
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
class JITCPUCodegenTestCase(TestCase):
|
| 55 |
+
"""
|
| 56 |
+
Test the JIT code generation.
|
| 57 |
+
"""
|
| 58 |
+
|
| 59 |
+
def setUp(self):
|
| 60 |
+
global_compiler_lock.acquire()
|
| 61 |
+
self.codegen = JITCPUCodegen('test_codegen')
|
| 62 |
+
|
| 63 |
+
def tearDown(self):
|
| 64 |
+
del self.codegen
|
| 65 |
+
global_compiler_lock.release()
|
| 66 |
+
|
| 67 |
+
def compile_module(self, asm, linking_asm=None):
|
| 68 |
+
library = self.codegen.create_library('compiled_module')
|
| 69 |
+
ll_module = ll.parse_assembly(asm)
|
| 70 |
+
ll_module.verify()
|
| 71 |
+
library.add_llvm_module(ll_module)
|
| 72 |
+
if linking_asm:
|
| 73 |
+
linking_library = self.codegen.create_library('linking_module')
|
| 74 |
+
ll_module = ll.parse_assembly(linking_asm)
|
| 75 |
+
ll_module.verify()
|
| 76 |
+
linking_library.add_llvm_module(ll_module)
|
| 77 |
+
library.add_linking_library(linking_library)
|
| 78 |
+
return library
|
| 79 |
+
|
| 80 |
+
@classmethod
|
| 81 |
+
def _check_unserialize_sum(cls, state):
|
| 82 |
+
codegen = JITCPUCodegen('other_codegen')
|
| 83 |
+
library = codegen.unserialize_library(state)
|
| 84 |
+
ptr = library.get_pointer_to_function("sum")
|
| 85 |
+
assert ptr, ptr
|
| 86 |
+
cfunc = ctypes_sum_ty(ptr)
|
| 87 |
+
res = cfunc(2, 3)
|
| 88 |
+
assert res == 5, res
|
| 89 |
+
|
| 90 |
+
def test_get_pointer_to_function(self):
|
| 91 |
+
library = self.compile_module(asm_sum)
|
| 92 |
+
ptr = library.get_pointer_to_function("sum")
|
| 93 |
+
self.assertIsInstance(ptr, int)
|
| 94 |
+
cfunc = ctypes_sum_ty(ptr)
|
| 95 |
+
self.assertEqual(cfunc(2, 3), 5)
|
| 96 |
+
# Note: With llvm3.9.1, deleting `library` will cause memory error in
|
| 97 |
+
# the following code during running of optimization passes in
|
| 98 |
+
# LLVM. The reason of the error is unclear. The error is known to
|
| 99 |
+
# replicate on osx64 and linux64.
|
| 100 |
+
|
| 101 |
+
# Same, but with dependency on another library
|
| 102 |
+
library2 = self.compile_module(asm_sum_outer, asm_sum_inner)
|
| 103 |
+
ptr = library2.get_pointer_to_function("sum")
|
| 104 |
+
self.assertIsInstance(ptr, int)
|
| 105 |
+
cfunc = ctypes_sum_ty(ptr)
|
| 106 |
+
self.assertEqual(cfunc(2, 3), 5)
|
| 107 |
+
|
| 108 |
+
def test_magic_tuple(self):
|
| 109 |
+
tup = self.codegen.magic_tuple()
|
| 110 |
+
pickle.dumps(tup)
|
| 111 |
+
cg2 = JITCPUCodegen('xxx')
|
| 112 |
+
self.assertEqual(cg2.magic_tuple(), tup)
|
| 113 |
+
|
| 114 |
+
# Serialization tests.
|
| 115 |
+
|
| 116 |
+
def _check_serialize_unserialize(self, state):
|
| 117 |
+
self._check_unserialize_sum(state)
|
| 118 |
+
|
| 119 |
+
def _check_unserialize_other_process(self, state):
|
| 120 |
+
arg = base64.b64encode(pickle.dumps(state, -1))
|
| 121 |
+
code = """if 1:
|
| 122 |
+
import base64
|
| 123 |
+
import pickle
|
| 124 |
+
import sys
|
| 125 |
+
from numba.tests.test_codegen import %(test_class)s
|
| 126 |
+
|
| 127 |
+
state = pickle.loads(base64.b64decode(sys.argv[1]))
|
| 128 |
+
%(test_class)s._check_unserialize_sum(state)
|
| 129 |
+
""" % dict(test_class=self.__class__.__name__)
|
| 130 |
+
subprocess.check_call([sys.executable, '-c', code, arg.decode()])
|
| 131 |
+
|
| 132 |
+
def test_serialize_unserialize_bitcode(self):
|
| 133 |
+
library = self.compile_module(asm_sum_outer, asm_sum_inner)
|
| 134 |
+
state = library.serialize_using_bitcode()
|
| 135 |
+
self._check_serialize_unserialize(state)
|
| 136 |
+
|
| 137 |
+
def test_unserialize_other_process_bitcode(self):
|
| 138 |
+
library = self.compile_module(asm_sum_outer, asm_sum_inner)
|
| 139 |
+
state = library.serialize_using_bitcode()
|
| 140 |
+
self._check_unserialize_other_process(state)
|
| 141 |
+
|
| 142 |
+
def test_serialize_unserialize_object_code(self):
|
| 143 |
+
library = self.compile_module(asm_sum_outer, asm_sum_inner)
|
| 144 |
+
library.enable_object_caching()
|
| 145 |
+
state = library.serialize_using_object_code()
|
| 146 |
+
self._check_serialize_unserialize(state)
|
| 147 |
+
|
| 148 |
+
def test_unserialize_other_process_object_code(self):
|
| 149 |
+
library = self.compile_module(asm_sum_outer, asm_sum_inner)
|
| 150 |
+
library.enable_object_caching()
|
| 151 |
+
state = library.serialize_using_object_code()
|
| 152 |
+
self._check_unserialize_other_process(state)
|
| 153 |
+
|
| 154 |
+
def test_cache_disabled_inspection(self):
|
| 155 |
+
"""
|
| 156 |
+
"""
|
| 157 |
+
library = self.compile_module(asm_sum_outer, asm_sum_inner)
|
| 158 |
+
library.enable_object_caching()
|
| 159 |
+
state = library.serialize_using_object_code()
|
| 160 |
+
|
| 161 |
+
# exercise the valid behavior
|
| 162 |
+
with warnings.catch_warnings(record=True) as w:
|
| 163 |
+
old_llvm = library.get_llvm_str()
|
| 164 |
+
old_asm = library.get_asm_str()
|
| 165 |
+
library.get_function_cfg('sum')
|
| 166 |
+
self.assertEqual(len(w), 0)
|
| 167 |
+
|
| 168 |
+
# unserialize
|
| 169 |
+
codegen = JITCPUCodegen('other_codegen')
|
| 170 |
+
library = codegen.unserialize_library(state)
|
| 171 |
+
|
| 172 |
+
# the inspection methods would warn and give incorrect result
|
| 173 |
+
with warnings.catch_warnings(record=True) as w:
|
| 174 |
+
warnings.simplefilter("always")
|
| 175 |
+
self.assertNotEqual(old_llvm, library.get_llvm_str())
|
| 176 |
+
self.assertEqual(len(w), 1)
|
| 177 |
+
self.assertIn("Inspection disabled", str(w[0].message))
|
| 178 |
+
|
| 179 |
+
with warnings.catch_warnings(record=True) as w:
|
| 180 |
+
warnings.simplefilter("always")
|
| 181 |
+
self.assertNotEqual(library.get_asm_str(), old_asm)
|
| 182 |
+
self.assertEqual(len(w), 1)
|
| 183 |
+
self.assertIn("Inspection disabled", str(w[0].message))
|
| 184 |
+
|
| 185 |
+
with warnings.catch_warnings(record=True) as w:
|
| 186 |
+
warnings.simplefilter("always")
|
| 187 |
+
with self.assertRaises(NameError) as raises:
|
| 188 |
+
library.get_function_cfg('sum')
|
| 189 |
+
self.assertEqual(len(w), 1)
|
| 190 |
+
self.assertIn("Inspection disabled", str(w[0].message))
|
| 191 |
+
self.assertIn("sum", str(raises.exception))
|
| 192 |
+
|
| 193 |
+
# Lifetime tests
|
| 194 |
+
|
| 195 |
+
@unittest.expectedFailure # MCJIT removeModule leaks and it is disabled
|
| 196 |
+
def test_library_lifetime(self):
|
| 197 |
+
library = self.compile_module(asm_sum_outer, asm_sum_inner)
|
| 198 |
+
# Exercise code generation
|
| 199 |
+
library.enable_object_caching()
|
| 200 |
+
library.serialize_using_bitcode()
|
| 201 |
+
library.serialize_using_object_code()
|
| 202 |
+
u = weakref.ref(library)
|
| 203 |
+
v = weakref.ref(library._final_module)
|
| 204 |
+
del library
|
| 205 |
+
# Both the library and its backing LLVM module are collected
|
| 206 |
+
self.assertIs(u(), None)
|
| 207 |
+
self.assertIs(v(), None)
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
class TestWrappers(TestCase):
|
| 211 |
+
|
| 212 |
+
def test_noinline_on_main_call(self):
|
| 213 |
+
# Checks that the cpython and cfunc wrapper produces a call with the
|
| 214 |
+
# "noinline" attr present for the decorated function.
|
| 215 |
+
|
| 216 |
+
# Creating a refcounted object induces a side-effect that prevents IPO
|
| 217 |
+
# from eliding the call to the function with LLVM 15. See Issue #9658:
|
| 218 |
+
# https://github.com/numba/numba/issues/9658
|
| 219 |
+
@njit
|
| 220 |
+
def foo():
|
| 221 |
+
return list([1])
|
| 222 |
+
|
| 223 |
+
foo()
|
| 224 |
+
sig = foo.signatures[0]
|
| 225 |
+
|
| 226 |
+
ol = foo.overloads[sig]
|
| 227 |
+
name = ol.fndesc.mangled_name.replace("$", r"\$")
|
| 228 |
+
p1 = r".*call.*{}".format(name)
|
| 229 |
+
p2 = r".*(#[0-9]+).*"
|
| 230 |
+
call_site = re.compile(p1 + p2)
|
| 231 |
+
|
| 232 |
+
lines = foo.inspect_llvm(sig).splitlines()
|
| 233 |
+
meta_data_idx = []
|
| 234 |
+
for l in lines:
|
| 235 |
+
matched = call_site.match(l)
|
| 236 |
+
if matched:
|
| 237 |
+
meta_data_idx.append(matched.groups()[0])
|
| 238 |
+
|
| 239 |
+
# should be 2 calls, one from cpython wrapper one from cfunc wrapper
|
| 240 |
+
self.assertEqual(len(meta_data_idx), 2)
|
| 241 |
+
# both calls should refer to the same metadata item
|
| 242 |
+
self.assertEqual(meta_data_idx[0], meta_data_idx[1])
|
| 243 |
+
|
| 244 |
+
p1 = r"^attributes\s+{}".format(meta_data_idx[0])
|
| 245 |
+
p2 = r"\s+=\s+{(.*)}.*$"
|
| 246 |
+
attr_site = re.compile(p1 + p2)
|
| 247 |
+
|
| 248 |
+
for l in reversed(lines):
|
| 249 |
+
matched = attr_site.match(l)
|
| 250 |
+
if matched:
|
| 251 |
+
meta_data = matched.groups()[0]
|
| 252 |
+
lmeta = meta_data.strip().split(' ')
|
| 253 |
+
for x in lmeta:
|
| 254 |
+
if 'noinline' in x:
|
| 255 |
+
break
|
| 256 |
+
else:
|
| 257 |
+
continue
|
| 258 |
+
break
|
| 259 |
+
else:
|
| 260 |
+
return self.fail("Metadata did not match 'noinline'")
|
| 261 |
+
|
| 262 |
+
|
| 263 |
+
if __name__ == '__main__':
|
| 264 |
+
unittest.main()
|
shared/package-files/2e/2ecb5434dae88d16cfebb2396f2566564d98a62b0ebc1a9a8ca3a181f26d132c/property_features.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Shared fixed public-spectrum and candidate-property definitions."""
|
| 2 |
+
import numpy as np
|
| 3 |
+
from spectrum_features import spectrum_features
|
| 4 |
+
from prior_features import descriptors,transformed,FEATURE_NAMES
|
| 5 |
+
TARGET_NAMES=['MolLogP','TPSA','HDonors','HAcceptors','RotatableBonds','FractionCSP3','AromaticRings','AliphaticRings','Heterocycles']
|
| 6 |
+
TARGET_INDICES=[FEATURE_NAMES.index(n) for n in TARGET_NAMES]
|
| 7 |
+
def broad_public_features(q):
|
| 8 |
+
x,names=spectrum_features(q);ce=q.get('collision_energy');known=ce is not None
|
| 9 |
+
# Contract allows finite numeric energies; signed log remains defined for unusual inputs.
|
| 10 |
+
value=float(ce) if known else 0.
|
| 11 |
+
return np.concatenate([x,np.asarray([float(known),np.sign(value)*np.log1p(abs(value))],np.float32)]),names+['energy_known','signed_log_energy']
|
| 12 |
+
def candidate_targets(smiles):
|
| 13 |
+
values,valid=descriptors(smiles);return transformed(values[TARGET_INDICES]),valid
|
| 14 |
+
|
| 15 |
+
from neutral_loss_features import neutral_losses,NAMES
|
| 16 |
+
def neutral_public_features(q):
|
| 17 |
+
x,names=broad_public_features(q)
|
| 18 |
+
return np.concatenate([x,neutral_losses(q)]),names+NAMES
|
| 19 |
+
|
| 20 |
+
from fragment_pair_features import fragment_pairs,NAMES as PAIR_NAMES
|
| 21 |
+
def public_features(q):
|
| 22 |
+
x,names=neutral_public_features(q)
|
| 23 |
+
return np.concatenate([x,fragment_pairs(q)]),names+PAIR_NAMES
|
shared/package-files/2e/2ecc26b4441f97c8a50f772ad29f9b8e47afdf44fa9a0da2162d1208e56e830d/blob
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 gather_backward {
|
| 18 |
+
using schema = at::Tensor (const at::Tensor &, const at::Tensor &, int64_t, const at::Tensor &, bool);
|
| 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::gather_backward")
|
| 22 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
|
| 23 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "gather_backward(Tensor grad, Tensor self, int dim, Tensor index, bool sparse_grad) -> Tensor")
|
| 24 |
+
static at::Tensor call(const at::Tensor & grad, const at::Tensor & self, int64_t dim, const at::Tensor & index, bool sparse_grad);
|
| 25 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & grad, const at::Tensor & self, int64_t dim, const at::Tensor & index, bool sparse_grad);
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
}} // namespace at::_ops
|
shared/package-files/2e/2ecea44b99a5e2e19f8c2f0afc0dfca30e880a4ee73535900ab9e10f4dc32449/blob
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 compositeexplicitautograd {
|
| 19 |
+
|
| 20 |
+
TORCH_API at::Tensor sparse_resize_and_clear(const at::Tensor & self, at::IntArrayRef size, int64_t sparse_dim, int64_t dense_dim);
|
| 21 |
+
TORCH_API const at::Tensor & sparse_resize_and_clear_out(const at::Tensor & out, const at::Tensor & self, at::IntArrayRef size, int64_t sparse_dim, int64_t dense_dim);
|
| 22 |
+
TORCH_API const at::Tensor & sparse_resize_and_clear_outf(const at::Tensor & self, at::IntArrayRef size, int64_t sparse_dim, int64_t dense_dim, const at::Tensor & out);
|
| 23 |
+
|
| 24 |
+
} // namespace compositeexplicitautograd
|
| 25 |
+
} // namespace at
|
shared/package-files/2e/2ed0833b84de3212d60224c6889113dd83fc44ee93dce42a99da49f091f7f758/blob
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
""" common utilities """
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
from typing import (
|
| 5 |
+
Any,
|
| 6 |
+
Literal,
|
| 7 |
+
)
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def _mklbl(prefix: str, n: int):
|
| 11 |
+
return [f"{prefix}{i}" for i in range(n)]
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def check_indexing_smoketest_or_raises(
|
| 15 |
+
obj,
|
| 16 |
+
method: Literal["iloc", "loc"],
|
| 17 |
+
key: Any,
|
| 18 |
+
axes: Literal[0, 1] | None = None,
|
| 19 |
+
fails=None,
|
| 20 |
+
) -> None:
|
| 21 |
+
if axes is None:
|
| 22 |
+
axes_list = [0, 1]
|
| 23 |
+
else:
|
| 24 |
+
assert axes in [0, 1]
|
| 25 |
+
axes_list = [axes]
|
| 26 |
+
|
| 27 |
+
for ax in axes_list:
|
| 28 |
+
if ax < obj.ndim:
|
| 29 |
+
# create a tuple accessor
|
| 30 |
+
new_axes = [slice(None)] * obj.ndim
|
| 31 |
+
new_axes[ax] = key
|
| 32 |
+
axified = tuple(new_axes)
|
| 33 |
+
try:
|
| 34 |
+
getattr(obj, method).__getitem__(axified)
|
| 35 |
+
except (IndexError, TypeError, KeyError) as detail:
|
| 36 |
+
# if we are in fails, the ok, otherwise raise it
|
| 37 |
+
if fails is not None:
|
| 38 |
+
if isinstance(detail, fails):
|
| 39 |
+
return
|
| 40 |
+
raise
|
shared/package-files/2e/2ed0f84625acfeb439f191192e9fbfd4171ed41d79b78192d56a62c475bcf758/blob
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from jedi.inference.base_value import ValueSet, NO_VALUES
|
| 2 |
+
from jedi.common import monkeypatch
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
class AbstractLazyValue:
|
| 6 |
+
def __init__(self, data, min=1, max=1):
|
| 7 |
+
self.data = data
|
| 8 |
+
self.min = min
|
| 9 |
+
self.max = max
|
| 10 |
+
|
| 11 |
+
def __repr__(self):
|
| 12 |
+
return '<%s: %s>' % (self.__class__.__name__, self.data)
|
| 13 |
+
|
| 14 |
+
def infer(self):
|
| 15 |
+
raise NotImplementedError
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class LazyKnownValue(AbstractLazyValue):
|
| 19 |
+
"""data is a Value."""
|
| 20 |
+
def infer(self):
|
| 21 |
+
return ValueSet([self.data])
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class LazyKnownValues(AbstractLazyValue):
|
| 25 |
+
"""data is a ValueSet."""
|
| 26 |
+
def infer(self):
|
| 27 |
+
return self.data
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class LazyUnknownValue(AbstractLazyValue):
|
| 31 |
+
def __init__(self, min=1, max=1):
|
| 32 |
+
super().__init__(None, min, max)
|
| 33 |
+
|
| 34 |
+
def infer(self):
|
| 35 |
+
return NO_VALUES
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
class LazyTreeValue(AbstractLazyValue):
|
| 39 |
+
def __init__(self, context, node, min=1, max=1):
|
| 40 |
+
super().__init__(node, min, max)
|
| 41 |
+
self.context = context
|
| 42 |
+
# We need to save the predefined names. It's an unfortunate side effect
|
| 43 |
+
# that needs to be tracked otherwise results will be wrong.
|
| 44 |
+
self._predefined_names = dict(context.predefined_names)
|
| 45 |
+
|
| 46 |
+
def infer(self):
|
| 47 |
+
with monkeypatch(self.context, 'predefined_names', self._predefined_names):
|
| 48 |
+
return self.context.infer_node(self.data)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def get_merged_lazy_value(lazy_values):
|
| 52 |
+
if len(lazy_values) > 1:
|
| 53 |
+
return MergedLazyValues(lazy_values)
|
| 54 |
+
else:
|
| 55 |
+
return lazy_values[0]
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
class MergedLazyValues(AbstractLazyValue):
|
| 59 |
+
"""data is a list of lazy values."""
|
| 60 |
+
def infer(self):
|
| 61 |
+
return ValueSet.from_sets(l.infer() for l in self.data)
|
shared/package-files/2e/2ed374ea5c33373f68633f4045e4128b3a72f5bedcd7c4caa52a8039c64c89b0/blob
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 |
+
#include <ATen/ops/acos_meta.h>
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
namespace native {
|
| 19 |
+
struct TORCH_API structured_acos_out : public at::meta::structured_acos {
|
| 20 |
+
void impl(const at::Tensor & self, const at::Tensor & out);
|
| 21 |
+
};
|
| 22 |
+
} // namespace native
|
| 23 |
+
} // namespace at
|
shared/package-files/2e/2ed5ed8d31bfe29f23cd375465f0d0154512f2355c509d543080b375b028dd55/blob
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Tests corresponding to sandbox.distributions.mv_normal
|
| 3 |
+
"""
|
| 4 |
+
from statsmodels.compat.scipy import SP_LT_116
|
| 5 |
+
|
| 6 |
+
import numpy as np
|
| 7 |
+
from numpy.testing import assert_allclose, assert_array_almost_equal
|
| 8 |
+
import pytest
|
| 9 |
+
from scipy import stats
|
| 10 |
+
|
| 11 |
+
from statsmodels.sandbox.distributions.mv_normal import (
|
| 12 |
+
MVT,
|
| 13 |
+
BivariateNormal,
|
| 14 |
+
MVNormal,
|
| 15 |
+
MVNormal0,
|
| 16 |
+
bivariate_normal,
|
| 17 |
+
expect_mc,
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
MEAN3 = np.array([-1, 0.0, 2.0])
|
| 21 |
+
COV3 = np.array([[1.0, 0.5, 0.75], [0.5, 1.5, 0.6], [0.75, 0.6, 2.0]])
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def test_bivariate_normal_function_matches_scipy():
|
| 25 |
+
x = np.array([[0.0, 0.0], [1.0, 1.0], [-1.0, 2.0]])
|
| 26 |
+
mu = [0.0, 0.0]
|
| 27 |
+
cov = np.array([[1.0, 0.3], [0.3, 1.0]])
|
| 28 |
+
result = bivariate_normal(x, mu, cov)
|
| 29 |
+
expected = stats.multivariate_normal.pdf(x, mean=mu, cov=cov)
|
| 30 |
+
assert_allclose(result, expected, rtol=1e-10)
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def test_bivariate_normal_class_construction():
|
| 34 |
+
BivariateNormal([0.0, 0.0], np.eye(2))
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
class TestMVNormal:
|
| 38 |
+
def setup_method(self):
|
| 39 |
+
self.mvn = MVNormal(MEAN3, COV3)
|
| 40 |
+
|
| 41 |
+
def test_logpdf_matches_scipy(self):
|
| 42 |
+
pt = np.array([0.0, 1.0, 1.5])
|
| 43 |
+
result = self.mvn.logpdf(pt)
|
| 44 |
+
expected = stats.multivariate_normal.logpdf(pt, mean=MEAN3, cov=COV3)
|
| 45 |
+
assert_allclose(result, expected, rtol=1e-10)
|
| 46 |
+
|
| 47 |
+
def test_logpdf_2d_input_matches_scipy_rowwise(self):
|
| 48 |
+
pts = np.array([[0.0, 1.0, 1.5], [-1.0, 0.0, 2.0], [1.0, 1.0, 1.0]])
|
| 49 |
+
result = self.mvn.logpdf(pts)
|
| 50 |
+
expected = stats.multivariate_normal.logpdf(pts, mean=MEAN3, cov=COV3)
|
| 51 |
+
assert_allclose(result, expected, rtol=1e-10)
|
| 52 |
+
|
| 53 |
+
def test_pdf_is_exp_logpdf(self):
|
| 54 |
+
pt = np.array([0.0, 1.0, 1.5])
|
| 55 |
+
assert_allclose(self.mvn.pdf(pt), np.exp(self.mvn.logpdf(pt)))
|
| 56 |
+
|
| 57 |
+
def test_cov_property_equals_sigma(self):
|
| 58 |
+
assert_array_almost_equal(self.mvn.cov, COV3)
|
| 59 |
+
|
| 60 |
+
def test_std_and_corr_consistent_with_cov(self):
|
| 61 |
+
std = self.mvn.std
|
| 62 |
+
corr = self.mvn.corr
|
| 63 |
+
assert_array_almost_equal(std, np.sqrt(np.diag(COV3)))
|
| 64 |
+
reconstructed = corr * np.outer(std, std)
|
| 65 |
+
assert_array_almost_equal(reconstructed, COV3)
|
| 66 |
+
|
| 67 |
+
def test_rvs_moments_match_by_monte_carlo(self):
|
| 68 |
+
rvs = self.mvn.rvs(size=200000)
|
| 69 |
+
assert_allclose(rvs.mean(0), MEAN3, atol=0.02)
|
| 70 |
+
assert_allclose(np.cov(rvs, rowvar=False), COV3, atol=0.05)
|
| 71 |
+
|
| 72 |
+
@pytest.mark.skipif(
|
| 73 |
+
not SP_LT_116,
|
| 74 |
+
reason=(
|
| 75 |
+
"MVNormal.cdf() delegates to sandbox.distributions.extras."
|
| 76 |
+
"mvnormcdf -> mvstdnormcdf -> mvndst, a compiled scipy.stats "
|
| 77 |
+
"Fortran routine that was removed in SciPy >= 1.16.0 (see "
|
| 78 |
+
"sandbox.distributions.tests.test_multivariate for the same "
|
| 79 |
+
"issue against mvstdtprob/mvstdnormcdf directly)."
|
| 80 |
+
),
|
| 81 |
+
)
|
| 82 |
+
def test_cdf_matches_scipy(self):
|
| 83 |
+
pt = np.array([0.0, 1.0, 1.5])
|
| 84 |
+
result = self.mvn.cdf(pt)
|
| 85 |
+
expected = stats.multivariate_normal.cdf(pt, mean=MEAN3, cov=COV3)
|
| 86 |
+
assert_allclose(result, expected, atol=1e-4)
|
| 87 |
+
|
| 88 |
+
def test_whiten_standardize_relationship(self):
|
| 89 |
+
x = np.array([0.5, 1.0, 2.5])
|
| 90 |
+
assert_array_almost_equal(
|
| 91 |
+
self.mvn.standardize(x), self.mvn.whiten(x - MEAN3)
|
| 92 |
+
)
|
| 93 |
+
|
| 94 |
+
def test_normalized_has_correlation_as_sigma_and_zero_mean(self):
|
| 95 |
+
normalized = self.mvn.normalized()
|
| 96 |
+
assert_array_almost_equal(normalized.sigma, self.mvn.corr)
|
| 97 |
+
assert_array_almost_equal(normalized.mean, np.zeros(3))
|
| 98 |
+
|
| 99 |
+
def test_normalized_not_demeaned(self):
|
| 100 |
+
normalized = self.mvn.normalized(demeaned=False)
|
| 101 |
+
assert_array_almost_equal(normalized.mean, MEAN3 / self.mvn.std_sigma)
|
| 102 |
+
|
| 103 |
+
def test_normalized2_sigma_matches_normalized(self):
|
| 104 |
+
assert_array_almost_equal(
|
| 105 |
+
self.mvn.normalized().sigma, self.mvn.normalized2().sigma
|
| 106 |
+
)
|
| 107 |
+
|
| 108 |
+
@pytest.mark.xfail(
|
| 109 |
+
reason=(
|
| 110 |
+
"BUG: normalized2(demeaned=True) computes shift=-self.mean and "
|
| 111 |
+
"passes it to affine_transformed(shift, scale), which computes "
|
| 112 |
+
"mean_new = scale @ mean + shift. That only cancels to zero "
|
| 113 |
+
"when scale is the identity; here scale=diag(1/std_sigma), so "
|
| 114 |
+
"the result is mean/std_sigma - mean, not zero. normalized() "
|
| 115 |
+
"(a separate, non-affine implementation) gets this right by "
|
| 116 |
+
"directly setting mean_new = zeros. The same shift-vs-scale "
|
| 117 |
+
"bug affects .standardized(), see "
|
| 118 |
+
"test_standardized_mean_is_zero below."
|
| 119 |
+
),
|
| 120 |
+
raises=AssertionError,
|
| 121 |
+
strict=True,
|
| 122 |
+
)
|
| 123 |
+
def test_normalized2_mean_matches_normalized(self):
|
| 124 |
+
assert_array_almost_equal(
|
| 125 |
+
self.mvn.normalized().mean, self.mvn.normalized2().mean
|
| 126 |
+
)
|
| 127 |
+
|
| 128 |
+
def test_marginal(self):
|
| 129 |
+
marg = self.mvn.marginal(np.array([0, 2]))
|
| 130 |
+
assert_array_almost_equal(marg.mean, MEAN3[[0, 2]])
|
| 131 |
+
assert_array_almost_equal(marg.sigma, COV3[np.ix_([0, 2], [0, 2])])
|
| 132 |
+
|
| 133 |
+
def test_conditional_matches_textbook_formula(self):
|
| 134 |
+
keep = np.array([0])
|
| 135 |
+
given = np.array([1, 2])
|
| 136 |
+
values = np.array([1.0, 1.5])
|
| 137 |
+
cond = self.mvn.conditional(keep, values)
|
| 138 |
+
|
| 139 |
+
sigmakk = COV3[np.ix_(keep, keep)]
|
| 140 |
+
sigmagg = COV3[np.ix_(given, given)]
|
| 141 |
+
sigmakg = COV3[np.ix_(keep, given)]
|
| 142 |
+
expected_mean = MEAN3[keep] + sigmakg @ np.linalg.solve(
|
| 143 |
+
sigmagg, values - MEAN3[given]
|
| 144 |
+
)
|
| 145 |
+
expected_sigma = sigmakk - sigmakg @ np.linalg.solve(sigmagg, sigmakg.T)
|
| 146 |
+
assert_array_almost_equal(cond.mean, expected_mean)
|
| 147 |
+
assert_array_almost_equal(cond.sigma, expected_sigma)
|
| 148 |
+
|
| 149 |
+
def test_affine_transformed(self):
|
| 150 |
+
shift = np.array([1.0, 1.0, 1.0])
|
| 151 |
+
scale = np.eye(3) * 2
|
| 152 |
+
transformed = self.mvn.affine_transformed(shift, scale)
|
| 153 |
+
assert_array_almost_equal(transformed.mean, shift + scale @ MEAN3)
|
| 154 |
+
assert_array_almost_equal(transformed.sigma, scale @ COV3 @ scale.T)
|
| 155 |
+
|
| 156 |
+
def test_standardized_has_identity_sigma(self):
|
| 157 |
+
standardized = self.mvn.standardized()
|
| 158 |
+
assert_array_almost_equal(standardized.sigma, np.eye(3), decimal=8)
|
| 159 |
+
|
| 160 |
+
@pytest.mark.xfail(
|
| 161 |
+
reason=(
|
| 162 |
+
"BUG: standardized() calls "
|
| 163 |
+
"affine_transformed(-self.mean, self.cholsigmainv), but "
|
| 164 |
+
"affine_transformed computes mean_new = B @ mean + shift. "
|
| 165 |
+
"With B=cholsigmainv and shift=-mean (unscaled), the result is "
|
| 166 |
+
"cholsigmainv @ mean - mean, not zero. The instance *method* "
|
| 167 |
+
".standardize(x) is implemented correctly (it does whiten(x - "
|
| 168 |
+
"mean), see test_whiten_standardize_relationship and "
|
| 169 |
+
"test_manual_standardize_of_samples_has_zero_mean); only the "
|
| 170 |
+
"*factory* .standardized(), which builds a new zero-mean "
|
| 171 |
+
"MVNormal via the generic affine-transform path, has the bug. "
|
| 172 |
+
"The correct shift would be -B @ self.mean."
|
| 173 |
+
),
|
| 174 |
+
raises=AssertionError,
|
| 175 |
+
strict=True,
|
| 176 |
+
)
|
| 177 |
+
def test_standardized_mean_is_zero(self):
|
| 178 |
+
standardized = self.mvn.standardized()
|
| 179 |
+
assert_array_almost_equal(standardized.mean, np.zeros(3))
|
| 180 |
+
|
| 181 |
+
def test_manual_standardize_of_samples_has_zero_mean(self):
|
| 182 |
+
# the .standardize(x) instance method (as opposed to the buggy
|
| 183 |
+
# .standardized() factory above) correctly produces zero-mean
|
| 184 |
+
# output when applied to samples from the distribution
|
| 185 |
+
rng = np.random.default_rng(0)
|
| 186 |
+
rvs = rng.multivariate_normal(MEAN3, COV3, size=200000)
|
| 187 |
+
whitened = self.mvn.standardize(rvs)
|
| 188 |
+
assert_allclose(whitened.mean(0), np.zeros(3), atol=0.02)
|
| 189 |
+
assert_allclose(np.cov(whitened, rowvar=False), np.eye(3), atol=0.05)
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
class TestMVNormalConstruction:
|
| 193 |
+
def test_scalar_sigma_is_iid(self):
|
| 194 |
+
mvn = MVNormal([0.0, 0.0], 2.0)
|
| 195 |
+
assert_array_almost_equal(mvn.cov, 2.0 * np.eye(2))
|
| 196 |
+
|
| 197 |
+
def test_1d_sigma_is_diagonal(self):
|
| 198 |
+
mvn = MVNormal([0.0, 0.0, 0.0], np.array([1.0, 2.0, 3.0]))
|
| 199 |
+
assert_array_almost_equal(mvn.cov, np.diag([1.0, 2.0, 3.0]))
|
| 200 |
+
|
| 201 |
+
def test_invalid_sigma_shape_raises(self):
|
| 202 |
+
with pytest.raises(ValueError, match="sigma has invalid shape"):
|
| 203 |
+
MVNormal([0.0, 0.0], np.ones((3, 2)))
|
| 204 |
+
|
| 205 |
+
|
| 206 |
+
class TestMVT:
|
| 207 |
+
def setup_method(self):
|
| 208 |
+
self.df = 5
|
| 209 |
+
self.mvt = MVT(MEAN3, COV3, self.df)
|
| 210 |
+
|
| 211 |
+
def test_logpdf_matches_scipy_multivariate_t(self):
|
| 212 |
+
pt = np.array([0.0, 1.0, 1.5])
|
| 213 |
+
result = self.mvt.logpdf(pt)
|
| 214 |
+
expected = stats.multivariate_t.logpdf(
|
| 215 |
+
pt, loc=MEAN3, shape=COV3, df=self.df
|
| 216 |
+
)
|
| 217 |
+
assert_allclose(result, expected, rtol=1e-10)
|
| 218 |
+
|
| 219 |
+
def test_cov_formula_for_df_greater_than_2(self):
|
| 220 |
+
expected = self.df / (self.df - 2.0) * COV3
|
| 221 |
+
assert_array_almost_equal(self.mvt.cov, expected)
|
| 222 |
+
|
| 223 |
+
def test_cov_is_nan_for_df_leq_2(self):
|
| 224 |
+
mvt2 = MVT(MEAN3, COV3, df=2)
|
| 225 |
+
assert np.all(np.isnan(mvt2.cov))
|
| 226 |
+
mvt1 = MVT(MEAN3, COV3, df=1)
|
| 227 |
+
assert np.all(np.isnan(mvt1.cov))
|
| 228 |
+
|
| 229 |
+
def test_rvs_covariance_matches_by_monte_carlo(self):
|
| 230 |
+
rvs = self.mvt.rvs(size=200000)
|
| 231 |
+
assert_allclose(np.cov(rvs, rowvar=False), self.mvt.cov, atol=0.1)
|
| 232 |
+
|
| 233 |
+
def test_affine_transformed(self):
|
| 234 |
+
shift = np.array([1.0, 1.0, 1.0])
|
| 235 |
+
scale = np.eye(3) * 2
|
| 236 |
+
transformed = self.mvt.affine_transformed(shift, scale)
|
| 237 |
+
assert_array_almost_equal(transformed.mean, shift + scale @ MEAN3)
|
| 238 |
+
assert_array_almost_equal(transformed.sigma, scale @ COV3 @ scale.T)
|
| 239 |
+
assert transformed.df == self.df
|
| 240 |
+
|
| 241 |
+
def test_marginal_preserves_df(self):
|
| 242 |
+
marg = self.mvt.marginal(np.array([0, 2]))
|
| 243 |
+
assert marg.df == self.df
|
| 244 |
+
assert_array_almost_equal(marg.mean, MEAN3[[0, 2]])
|
| 245 |
+
|
| 246 |
+
|
| 247 |
+
class TestMVNormal0:
|
| 248 |
+
# legacy reference implementation kept alongside MVNormal/MVElliptical
|
| 249 |
+
def test_logpdf_matches_mvnormal(self):
|
| 250 |
+
legacy = MVNormal0(MEAN3, COV3)
|
| 251 |
+
current = MVNormal(MEAN3, COV3)
|
| 252 |
+
pt = np.array([0.0, 1.0, 1.5])
|
| 253 |
+
assert_allclose(legacy.logpdf(pt), current.logpdf(pt), rtol=1e-10)
|
| 254 |
+
|
| 255 |
+
@pytest.mark.singleton_randomstate
|
| 256 |
+
def test_rvs_shape(self):
|
| 257 |
+
# MVNormal0.rvs() calls np.random.multivariate_normal directly
|
| 258 |
+
# (the legacy singleton RandomState API, unlike MVNormal.rvs()
|
| 259 |
+
# which threads an explicit rng/Generator), so this legitimately
|
| 260 |
+
# mutates global numpy random state.
|
| 261 |
+
legacy = MVNormal0(MEAN3, COV3)
|
| 262 |
+
rvs = legacy.rvs(size=5)
|
| 263 |
+
assert rvs.shape == (5, 3)
|
| 264 |
+
|
| 265 |
+
|
| 266 |
+
def test_expect_mc_estimates_normal_orthant_probability():
|
| 267 |
+
# expected value of an indicator function via Monte Carlo should be
|
| 268 |
+
# close to the true probability computed from the cdf
|
| 269 |
+
mvn = MVNormal([0.0, 0.0], np.eye(2))
|
| 270 |
+
a = np.array([0.0, 0.0])
|
| 271 |
+
result = expect_mc(mvn, lambda x: (x < a).all(-1), size=200000)
|
| 272 |
+
expected = stats.multivariate_normal.cdf(a, mean=[0.0, 0.0], cov=np.eye(2))
|
| 273 |
+
assert_allclose(result, expected, atol=0.01)
|
shared/package-files/2e/2ed7720a8f3906b5d0b3aae51fad589bef0aa961c7e8fc003a30f44318487733/blob
ADDED
|
Binary file (2.37 kB). View file
|
|
|
shared/package-files/2e/2edaf7151e34a33e0bace52ba5949e4770a644cb53d4792fb8e4ed6404538ae5/blob
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/special_gammaln_ops.h>
|
| 21 |
+
|
| 22 |
+
namespace at {
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
// aten::special_gammaln(Tensor self) -> Tensor
|
| 26 |
+
inline at::Tensor special_gammaln(const at::Tensor & self) {
|
| 27 |
+
return at::_ops::special_gammaln::call(self);
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
// aten::special_gammaln.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
|
| 31 |
+
inline at::Tensor & special_gammaln_out(at::Tensor & out, const at::Tensor & self) {
|
| 32 |
+
return at::_ops::special_gammaln_out::call(self, out);
|
| 33 |
+
}
|
| 34 |
+
// aten::special_gammaln.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
|
| 35 |
+
inline at::Tensor & special_gammaln_outf(const at::Tensor & self, at::Tensor & out) {
|
| 36 |
+
return at::_ops::special_gammaln_out::call(self, out);
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
}
|
shared/package-files/2e/2edb767a89d7bc06e14532908fbe151f6f7d3412bd982c785d809dc945cb4385/blob
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from . cimport sf_error
|
| 2 |
+
cdef void _set_action(sf_error.sf_error_t, sf_error.sf_action_t) noexcept nogil
|
| 3 |
+
cdef void *_export_beta_pdf_float
|
| 4 |
+
cdef void *_export_beta_pdf_double
|
| 5 |
+
cdef void *_export_beta_ppf_float
|
| 6 |
+
cdef void *_export_beta_ppf_double
|
| 7 |
+
cdef void *_export_binom_cdf_float
|
| 8 |
+
cdef void *_export_binom_cdf_double
|
| 9 |
+
cdef void *_export_binom_isf_float
|
| 10 |
+
cdef void *_export_binom_isf_double
|
| 11 |
+
cdef void *_export_binom_pmf_float
|
| 12 |
+
cdef void *_export_binom_pmf_double
|
| 13 |
+
cdef void *_export_binom_ppf_float
|
| 14 |
+
cdef void *_export_binom_ppf_double
|
| 15 |
+
cdef void *_export_binom_sf_float
|
| 16 |
+
cdef void *_export_binom_sf_double
|
| 17 |
+
cdef void *_export_cauchy_isf_float
|
| 18 |
+
cdef void *_export_cauchy_isf_double
|
| 19 |
+
cdef void *_export_cauchy_ppf_float
|
| 20 |
+
cdef void *_export_cauchy_ppf_double
|
| 21 |
+
cdef void *_export_hypergeom_cdf_float
|
| 22 |
+
cdef void *_export_hypergeom_cdf_double
|
| 23 |
+
cdef void *_export_hypergeom_mean_float
|
| 24 |
+
cdef void *_export_hypergeom_mean_double
|
| 25 |
+
cdef void *_export_hypergeom_pmf_float
|
| 26 |
+
cdef void *_export_hypergeom_pmf_double
|
| 27 |
+
cdef void *_export_hypergeom_sf_float
|
| 28 |
+
cdef void *_export_hypergeom_sf_double
|
| 29 |
+
cdef void *_export_hypergeom_skewness_float
|
| 30 |
+
cdef void *_export_hypergeom_skewness_double
|
| 31 |
+
cdef void *_export_hypergeom_variance_float
|
| 32 |
+
cdef void *_export_hypergeom_variance_double
|
| 33 |
+
cdef void *_export_invgauss_isf_float
|
| 34 |
+
cdef void *_export_invgauss_isf_double
|
| 35 |
+
cdef void *_export_invgauss_ppf_float
|
| 36 |
+
cdef void *_export_invgauss_ppf_double
|
| 37 |
+
cdef void *_export_landau_cdf_float
|
| 38 |
+
cdef void *_export_landau_cdf_double
|
| 39 |
+
cdef void *_export_landau_isf_float
|
| 40 |
+
cdef void *_export_landau_isf_double
|
| 41 |
+
cdef void *_export_landau_pdf_float
|
| 42 |
+
cdef void *_export_landau_pdf_double
|
| 43 |
+
cdef void *_export_landau_ppf_float
|
| 44 |
+
cdef void *_export_landau_ppf_double
|
| 45 |
+
cdef void *_export_landau_sf_float
|
| 46 |
+
cdef void *_export_landau_sf_double
|
| 47 |
+
cdef void *_export_nbinom_cdf_float
|
| 48 |
+
cdef void *_export_nbinom_cdf_double
|
| 49 |
+
cdef void *_export_nbinom_isf_float
|
| 50 |
+
cdef void *_export_nbinom_isf_double
|
| 51 |
+
cdef void *_export_nbinom_kurtosis_excess_float
|
| 52 |
+
cdef void *_export_nbinom_kurtosis_excess_double
|
| 53 |
+
cdef void *_export_nbinom_mean_float
|
| 54 |
+
cdef void *_export_nbinom_mean_double
|
| 55 |
+
cdef void *_export_nbinom_pmf_float
|
| 56 |
+
cdef void *_export_nbinom_pmf_double
|
| 57 |
+
cdef void *_export_nbinom_ppf_float
|
| 58 |
+
cdef void *_export_nbinom_ppf_double
|
| 59 |
+
cdef void *_export_nbinom_sf_float
|
| 60 |
+
cdef void *_export_nbinom_sf_double
|
| 61 |
+
cdef void *_export_nbinom_skewness_float
|
| 62 |
+
cdef void *_export_nbinom_skewness_double
|
| 63 |
+
cdef void *_export_nbinom_variance_float
|
| 64 |
+
cdef void *_export_nbinom_variance_double
|
| 65 |
+
cdef void *_export_ncf_isf_float
|
| 66 |
+
cdef void *_export_ncf_isf_double
|
| 67 |
+
cdef void *_export_ncf_kurtosis_excess_float
|
| 68 |
+
cdef void *_export_ncf_kurtosis_excess_double
|
| 69 |
+
cdef void *_export_ncf_mean_float
|
| 70 |
+
cdef void *_export_ncf_mean_double
|
| 71 |
+
cdef void *_export_ncf_pdf_float
|
| 72 |
+
cdef void *_export_ncf_pdf_double
|
| 73 |
+
cdef void *_export_ncf_sf_float
|
| 74 |
+
cdef void *_export_ncf_sf_double
|
| 75 |
+
cdef void *_export_ncf_skewness_float
|
| 76 |
+
cdef void *_export_ncf_skewness_double
|
| 77 |
+
cdef void *_export_ncf_variance_float
|
| 78 |
+
cdef void *_export_ncf_variance_double
|
| 79 |
+
cdef void *_export_nct_isf_float
|
| 80 |
+
cdef void *_export_nct_isf_double
|
| 81 |
+
cdef void *_export_nct_kurtosis_excess_float
|
| 82 |
+
cdef void *_export_nct_kurtosis_excess_double
|
| 83 |
+
cdef void *_export_nct_mean_float
|
| 84 |
+
cdef void *_export_nct_mean_double
|
| 85 |
+
cdef void *_export_nct_pdf_float
|
| 86 |
+
cdef void *_export_nct_pdf_double
|
| 87 |
+
cdef void *_export_nct_ppf_float
|
| 88 |
+
cdef void *_export_nct_ppf_double
|
| 89 |
+
cdef void *_export_nct_sf_float
|
| 90 |
+
cdef void *_export_nct_sf_double
|
| 91 |
+
cdef void *_export_nct_skewness_float
|
| 92 |
+
cdef void *_export_nct_skewness_double
|
| 93 |
+
cdef void *_export_nct_variance_float
|
| 94 |
+
cdef void *_export_nct_variance_double
|
| 95 |
+
cdef void *_export_ncx2_cdf_float
|
| 96 |
+
cdef void *_export_ncx2_cdf_double
|
| 97 |
+
cdef void *_export_ncx2_isf_float
|
| 98 |
+
cdef void *_export_ncx2_isf_double
|
| 99 |
+
cdef void *_export_ncx2_pdf_float
|
| 100 |
+
cdef void *_export_ncx2_pdf_double
|
| 101 |
+
cdef void *_export_ncx2_ppf_float
|
| 102 |
+
cdef void *_export_ncx2_ppf_double
|
| 103 |
+
cdef void *_export_ncx2_sf_float
|
| 104 |
+
cdef void *_export_ncx2_sf_double
|
| 105 |
+
cdef void *_export_skewnorm_cdf_float
|
| 106 |
+
cdef void *_export_skewnorm_cdf_double
|
| 107 |
+
cdef void *_export_skewnorm_isf_float
|
| 108 |
+
cdef void *_export_skewnorm_isf_double
|
| 109 |
+
cdef void *_export_skewnorm_ppf_float
|
| 110 |
+
cdef void *_export_skewnorm_ppf_double
|
| 111 |
+
cdef void *_export__stirling2_inexact
|
| 112 |
+
cdef void *_export_ibeta_float
|
| 113 |
+
cdef void *_export_ibeta_double
|
| 114 |
+
cdef void *_export_ibetac_float
|
| 115 |
+
cdef void *_export_ibetac_double
|
| 116 |
+
cdef void *_export_ibetac_inv_float
|
| 117 |
+
cdef void *_export_ibetac_inv_double
|
| 118 |
+
cdef void *_export_ibeta_inv_float
|
| 119 |
+
cdef void *_export_ibeta_inv_double
|
| 120 |
+
cdef void *_export_faddeeva_dawsn
|
| 121 |
+
cdef void *_export_faddeeva_dawsn_complex
|
| 122 |
+
cdef void *_export_fellint_RC
|
| 123 |
+
cdef void *_export_cellint_RC
|
| 124 |
+
cdef void *_export_fellint_RD
|
| 125 |
+
cdef void *_export_cellint_RD
|
| 126 |
+
cdef void *_export_fellint_RF
|
| 127 |
+
cdef void *_export_cellint_RF
|
| 128 |
+
cdef void *_export_fellint_RG
|
| 129 |
+
cdef void *_export_cellint_RG
|
| 130 |
+
cdef void *_export_fellint_RJ
|
| 131 |
+
cdef void *_export_cellint_RJ
|
| 132 |
+
cdef void *_export_faddeeva_erf
|
| 133 |
+
cdef void *_export_faddeeva_erfc_complex
|
| 134 |
+
cdef void *_export_faddeeva_erfcx
|
| 135 |
+
cdef void *_export_faddeeva_erfcx_complex
|
| 136 |
+
cdef void *_export_faddeeva_erfi
|
| 137 |
+
cdef void *_export_faddeeva_erfi_complex
|
| 138 |
+
cdef void *_export_erfinv_float
|
| 139 |
+
cdef void *_export_erfinv_double
|
| 140 |
+
cdef void *_export_hyp1f1_double
|
| 141 |
+
cdef void *_export_faddeeva_log_ndtr
|
| 142 |
+
cdef void *_export_faddeeva_log_ndtr_complex
|
| 143 |
+
cdef void *_export_ncf_cdf_float
|
| 144 |
+
cdef void *_export_ncf_cdf_double
|
| 145 |
+
cdef void *_export_ncf_ppf_float
|
| 146 |
+
cdef void *_export_ncf_ppf_double
|
| 147 |
+
cdef void *_export_nct_cdf_float
|
| 148 |
+
cdef void *_export_nct_cdf_double
|
| 149 |
+
cdef void *_export_faddeeva_ndtr
|
| 150 |
+
cdef void *_export_powm1_float
|
| 151 |
+
cdef void *_export_powm1_double
|
| 152 |
+
cdef void *_export_faddeeva_voigt_profile
|
| 153 |
+
cdef void *_export_faddeeva_w
|
| 154 |
+
cdef void *_export_wrightomega
|
| 155 |
+
cdef void *_export_wrightomega_real
|
shared/package-files/2e/2edea89ce24ba152444e003c144de0693cc49f1990857c8b4417ba4f4f91dfee/blob
ADDED
|
Binary file (4.64 kB). View file
|
|
|
shared/package-files/2e/2ee1a46e823643a77ad24420c0c0ee772fb97846e2c5a68218fefc0b01e58ba7/blob
ADDED
|
@@ -0,0 +1,724 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from datetime import datetime
|
| 2 |
+
import re
|
| 3 |
+
|
| 4 |
+
import numpy as np
|
| 5 |
+
import pytest
|
| 6 |
+
|
| 7 |
+
from pandas.core.dtypes.dtypes import ArrowDtype
|
| 8 |
+
|
| 9 |
+
from pandas import (
|
| 10 |
+
DataFrame,
|
| 11 |
+
Index,
|
| 12 |
+
MultiIndex,
|
| 13 |
+
Series,
|
| 14 |
+
_testing as tm,
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def test_extract_expand_kwarg_wrong_type_raises(any_string_dtype):
|
| 19 |
+
# TODO: should this raise TypeError
|
| 20 |
+
values = Series(["fooBAD__barBAD", np.nan, "foo"], dtype=any_string_dtype)
|
| 21 |
+
with pytest.raises(ValueError, match="expand must be True or False"):
|
| 22 |
+
values.str.extract(".*(BAD[_]+).*(BAD)", expand=None)
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def test_extract_expand_kwarg(any_string_dtype):
|
| 26 |
+
s = Series(["fooBAD__barBAD", np.nan, "foo"], dtype=any_string_dtype)
|
| 27 |
+
expected = DataFrame(["BAD__", np.nan, np.nan], dtype=any_string_dtype)
|
| 28 |
+
|
| 29 |
+
result = s.str.extract(".*(BAD[_]+).*")
|
| 30 |
+
tm.assert_frame_equal(result, expected)
|
| 31 |
+
|
| 32 |
+
result = s.str.extract(".*(BAD[_]+).*", expand=True)
|
| 33 |
+
tm.assert_frame_equal(result, expected)
|
| 34 |
+
|
| 35 |
+
expected = DataFrame(
|
| 36 |
+
[["BAD__", "BAD"], [np.nan, np.nan], [np.nan, np.nan]], dtype=any_string_dtype
|
| 37 |
+
)
|
| 38 |
+
result = s.str.extract(".*(BAD[_]+).*(BAD)", expand=False)
|
| 39 |
+
tm.assert_frame_equal(result, expected)
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def test_extract_expand_False_mixed_object():
|
| 43 |
+
ser = Series(
|
| 44 |
+
["aBAD_BAD", np.nan, "BAD_b_BAD", True, datetime.today(), "foo", None, 1, 2.0]
|
| 45 |
+
)
|
| 46 |
+
|
| 47 |
+
# two groups
|
| 48 |
+
result = ser.str.extract(".*(BAD[_]+).*(BAD)", expand=False)
|
| 49 |
+
er = [np.nan, np.nan] # empty row
|
| 50 |
+
expected = DataFrame(
|
| 51 |
+
[["BAD_", "BAD"], er, ["BAD_", "BAD"], er, er, er, er, er, er], dtype=object
|
| 52 |
+
)
|
| 53 |
+
tm.assert_frame_equal(result, expected)
|
| 54 |
+
|
| 55 |
+
# single group
|
| 56 |
+
result = ser.str.extract(".*(BAD[_]+).*BAD", expand=False)
|
| 57 |
+
expected = Series(
|
| 58 |
+
["BAD_", np.nan, "BAD_", np.nan, np.nan, np.nan, None, np.nan, np.nan],
|
| 59 |
+
dtype=object,
|
| 60 |
+
)
|
| 61 |
+
tm.assert_series_equal(result, expected)
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def test_extract_expand_index_raises():
|
| 65 |
+
# GH9980
|
| 66 |
+
# Index only works with one regex group since
|
| 67 |
+
# multi-group would expand to a frame
|
| 68 |
+
idx = Index(["A1", "A2", "A3", "A4", "B5"])
|
| 69 |
+
msg = "only one regex group is supported with Index"
|
| 70 |
+
with pytest.raises(ValueError, match=msg):
|
| 71 |
+
idx.str.extract("([AB])([123])", expand=False)
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
def test_extract_expand_no_capture_groups_raises(index_or_series, any_string_dtype):
|
| 75 |
+
s_or_idx = index_or_series(["A1", "B2", "C3"], dtype=any_string_dtype)
|
| 76 |
+
msg = "pattern contains no capture groups"
|
| 77 |
+
|
| 78 |
+
# no groups
|
| 79 |
+
with pytest.raises(ValueError, match=msg):
|
| 80 |
+
s_or_idx.str.extract("[ABC][123]", expand=False)
|
| 81 |
+
|
| 82 |
+
# only non-capturing groups
|
| 83 |
+
with pytest.raises(ValueError, match=msg):
|
| 84 |
+
s_or_idx.str.extract("(?:[AB]).*", expand=False)
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
def test_extract_expand_single_capture_group(index_or_series, any_string_dtype):
|
| 88 |
+
# single group renames series/index properly
|
| 89 |
+
s_or_idx = index_or_series(["A1", "A2"], dtype=any_string_dtype)
|
| 90 |
+
result = s_or_idx.str.extract(r"(?P<uno>A)\d", expand=False)
|
| 91 |
+
|
| 92 |
+
expected = index_or_series(["A", "A"], name="uno", dtype=any_string_dtype)
|
| 93 |
+
if index_or_series == Series:
|
| 94 |
+
tm.assert_series_equal(result, expected)
|
| 95 |
+
else:
|
| 96 |
+
tm.assert_index_equal(result, expected)
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
def test_extract_expand_capture_groups(any_string_dtype):
|
| 100 |
+
s = Series(["A1", "B2", "C3"], dtype=any_string_dtype)
|
| 101 |
+
# one group, no matches
|
| 102 |
+
result = s.str.extract("(_)", expand=False)
|
| 103 |
+
expected = Series([np.nan, np.nan, np.nan], dtype=any_string_dtype)
|
| 104 |
+
tm.assert_series_equal(result, expected)
|
| 105 |
+
|
| 106 |
+
# two groups, no matches
|
| 107 |
+
result = s.str.extract("(_)(_)", expand=False)
|
| 108 |
+
expected = DataFrame(
|
| 109 |
+
[[np.nan, np.nan], [np.nan, np.nan], [np.nan, np.nan]], dtype=any_string_dtype
|
| 110 |
+
)
|
| 111 |
+
tm.assert_frame_equal(result, expected)
|
| 112 |
+
|
| 113 |
+
# one group, some matches
|
| 114 |
+
result = s.str.extract("([AB])[123]", expand=False)
|
| 115 |
+
expected = Series(["A", "B", np.nan], dtype=any_string_dtype)
|
| 116 |
+
tm.assert_series_equal(result, expected)
|
| 117 |
+
|
| 118 |
+
# two groups, some matches
|
| 119 |
+
result = s.str.extract("([AB])([123])", expand=False)
|
| 120 |
+
expected = DataFrame(
|
| 121 |
+
[["A", "1"], ["B", "2"], [np.nan, np.nan]], dtype=any_string_dtype
|
| 122 |
+
)
|
| 123 |
+
tm.assert_frame_equal(result, expected)
|
| 124 |
+
|
| 125 |
+
# one named group
|
| 126 |
+
result = s.str.extract("(?P<letter>[AB])", expand=False)
|
| 127 |
+
expected = Series(["A", "B", np.nan], name="letter", dtype=any_string_dtype)
|
| 128 |
+
tm.assert_series_equal(result, expected)
|
| 129 |
+
|
| 130 |
+
# two named groups
|
| 131 |
+
result = s.str.extract("(?P<letter>[AB])(?P<number>[123])", expand=False)
|
| 132 |
+
expected = DataFrame(
|
| 133 |
+
[["A", "1"], ["B", "2"], [np.nan, np.nan]],
|
| 134 |
+
columns=["letter", "number"],
|
| 135 |
+
dtype=any_string_dtype,
|
| 136 |
+
)
|
| 137 |
+
tm.assert_frame_equal(result, expected)
|
| 138 |
+
|
| 139 |
+
# mix named and unnamed groups
|
| 140 |
+
result = s.str.extract("([AB])(?P<number>[123])", expand=False)
|
| 141 |
+
expected = DataFrame(
|
| 142 |
+
[["A", "1"], ["B", "2"], [np.nan, np.nan]],
|
| 143 |
+
columns=[0, "number"],
|
| 144 |
+
dtype=any_string_dtype,
|
| 145 |
+
)
|
| 146 |
+
tm.assert_frame_equal(result, expected)
|
| 147 |
+
|
| 148 |
+
# one normal group, one non-capturing group
|
| 149 |
+
result = s.str.extract("([AB])(?:[123])", expand=False)
|
| 150 |
+
expected = Series(["A", "B", np.nan], dtype=any_string_dtype)
|
| 151 |
+
tm.assert_series_equal(result, expected)
|
| 152 |
+
|
| 153 |
+
# two normal groups, one non-capturing group
|
| 154 |
+
s = Series(["A11", "B22", "C33"], dtype=any_string_dtype)
|
| 155 |
+
result = s.str.extract("([AB])([123])(?:[123])", expand=False)
|
| 156 |
+
expected = DataFrame(
|
| 157 |
+
[["A", "1"], ["B", "2"], [np.nan, np.nan]], dtype=any_string_dtype
|
| 158 |
+
)
|
| 159 |
+
tm.assert_frame_equal(result, expected)
|
| 160 |
+
|
| 161 |
+
# one optional group followed by one normal group
|
| 162 |
+
s = Series(["A1", "B2", "3"], dtype=any_string_dtype)
|
| 163 |
+
result = s.str.extract("(?P<letter>[AB])?(?P<number>[123])", expand=False)
|
| 164 |
+
expected = DataFrame(
|
| 165 |
+
[["A", "1"], ["B", "2"], [np.nan, "3"]],
|
| 166 |
+
columns=["letter", "number"],
|
| 167 |
+
dtype=any_string_dtype,
|
| 168 |
+
)
|
| 169 |
+
tm.assert_frame_equal(result, expected)
|
| 170 |
+
|
| 171 |
+
# one normal group followed by one optional group
|
| 172 |
+
s = Series(["A1", "B2", "C"], dtype=any_string_dtype)
|
| 173 |
+
result = s.str.extract("(?P<letter>[ABC])(?P<number>[123])?", expand=False)
|
| 174 |
+
expected = DataFrame(
|
| 175 |
+
[["A", "1"], ["B", "2"], ["C", np.nan]],
|
| 176 |
+
columns=["letter", "number"],
|
| 177 |
+
dtype=any_string_dtype,
|
| 178 |
+
)
|
| 179 |
+
tm.assert_frame_equal(result, expected)
|
| 180 |
+
|
| 181 |
+
|
| 182 |
+
def test_extract_expand_capture_groups_index(index, any_string_dtype):
|
| 183 |
+
# https://github.com/pandas-dev/pandas/issues/6348
|
| 184 |
+
# not passing index to the extractor
|
| 185 |
+
data = ["A1", "B2", "C"]
|
| 186 |
+
|
| 187 |
+
if len(index) == 0:
|
| 188 |
+
pytest.skip("Test requires len(index) > 0")
|
| 189 |
+
while len(index) < len(data):
|
| 190 |
+
index = index.repeat(2)
|
| 191 |
+
|
| 192 |
+
index = index[: len(data)]
|
| 193 |
+
ser = Series(data, index=index, dtype=any_string_dtype)
|
| 194 |
+
|
| 195 |
+
result = ser.str.extract(r"(\d)", expand=False)
|
| 196 |
+
expected = Series(["1", "2", np.nan], index=index, dtype=any_string_dtype)
|
| 197 |
+
tm.assert_series_equal(result, expected)
|
| 198 |
+
|
| 199 |
+
result = ser.str.extract(r"(?P<letter>\D)(?P<number>\d)?", expand=False)
|
| 200 |
+
expected = DataFrame(
|
| 201 |
+
[["A", "1"], ["B", "2"], ["C", np.nan]],
|
| 202 |
+
columns=["letter", "number"],
|
| 203 |
+
index=index,
|
| 204 |
+
dtype=any_string_dtype,
|
| 205 |
+
)
|
| 206 |
+
tm.assert_frame_equal(result, expected)
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
def test_extract_single_series_name_is_preserved(any_string_dtype):
|
| 210 |
+
s = Series(["a3", "b3", "c2"], name="bob", dtype=any_string_dtype)
|
| 211 |
+
result = s.str.extract(r"(?P<sue>[a-z])", expand=False)
|
| 212 |
+
expected = Series(["a", "b", "c"], name="sue", dtype=any_string_dtype)
|
| 213 |
+
tm.assert_series_equal(result, expected)
|
| 214 |
+
|
| 215 |
+
|
| 216 |
+
def test_extract_expand_True(any_string_dtype):
|
| 217 |
+
# Contains tests like those in test_match and some others.
|
| 218 |
+
s = Series(["fooBAD__barBAD", np.nan, "foo"], dtype=any_string_dtype)
|
| 219 |
+
|
| 220 |
+
result = s.str.extract(".*(BAD[_]+).*(BAD)", expand=True)
|
| 221 |
+
expected = DataFrame(
|
| 222 |
+
[["BAD__", "BAD"], [np.nan, np.nan], [np.nan, np.nan]], dtype=any_string_dtype
|
| 223 |
+
)
|
| 224 |
+
tm.assert_frame_equal(result, expected)
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
def test_extract_expand_True_mixed_object():
|
| 228 |
+
er = [np.nan, np.nan] # empty row
|
| 229 |
+
mixed = Series(
|
| 230 |
+
[
|
| 231 |
+
"aBAD_BAD",
|
| 232 |
+
np.nan,
|
| 233 |
+
"BAD_b_BAD",
|
| 234 |
+
True,
|
| 235 |
+
datetime.today(),
|
| 236 |
+
"foo",
|
| 237 |
+
None,
|
| 238 |
+
1,
|
| 239 |
+
2.0,
|
| 240 |
+
]
|
| 241 |
+
)
|
| 242 |
+
|
| 243 |
+
result = mixed.str.extract(".*(BAD[_]+).*(BAD)", expand=True)
|
| 244 |
+
expected = DataFrame(
|
| 245 |
+
[["BAD_", "BAD"], er, ["BAD_", "BAD"], er, er, er, er, er, er], dtype=object
|
| 246 |
+
)
|
| 247 |
+
tm.assert_frame_equal(result, expected)
|
| 248 |
+
|
| 249 |
+
|
| 250 |
+
def test_extract_expand_True_single_capture_group_raises(
|
| 251 |
+
index_or_series, any_string_dtype
|
| 252 |
+
):
|
| 253 |
+
# these should work for both Series and Index
|
| 254 |
+
# no groups
|
| 255 |
+
s_or_idx = index_or_series(["A1", "B2", "C3"], dtype=any_string_dtype)
|
| 256 |
+
msg = "pattern contains no capture groups"
|
| 257 |
+
with pytest.raises(ValueError, match=msg):
|
| 258 |
+
s_or_idx.str.extract("[ABC][123]", expand=True)
|
| 259 |
+
|
| 260 |
+
# only non-capturing groups
|
| 261 |
+
with pytest.raises(ValueError, match=msg):
|
| 262 |
+
s_or_idx.str.extract("(?:[AB]).*", expand=True)
|
| 263 |
+
|
| 264 |
+
|
| 265 |
+
def test_extract_expand_True_single_capture_group(index_or_series, any_string_dtype):
|
| 266 |
+
# single group renames series/index properly
|
| 267 |
+
s_or_idx = index_or_series(["A1", "A2"], dtype=any_string_dtype)
|
| 268 |
+
result = s_or_idx.str.extract(r"(?P<uno>A)\d", expand=True)
|
| 269 |
+
expected = DataFrame({"uno": ["A", "A"]}, dtype=any_string_dtype)
|
| 270 |
+
tm.assert_frame_equal(result, expected)
|
| 271 |
+
|
| 272 |
+
|
| 273 |
+
@pytest.mark.parametrize("name", [None, "series_name"])
|
| 274 |
+
def test_extract_series(name, any_string_dtype):
|
| 275 |
+
# extract should give the same result whether or not the series has a name.
|
| 276 |
+
s = Series(["A1", "B2", "C3"], name=name, dtype=any_string_dtype)
|
| 277 |
+
|
| 278 |
+
# one group, no matches
|
| 279 |
+
result = s.str.extract("(_)", expand=True)
|
| 280 |
+
expected = DataFrame([np.nan, np.nan, np.nan], dtype=any_string_dtype)
|
| 281 |
+
tm.assert_frame_equal(result, expected)
|
| 282 |
+
|
| 283 |
+
# two groups, no matches
|
| 284 |
+
result = s.str.extract("(_)(_)", expand=True)
|
| 285 |
+
expected = DataFrame(
|
| 286 |
+
[[np.nan, np.nan], [np.nan, np.nan], [np.nan, np.nan]], dtype=any_string_dtype
|
| 287 |
+
)
|
| 288 |
+
tm.assert_frame_equal(result, expected)
|
| 289 |
+
|
| 290 |
+
# one group, some matches
|
| 291 |
+
result = s.str.extract("([AB])[123]", expand=True)
|
| 292 |
+
expected = DataFrame(["A", "B", np.nan], dtype=any_string_dtype)
|
| 293 |
+
tm.assert_frame_equal(result, expected)
|
| 294 |
+
|
| 295 |
+
# two groups, some matches
|
| 296 |
+
result = s.str.extract("([AB])([123])", expand=True)
|
| 297 |
+
expected = DataFrame(
|
| 298 |
+
[["A", "1"], ["B", "2"], [np.nan, np.nan]], dtype=any_string_dtype
|
| 299 |
+
)
|
| 300 |
+
tm.assert_frame_equal(result, expected)
|
| 301 |
+
|
| 302 |
+
# one named group
|
| 303 |
+
result = s.str.extract("(?P<letter>[AB])", expand=True)
|
| 304 |
+
expected = DataFrame({"letter": ["A", "B", np.nan]}, dtype=any_string_dtype)
|
| 305 |
+
tm.assert_frame_equal(result, expected)
|
| 306 |
+
|
| 307 |
+
# two named groups
|
| 308 |
+
result = s.str.extract("(?P<letter>[AB])(?P<number>[123])", expand=True)
|
| 309 |
+
expected = DataFrame(
|
| 310 |
+
[["A", "1"], ["B", "2"], [np.nan, np.nan]],
|
| 311 |
+
columns=["letter", "number"],
|
| 312 |
+
dtype=any_string_dtype,
|
| 313 |
+
)
|
| 314 |
+
tm.assert_frame_equal(result, expected)
|
| 315 |
+
|
| 316 |
+
# mix named and unnamed groups
|
| 317 |
+
result = s.str.extract("([AB])(?P<number>[123])", expand=True)
|
| 318 |
+
expected = DataFrame(
|
| 319 |
+
[["A", "1"], ["B", "2"], [np.nan, np.nan]],
|
| 320 |
+
columns=[0, "number"],
|
| 321 |
+
dtype=any_string_dtype,
|
| 322 |
+
)
|
| 323 |
+
tm.assert_frame_equal(result, expected)
|
| 324 |
+
|
| 325 |
+
# one normal group, one non-capturing group
|
| 326 |
+
result = s.str.extract("([AB])(?:[123])", expand=True)
|
| 327 |
+
expected = DataFrame(["A", "B", np.nan], dtype=any_string_dtype)
|
| 328 |
+
tm.assert_frame_equal(result, expected)
|
| 329 |
+
|
| 330 |
+
|
| 331 |
+
def test_extract_optional_groups(any_string_dtype):
|
| 332 |
+
# two normal groups, one non-capturing group
|
| 333 |
+
s = Series(["A11", "B22", "C33"], dtype=any_string_dtype)
|
| 334 |
+
result = s.str.extract("([AB])([123])(?:[123])", expand=True)
|
| 335 |
+
expected = DataFrame(
|
| 336 |
+
[["A", "1"], ["B", "2"], [np.nan, np.nan]], dtype=any_string_dtype
|
| 337 |
+
)
|
| 338 |
+
tm.assert_frame_equal(result, expected)
|
| 339 |
+
|
| 340 |
+
# one optional group followed by one normal group
|
| 341 |
+
s = Series(["A1", "B2", "3"], dtype=any_string_dtype)
|
| 342 |
+
result = s.str.extract("(?P<letter>[AB])?(?P<number>[123])", expand=True)
|
| 343 |
+
expected = DataFrame(
|
| 344 |
+
[["A", "1"], ["B", "2"], [np.nan, "3"]],
|
| 345 |
+
columns=["letter", "number"],
|
| 346 |
+
dtype=any_string_dtype,
|
| 347 |
+
)
|
| 348 |
+
tm.assert_frame_equal(result, expected)
|
| 349 |
+
|
| 350 |
+
# one normal group followed by one optional group
|
| 351 |
+
s = Series(["A1", "B2", "C"], dtype=any_string_dtype)
|
| 352 |
+
result = s.str.extract("(?P<letter>[ABC])(?P<number>[123])?", expand=True)
|
| 353 |
+
expected = DataFrame(
|
| 354 |
+
[["A", "1"], ["B", "2"], ["C", np.nan]],
|
| 355 |
+
columns=["letter", "number"],
|
| 356 |
+
dtype=any_string_dtype,
|
| 357 |
+
)
|
| 358 |
+
tm.assert_frame_equal(result, expected)
|
| 359 |
+
|
| 360 |
+
|
| 361 |
+
def test_extract_dataframe_capture_groups_index(index, any_string_dtype):
|
| 362 |
+
# GH6348
|
| 363 |
+
# not passing index to the extractor
|
| 364 |
+
|
| 365 |
+
data = ["A1", "B2", "C"]
|
| 366 |
+
|
| 367 |
+
if len(index) < len(data):
|
| 368 |
+
pytest.skip(f"Index needs more than {len(data)} values")
|
| 369 |
+
|
| 370 |
+
index = index[: len(data)]
|
| 371 |
+
s = Series(data, index=index, dtype=any_string_dtype)
|
| 372 |
+
|
| 373 |
+
result = s.str.extract(r"(\d)", expand=True)
|
| 374 |
+
expected = DataFrame(["1", "2", np.nan], index=index, dtype=any_string_dtype)
|
| 375 |
+
tm.assert_frame_equal(result, expected)
|
| 376 |
+
|
| 377 |
+
result = s.str.extract(r"(?P<letter>\D)(?P<number>\d)?", expand=True)
|
| 378 |
+
expected = DataFrame(
|
| 379 |
+
[["A", "1"], ["B", "2"], ["C", np.nan]],
|
| 380 |
+
columns=["letter", "number"],
|
| 381 |
+
index=index,
|
| 382 |
+
dtype=any_string_dtype,
|
| 383 |
+
)
|
| 384 |
+
tm.assert_frame_equal(result, expected)
|
| 385 |
+
|
| 386 |
+
|
| 387 |
+
def test_extract_single_group_returns_frame(any_string_dtype):
|
| 388 |
+
# GH11386 extract should always return DataFrame, even when
|
| 389 |
+
# there is only one group. Prior to v0.18.0, extract returned
|
| 390 |
+
# Series when there was only one group in the regex.
|
| 391 |
+
s = Series(["a3", "b3", "c2"], name="series_name", dtype=any_string_dtype)
|
| 392 |
+
result = s.str.extract(r"(?P<letter>[a-z])", expand=True)
|
| 393 |
+
expected = DataFrame({"letter": ["a", "b", "c"]}, dtype=any_string_dtype)
|
| 394 |
+
tm.assert_frame_equal(result, expected)
|
| 395 |
+
|
| 396 |
+
|
| 397 |
+
def test_extractall(any_string_dtype):
|
| 398 |
+
data = [
|
| 399 |
+
"dave@google.com",
|
| 400 |
+
"tdhock5@gmail.com",
|
| 401 |
+
"maudelaperriere@gmail.com",
|
| 402 |
+
"rob@gmail.com some text steve@gmail.com",
|
| 403 |
+
"a@b.com some text c@d.com and e@f.com",
|
| 404 |
+
np.nan,
|
| 405 |
+
"",
|
| 406 |
+
]
|
| 407 |
+
expected_tuples = [
|
| 408 |
+
("dave", "google", "com"),
|
| 409 |
+
("tdhock5", "gmail", "com"),
|
| 410 |
+
("maudelaperriere", "gmail", "com"),
|
| 411 |
+
("rob", "gmail", "com"),
|
| 412 |
+
("steve", "gmail", "com"),
|
| 413 |
+
("a", "b", "com"),
|
| 414 |
+
("c", "d", "com"),
|
| 415 |
+
("e", "f", "com"),
|
| 416 |
+
]
|
| 417 |
+
pat = r"""
|
| 418 |
+
(?P<user>[a-z0-9]+)
|
| 419 |
+
@
|
| 420 |
+
(?P<domain>[a-z]+)
|
| 421 |
+
\.
|
| 422 |
+
(?P<tld>[a-z]{2,4})
|
| 423 |
+
"""
|
| 424 |
+
expected_columns = ["user", "domain", "tld"]
|
| 425 |
+
s = Series(data, dtype=any_string_dtype)
|
| 426 |
+
# extractall should return a DataFrame with one row for each match, indexed by the
|
| 427 |
+
# subject from which the match came.
|
| 428 |
+
expected_index = MultiIndex.from_tuples(
|
| 429 |
+
[(0, 0), (1, 0), (2, 0), (3, 0), (3, 1), (4, 0), (4, 1), (4, 2)],
|
| 430 |
+
names=(None, "match"),
|
| 431 |
+
)
|
| 432 |
+
expected = DataFrame(
|
| 433 |
+
expected_tuples, expected_index, expected_columns, dtype=any_string_dtype
|
| 434 |
+
)
|
| 435 |
+
result = s.str.extractall(pat, flags=re.VERBOSE)
|
| 436 |
+
tm.assert_frame_equal(result, expected)
|
| 437 |
+
|
| 438 |
+
# The index of the input Series should be used to construct the index of the output
|
| 439 |
+
# DataFrame:
|
| 440 |
+
mi = MultiIndex.from_tuples(
|
| 441 |
+
[
|
| 442 |
+
("single", "Dave"),
|
| 443 |
+
("single", "Toby"),
|
| 444 |
+
("single", "Maude"),
|
| 445 |
+
("multiple", "robAndSteve"),
|
| 446 |
+
("multiple", "abcdef"),
|
| 447 |
+
("none", "missing"),
|
| 448 |
+
("none", "empty"),
|
| 449 |
+
]
|
| 450 |
+
)
|
| 451 |
+
s = Series(data, index=mi, dtype=any_string_dtype)
|
| 452 |
+
expected_index = MultiIndex.from_tuples(
|
| 453 |
+
[
|
| 454 |
+
("single", "Dave", 0),
|
| 455 |
+
("single", "Toby", 0),
|
| 456 |
+
("single", "Maude", 0),
|
| 457 |
+
("multiple", "robAndSteve", 0),
|
| 458 |
+
("multiple", "robAndSteve", 1),
|
| 459 |
+
("multiple", "abcdef", 0),
|
| 460 |
+
("multiple", "abcdef", 1),
|
| 461 |
+
("multiple", "abcdef", 2),
|
| 462 |
+
],
|
| 463 |
+
names=(None, None, "match"),
|
| 464 |
+
)
|
| 465 |
+
expected = DataFrame(
|
| 466 |
+
expected_tuples, expected_index, expected_columns, dtype=any_string_dtype
|
| 467 |
+
)
|
| 468 |
+
result = s.str.extractall(pat, flags=re.VERBOSE)
|
| 469 |
+
tm.assert_frame_equal(result, expected)
|
| 470 |
+
|
| 471 |
+
# MultiIndexed subject with names.
|
| 472 |
+
s = Series(data, index=mi, dtype=any_string_dtype)
|
| 473 |
+
s.index.names = ("matches", "description")
|
| 474 |
+
expected_index.names = ("matches", "description", "match")
|
| 475 |
+
expected = DataFrame(
|
| 476 |
+
expected_tuples, expected_index, expected_columns, dtype=any_string_dtype
|
| 477 |
+
)
|
| 478 |
+
result = s.str.extractall(pat, flags=re.VERBOSE)
|
| 479 |
+
tm.assert_frame_equal(result, expected)
|
| 480 |
+
|
| 481 |
+
|
| 482 |
+
@pytest.mark.parametrize(
|
| 483 |
+
"pat,expected_names",
|
| 484 |
+
[
|
| 485 |
+
# optional groups.
|
| 486 |
+
("(?P<letter>[AB])?(?P<number>[123])", ["letter", "number"]),
|
| 487 |
+
# only one of two groups has a name.
|
| 488 |
+
("([AB])?(?P<number>[123])", [0, "number"]),
|
| 489 |
+
],
|
| 490 |
+
)
|
| 491 |
+
def test_extractall_column_names(pat, expected_names, any_string_dtype):
|
| 492 |
+
s = Series(["", "A1", "32"], dtype=any_string_dtype)
|
| 493 |
+
|
| 494 |
+
result = s.str.extractall(pat)
|
| 495 |
+
expected = DataFrame(
|
| 496 |
+
[("A", "1"), (np.nan, "3"), (np.nan, "2")],
|
| 497 |
+
index=MultiIndex.from_tuples([(1, 0), (2, 0), (2, 1)], names=(None, "match")),
|
| 498 |
+
columns=expected_names,
|
| 499 |
+
dtype=any_string_dtype,
|
| 500 |
+
)
|
| 501 |
+
tm.assert_frame_equal(result, expected)
|
| 502 |
+
|
| 503 |
+
|
| 504 |
+
def test_extractall_single_group(any_string_dtype):
|
| 505 |
+
s = Series(["a3", "b3", "d4c2"], name="series_name", dtype=any_string_dtype)
|
| 506 |
+
expected_index = MultiIndex.from_tuples(
|
| 507 |
+
[(0, 0), (1, 0), (2, 0), (2, 1)], names=(None, "match")
|
| 508 |
+
)
|
| 509 |
+
|
| 510 |
+
# extractall(one named group) returns DataFrame with one named column.
|
| 511 |
+
result = s.str.extractall(r"(?P<letter>[a-z])")
|
| 512 |
+
expected = DataFrame(
|
| 513 |
+
{"letter": ["a", "b", "d", "c"]}, index=expected_index, dtype=any_string_dtype
|
| 514 |
+
)
|
| 515 |
+
tm.assert_frame_equal(result, expected)
|
| 516 |
+
|
| 517 |
+
# extractall(one un-named group) returns DataFrame with one un-named column.
|
| 518 |
+
result = s.str.extractall(r"([a-z])")
|
| 519 |
+
expected = DataFrame(
|
| 520 |
+
["a", "b", "d", "c"], index=expected_index, dtype=any_string_dtype
|
| 521 |
+
)
|
| 522 |
+
tm.assert_frame_equal(result, expected)
|
| 523 |
+
|
| 524 |
+
|
| 525 |
+
def test_extractall_single_group_with_quantifier(any_string_dtype):
|
| 526 |
+
# GH#13382
|
| 527 |
+
# extractall(one un-named group with quantifier) returns DataFrame with one un-named
|
| 528 |
+
# column.
|
| 529 |
+
s = Series(["ab3", "abc3", "d4cd2"], name="series_name", dtype=any_string_dtype)
|
| 530 |
+
result = s.str.extractall(r"([a-z]+)")
|
| 531 |
+
expected = DataFrame(
|
| 532 |
+
["ab", "abc", "d", "cd"],
|
| 533 |
+
index=MultiIndex.from_tuples(
|
| 534 |
+
[(0, 0), (1, 0), (2, 0), (2, 1)], names=(None, "match")
|
| 535 |
+
),
|
| 536 |
+
dtype=any_string_dtype,
|
| 537 |
+
)
|
| 538 |
+
tm.assert_frame_equal(result, expected)
|
| 539 |
+
|
| 540 |
+
|
| 541 |
+
@pytest.mark.parametrize(
|
| 542 |
+
"data, names",
|
| 543 |
+
[
|
| 544 |
+
([], (None,)),
|
| 545 |
+
([], ("i1",)),
|
| 546 |
+
([], (None, "i2")),
|
| 547 |
+
([], ("i1", "i2")),
|
| 548 |
+
(["a3", "b3", "d4c2"], (None,)),
|
| 549 |
+
(["a3", "b3", "d4c2"], ("i1", "i2")),
|
| 550 |
+
(["a3", "b3", "d4c2"], (None, "i2")),
|
| 551 |
+
(["a3", "b3", "d4c2"], ("i1", "i2")),
|
| 552 |
+
],
|
| 553 |
+
)
|
| 554 |
+
def test_extractall_no_matches(data, names, any_string_dtype):
|
| 555 |
+
# GH19075 extractall with no matches should return a valid MultiIndex
|
| 556 |
+
n = len(data)
|
| 557 |
+
if len(names) == 1:
|
| 558 |
+
index = Index(range(n), name=names[0])
|
| 559 |
+
else:
|
| 560 |
+
tuples = (tuple([i] * (n - 1)) for i in range(n))
|
| 561 |
+
index = MultiIndex.from_tuples(tuples, names=names)
|
| 562 |
+
s = Series(data, name="series_name", index=index, dtype=any_string_dtype)
|
| 563 |
+
expected_index = MultiIndex.from_tuples([], names=(names + ("match",)))
|
| 564 |
+
|
| 565 |
+
# one un-named group.
|
| 566 |
+
result = s.str.extractall("(z)")
|
| 567 |
+
expected = DataFrame(columns=[0], index=expected_index, dtype=any_string_dtype)
|
| 568 |
+
tm.assert_frame_equal(result, expected)
|
| 569 |
+
|
| 570 |
+
# two un-named groups.
|
| 571 |
+
result = s.str.extractall("(z)(z)")
|
| 572 |
+
expected = DataFrame(columns=[0, 1], index=expected_index, dtype=any_string_dtype)
|
| 573 |
+
tm.assert_frame_equal(result, expected)
|
| 574 |
+
|
| 575 |
+
# one named group.
|
| 576 |
+
result = s.str.extractall("(?P<first>z)")
|
| 577 |
+
expected = DataFrame(
|
| 578 |
+
columns=["first"], index=expected_index, dtype=any_string_dtype
|
| 579 |
+
)
|
| 580 |
+
tm.assert_frame_equal(result, expected)
|
| 581 |
+
|
| 582 |
+
# two named groups.
|
| 583 |
+
result = s.str.extractall("(?P<first>z)(?P<second>z)")
|
| 584 |
+
expected = DataFrame(
|
| 585 |
+
columns=["first", "second"], index=expected_index, dtype=any_string_dtype
|
| 586 |
+
)
|
| 587 |
+
tm.assert_frame_equal(result, expected)
|
| 588 |
+
|
| 589 |
+
# one named, one un-named.
|
| 590 |
+
result = s.str.extractall("(z)(?P<second>z)")
|
| 591 |
+
expected = DataFrame(
|
| 592 |
+
columns=[0, "second"], index=expected_index, dtype=any_string_dtype
|
| 593 |
+
)
|
| 594 |
+
tm.assert_frame_equal(result, expected)
|
| 595 |
+
|
| 596 |
+
|
| 597 |
+
def test_extractall_stringindex(any_string_dtype):
|
| 598 |
+
s = Series(["a1a2", "b1", "c1"], name="xxx", dtype=any_string_dtype)
|
| 599 |
+
result = s.str.extractall(r"[ab](?P<digit>\d)")
|
| 600 |
+
expected = DataFrame(
|
| 601 |
+
{"digit": ["1", "2", "1"]},
|
| 602 |
+
index=MultiIndex.from_tuples([(0, 0), (0, 1), (1, 0)], names=[None, "match"]),
|
| 603 |
+
dtype=any_string_dtype,
|
| 604 |
+
)
|
| 605 |
+
tm.assert_frame_equal(result, expected)
|
| 606 |
+
|
| 607 |
+
# index should return the same result as the default index without name thus
|
| 608 |
+
# index.name doesn't affect to the result
|
| 609 |
+
if any_string_dtype == "object":
|
| 610 |
+
for idx in [
|
| 611 |
+
Index(["a1a2", "b1", "c1"], dtype=object),
|
| 612 |
+
Index(["a1a2", "b1", "c1"], name="xxx", dtype=object),
|
| 613 |
+
]:
|
| 614 |
+
result = idx.str.extractall(r"[ab](?P<digit>\d)")
|
| 615 |
+
tm.assert_frame_equal(result, expected)
|
| 616 |
+
|
| 617 |
+
s = Series(
|
| 618 |
+
["a1a2", "b1", "c1"],
|
| 619 |
+
name="s_name",
|
| 620 |
+
index=Index(["XX", "yy", "zz"], name="idx_name"),
|
| 621 |
+
dtype=any_string_dtype,
|
| 622 |
+
)
|
| 623 |
+
result = s.str.extractall(r"[ab](?P<digit>\d)")
|
| 624 |
+
expected = DataFrame(
|
| 625 |
+
{"digit": ["1", "2", "1"]},
|
| 626 |
+
index=MultiIndex.from_tuples(
|
| 627 |
+
[("XX", 0), ("XX", 1), ("yy", 0)], names=["idx_name", "match"]
|
| 628 |
+
),
|
| 629 |
+
dtype=any_string_dtype,
|
| 630 |
+
)
|
| 631 |
+
tm.assert_frame_equal(result, expected)
|
| 632 |
+
|
| 633 |
+
|
| 634 |
+
def test_extractall_no_capture_groups_raises(any_string_dtype):
|
| 635 |
+
# Does not make sense to use extractall with a regex that has no capture groups.
|
| 636 |
+
# (it returns DataFrame with one column for each capture group)
|
| 637 |
+
s = Series(["a3", "b3", "d4c2"], name="series_name", dtype=any_string_dtype)
|
| 638 |
+
with pytest.raises(ValueError, match="no capture groups"):
|
| 639 |
+
s.str.extractall(r"[a-z]")
|
| 640 |
+
|
| 641 |
+
|
| 642 |
+
def test_extract_index_one_two_groups():
|
| 643 |
+
s = Series(["a3", "b3", "d4c2"], index=["A3", "B3", "D4"], name="series_name")
|
| 644 |
+
r = s.index.str.extract(r"([A-Z])", expand=True)
|
| 645 |
+
e = DataFrame(["A", "B", "D"])
|
| 646 |
+
tm.assert_frame_equal(r, e)
|
| 647 |
+
|
| 648 |
+
# Prior to v0.18.0, index.str.extract(regex with one group)
|
| 649 |
+
# returned Index. With more than one group, extract raised an
|
| 650 |
+
# error (GH9980). Now extract always returns DataFrame.
|
| 651 |
+
r = s.index.str.extract(r"(?P<letter>[A-Z])(?P<digit>[0-9])", expand=True)
|
| 652 |
+
e_list = [("A", "3"), ("B", "3"), ("D", "4")]
|
| 653 |
+
e = DataFrame(e_list, columns=["letter", "digit"])
|
| 654 |
+
tm.assert_frame_equal(r, e)
|
| 655 |
+
|
| 656 |
+
|
| 657 |
+
def test_extractall_same_as_extract(any_string_dtype):
|
| 658 |
+
s = Series(["a3", "b3", "c2"], name="series_name", dtype=any_string_dtype)
|
| 659 |
+
|
| 660 |
+
pattern_two_noname = r"([a-z])([0-9])"
|
| 661 |
+
extract_two_noname = s.str.extract(pattern_two_noname, expand=True)
|
| 662 |
+
has_multi_index = s.str.extractall(pattern_two_noname)
|
| 663 |
+
no_multi_index = has_multi_index.xs(0, level="match")
|
| 664 |
+
tm.assert_frame_equal(extract_two_noname, no_multi_index)
|
| 665 |
+
|
| 666 |
+
pattern_two_named = r"(?P<letter>[a-z])(?P<digit>[0-9])"
|
| 667 |
+
extract_two_named = s.str.extract(pattern_two_named, expand=True)
|
| 668 |
+
has_multi_index = s.str.extractall(pattern_two_named)
|
| 669 |
+
no_multi_index = has_multi_index.xs(0, level="match")
|
| 670 |
+
tm.assert_frame_equal(extract_two_named, no_multi_index)
|
| 671 |
+
|
| 672 |
+
pattern_one_named = r"(?P<group_name>[a-z])"
|
| 673 |
+
extract_one_named = s.str.extract(pattern_one_named, expand=True)
|
| 674 |
+
has_multi_index = s.str.extractall(pattern_one_named)
|
| 675 |
+
no_multi_index = has_multi_index.xs(0, level="match")
|
| 676 |
+
tm.assert_frame_equal(extract_one_named, no_multi_index)
|
| 677 |
+
|
| 678 |
+
pattern_one_noname = r"([a-z])"
|
| 679 |
+
extract_one_noname = s.str.extract(pattern_one_noname, expand=True)
|
| 680 |
+
has_multi_index = s.str.extractall(pattern_one_noname)
|
| 681 |
+
no_multi_index = has_multi_index.xs(0, level="match")
|
| 682 |
+
tm.assert_frame_equal(extract_one_noname, no_multi_index)
|
| 683 |
+
|
| 684 |
+
|
| 685 |
+
def test_extractall_same_as_extract_subject_index(any_string_dtype):
|
| 686 |
+
# same as above tests, but s has an MultiIndex.
|
| 687 |
+
mi = MultiIndex.from_tuples(
|
| 688 |
+
[("A", "first"), ("B", "second"), ("C", "third")],
|
| 689 |
+
names=("capital", "ordinal"),
|
| 690 |
+
)
|
| 691 |
+
s = Series(["a3", "b3", "c2"], index=mi, name="series_name", dtype=any_string_dtype)
|
| 692 |
+
|
| 693 |
+
pattern_two_noname = r"([a-z])([0-9])"
|
| 694 |
+
extract_two_noname = s.str.extract(pattern_two_noname, expand=True)
|
| 695 |
+
has_match_index = s.str.extractall(pattern_two_noname)
|
| 696 |
+
no_match_index = has_match_index.xs(0, level="match")
|
| 697 |
+
tm.assert_frame_equal(extract_two_noname, no_match_index)
|
| 698 |
+
|
| 699 |
+
pattern_two_named = r"(?P<letter>[a-z])(?P<digit>[0-9])"
|
| 700 |
+
extract_two_named = s.str.extract(pattern_two_named, expand=True)
|
| 701 |
+
has_match_index = s.str.extractall(pattern_two_named)
|
| 702 |
+
no_match_index = has_match_index.xs(0, level="match")
|
| 703 |
+
tm.assert_frame_equal(extract_two_named, no_match_index)
|
| 704 |
+
|
| 705 |
+
pattern_one_named = r"(?P<group_name>[a-z])"
|
| 706 |
+
extract_one_named = s.str.extract(pattern_one_named, expand=True)
|
| 707 |
+
has_match_index = s.str.extractall(pattern_one_named)
|
| 708 |
+
no_match_index = has_match_index.xs(0, level="match")
|
| 709 |
+
tm.assert_frame_equal(extract_one_named, no_match_index)
|
| 710 |
+
|
| 711 |
+
pattern_one_noname = r"([a-z])"
|
| 712 |
+
extract_one_noname = s.str.extract(pattern_one_noname, expand=True)
|
| 713 |
+
has_match_index = s.str.extractall(pattern_one_noname)
|
| 714 |
+
no_match_index = has_match_index.xs(0, level="match")
|
| 715 |
+
tm.assert_frame_equal(extract_one_noname, no_match_index)
|
| 716 |
+
|
| 717 |
+
|
| 718 |
+
def test_extractall_preserves_dtype():
|
| 719 |
+
# Ensure that when extractall is called on a series with specific dtypes set, that
|
| 720 |
+
# the dtype is preserved in the resulting DataFrame's column.
|
| 721 |
+
pa = pytest.importorskip("pyarrow")
|
| 722 |
+
|
| 723 |
+
result = Series(["abc", "ab"], dtype=ArrowDtype(pa.string())).str.extractall("(ab)")
|
| 724 |
+
assert result.dtypes[0] == "string[pyarrow]"
|
shared/package-files/2e/2ee356ffa2491a5a60bdf7d7febfac426824904738615a0c1d07aef6bda3b76f/blob
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# created by tools/loadICU.tcl -- do not edit
|
| 2 |
+
namespace eval ::tcl::clock {
|
| 3 |
+
::msgcat::mcset it_CH DATE_FORMAT "%e. %B %Y"
|
| 4 |
+
::msgcat::mcset it_CH TIME_FORMAT "%H:%M:%S"
|
| 5 |
+
::msgcat::mcset it_CH DATE_TIME_FORMAT "%e. %B %Y %H:%M:%S %z"
|
| 6 |
+
}
|
shared/package-files/2e/2ee441783df4613b7b64a908cb440f239714a0274391c154a613c5dcfe951e65/blob
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Dict, List, Optional, Union
|
| 2 |
+
|
| 3 |
+
from django.db.backends.base.client import BaseDatabaseClient
|
| 4 |
+
|
| 5 |
+
class DatabaseClient(BaseDatabaseClient):
|
| 6 |
+
executable_name: str = ...
|
| 7 |
+
@classmethod
|
| 8 |
+
def settings_to_cmd_args(
|
| 9 |
+
cls, settings_dict: Dict[str, Optional[Union[Dict[str, Dict[str, str]], int, str]]]
|
| 10 |
+
) -> List[str]: ...
|
| 11 |
+
def runshell(self) -> None: ...
|
shared/package-files/2e/2ee4f4c3ffc032d6b09ec04ca1b844316f60a76ca4d26039651cf0178e5cd142/blob
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from . import asciiTable
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class table_T_T_F_A_(asciiTable.asciiTable):
|
| 5 |
+
"""ttfautohint parameters table
|
| 6 |
+
|
| 7 |
+
The ``TTFA`` table is used by the free-software `ttfautohint` program
|
| 8 |
+
to record the parameters that `ttfautohint` was called with when it
|
| 9 |
+
was used to auto-hint the font.
|
| 10 |
+
|
| 11 |
+
See also http://freetype.org/ttfautohint/doc/ttfautohint.html#miscellaneous-1
|
| 12 |
+
"""
|
| 13 |
+
|
| 14 |
+
pass
|
shared/package-files/2e/2ee656f28f77559662edc6043f7d1dbca5939bb330d532e60ade546970f10898/blob
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER)
|
| 2 |
+
/*
|
| 3 |
+
* Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics,
|
| 4 |
+
* whether or not the build options for those features are specified.
|
| 5 |
+
* Therefore, we must test #definitions of CPU features when option native/host
|
| 6 |
+
* is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise
|
| 7 |
+
* the test will be broken and leads to enable all possible features.
|
| 8 |
+
*/
|
| 9 |
+
#ifndef __AVX__
|
| 10 |
+
#error "HOST/ARCH doesn't support AVX"
|
| 11 |
+
#endif
|
| 12 |
+
#endif
|
| 13 |
+
|
| 14 |
+
#include <immintrin.h>
|
| 15 |
+
|
| 16 |
+
int main(int argc, char **argv)
|
| 17 |
+
{
|
| 18 |
+
__m256 a = _mm256_add_ps(_mm256_loadu_ps((const float*)argv[argc-1]), _mm256_loadu_ps((const float*)argv[1]));
|
| 19 |
+
return (int)_mm_cvtss_f32(_mm256_castps256_ps128(a));
|
| 20 |
+
}
|
shared/package-files/2e/2ee70fb03381b96701b9b9e0a686dac6d4f43e356d81170f06725fed88f01d2c/blob
ADDED
|
Binary file (11.5 kB). View file
|
|
|
shared/package-files/2e/2ee7953a85601960c1c106fc385c1791529f567df708cd4b9307f5f80f3ab514/blob
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""macOS."""
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import os.path
|
| 5 |
+
|
| 6 |
+
from .api import PlatformDirsABC
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class MacOS(PlatformDirsABC):
|
| 10 |
+
"""
|
| 11 |
+
Platform directories for the macOS operating system. Follows the guidance from `Apple documentation
|
| 12 |
+
<https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html>`_.
|
| 13 |
+
Makes use of the `appname <platformdirs.api.PlatformDirsABC.appname>`,
|
| 14 |
+
`version <platformdirs.api.PlatformDirsABC.version>`,
|
| 15 |
+
`ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
|
| 16 |
+
"""
|
| 17 |
+
|
| 18 |
+
@property
|
| 19 |
+
def user_data_dir(self) -> str:
|
| 20 |
+
""":return: data directory tied to the user, e.g. ``~/Library/Application Support/$appname/$version``"""
|
| 21 |
+
return self._append_app_name_and_version(os.path.expanduser("~/Library/Application Support")) # noqa: PTH111
|
| 22 |
+
|
| 23 |
+
@property
|
| 24 |
+
def site_data_dir(self) -> str:
|
| 25 |
+
""":return: data directory shared by users, e.g. ``/Library/Application Support/$appname/$version``"""
|
| 26 |
+
return self._append_app_name_and_version("/Library/Application Support")
|
| 27 |
+
|
| 28 |
+
@property
|
| 29 |
+
def user_config_dir(self) -> str:
|
| 30 |
+
""":return: config directory tied to the user, same as `user_data_dir`"""
|
| 31 |
+
return self.user_data_dir
|
| 32 |
+
|
| 33 |
+
@property
|
| 34 |
+
def site_config_dir(self) -> str:
|
| 35 |
+
""":return: config directory shared by the users, same as `site_data_dir`"""
|
| 36 |
+
return self.site_data_dir
|
| 37 |
+
|
| 38 |
+
@property
|
| 39 |
+
def user_cache_dir(self) -> str:
|
| 40 |
+
""":return: cache directory tied to the user, e.g. ``~/Library/Caches/$appname/$version``"""
|
| 41 |
+
return self._append_app_name_and_version(os.path.expanduser("~/Library/Caches")) # noqa: PTH111
|
| 42 |
+
|
| 43 |
+
@property
|
| 44 |
+
def site_cache_dir(self) -> str:
|
| 45 |
+
""":return: cache directory shared by users, e.g. ``/Library/Caches/$appname/$version``"""
|
| 46 |
+
return self._append_app_name_and_version("/Library/Caches")
|
| 47 |
+
|
| 48 |
+
@property
|
| 49 |
+
def user_state_dir(self) -> str:
|
| 50 |
+
""":return: state directory tied to the user, same as `user_data_dir`"""
|
| 51 |
+
return self.user_data_dir
|
| 52 |
+
|
| 53 |
+
@property
|
| 54 |
+
def user_log_dir(self) -> str:
|
| 55 |
+
""":return: log directory tied to the user, e.g. ``~/Library/Logs/$appname/$version``"""
|
| 56 |
+
return self._append_app_name_and_version(os.path.expanduser("~/Library/Logs")) # noqa: PTH111
|
| 57 |
+
|
| 58 |
+
@property
|
| 59 |
+
def user_documents_dir(self) -> str:
|
| 60 |
+
""":return: documents directory tied to the user, e.g. ``~/Documents``"""
|
| 61 |
+
return os.path.expanduser("~/Documents") # noqa: PTH111
|
| 62 |
+
|
| 63 |
+
@property
|
| 64 |
+
def user_downloads_dir(self) -> str:
|
| 65 |
+
""":return: downloads directory tied to the user, e.g. ``~/Downloads``"""
|
| 66 |
+
return os.path.expanduser("~/Downloads") # noqa: PTH111
|
| 67 |
+
|
| 68 |
+
@property
|
| 69 |
+
def user_pictures_dir(self) -> str:
|
| 70 |
+
""":return: pictures directory tied to the user, e.g. ``~/Pictures``"""
|
| 71 |
+
return os.path.expanduser("~/Pictures") # noqa: PTH111
|
| 72 |
+
|
| 73 |
+
@property
|
| 74 |
+
def user_videos_dir(self) -> str:
|
| 75 |
+
""":return: videos directory tied to the user, e.g. ``~/Movies``"""
|
| 76 |
+
return os.path.expanduser("~/Movies") # noqa: PTH111
|
| 77 |
+
|
| 78 |
+
@property
|
| 79 |
+
def user_music_dir(self) -> str:
|
| 80 |
+
""":return: music directory tied to the user, e.g. ``~/Music``"""
|
| 81 |
+
return os.path.expanduser("~/Music") # noqa: PTH111
|
| 82 |
+
|
| 83 |
+
@property
|
| 84 |
+
def user_runtime_dir(self) -> str:
|
| 85 |
+
""":return: runtime directory tied to the user, e.g. ``~/Library/Caches/TemporaryItems/$appname/$version``"""
|
| 86 |
+
return self._append_app_name_and_version(os.path.expanduser("~/Library/Caches/TemporaryItems")) # noqa: PTH111
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
__all__ = [
|
| 90 |
+
"MacOS",
|
| 91 |
+
]
|
shared/package-files/2e/2ee8cbfb3974ecd0a735b3057ed88de45ab044b3125f2ae4c219f206df1c3ccb/blob
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 row_indices {
|
| 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::row_indices")
|
| 22 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
|
| 23 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "row_indices(Tensor(a) self) -> Tensor(a)")
|
| 24 |
+
static at::Tensor call(const at::Tensor & self);
|
| 25 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self);
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
}} // namespace at::_ops
|
shared/package-files/2e/2eed6198a6a99a5937fe377515c20f6eb9f3f3d595953342c18e3a0f84c56df1/blob
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import AnyStr, Generic, Iterable, List, Optional, Tuple, Union
|
| 2 |
+
|
| 3 |
+
from paramiko.util import ClosingContextManager
|
| 4 |
+
|
| 5 |
+
class BufferedFile(ClosingContextManager, Generic[AnyStr]):
|
| 6 |
+
SEEK_SET: int
|
| 7 |
+
SEEK_CUR: int
|
| 8 |
+
SEEK_END: int
|
| 9 |
+
|
| 10 |
+
FLAG_READ: int
|
| 11 |
+
FLAG_WRITE: int
|
| 12 |
+
FLAG_APPEND: int
|
| 13 |
+
FLAG_BINARY: int
|
| 14 |
+
FLAG_BUFFERED: int
|
| 15 |
+
FLAG_LINE_BUFFERED: int
|
| 16 |
+
FLAG_UNIVERSAL_NEWLINE: int
|
| 17 |
+
|
| 18 |
+
newlines: Union[None, AnyStr, Tuple[AnyStr, ...]]
|
| 19 |
+
def __init__(self) -> None: ...
|
| 20 |
+
def __del__(self) -> None: ...
|
| 21 |
+
def __iter__(self) -> BufferedFile: ...
|
| 22 |
+
def close(self) -> None: ...
|
| 23 |
+
def flush(self) -> None: ...
|
| 24 |
+
def __next__(self) -> AnyStr: ...
|
| 25 |
+
def readable(self) -> bool: ...
|
| 26 |
+
def writable(self) -> bool: ...
|
| 27 |
+
def seekable(self) -> bool: ...
|
| 28 |
+
def readinto(self, buff: bytearray) -> int: ...
|
| 29 |
+
def read(self, size: Optional[int] = ...) -> AnyStr: ...
|
| 30 |
+
def readline(self, size: Optional[int] = ...) -> AnyStr: ...
|
| 31 |
+
def readlines(self, sizehint: Optional[int] = ...) -> List[AnyStr]: ...
|
| 32 |
+
def seek(self, offset: int, whence: int = ...) -> None: ...
|
| 33 |
+
def tell(self) -> int: ...
|
| 34 |
+
def write(self, data: AnyStr) -> None: ...
|
| 35 |
+
def writelines(self, sequence: Iterable[AnyStr]) -> None: ...
|
| 36 |
+
def xreadlines(self) -> BufferedFile: ...
|
| 37 |
+
@property
|
| 38 |
+
def closed(self) -> bool: ...
|
shared/package-files/2e/2eed95d9d64b0c4dcd8a7ebf8476d10ba5762f6eefeaf35c3f44abc9f45f8fb6/blob
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/tensorexpr/kernel.h>
|
| 4 |
+
|
| 5 |
+
namespace torch {
|
| 6 |
+
namespace jit {
|
| 7 |
+
namespace tensorexpr {
|
| 8 |
+
|
| 9 |
+
Tensor computeMatmul(
|
| 10 |
+
const std::vector<ArgValue>& inputs,
|
| 11 |
+
const std::vector<ExprHandle>& outputShape,
|
| 12 |
+
const std::vector<ExprHandle>& outputStrides,
|
| 13 |
+
const c10::optional<ScalarType>& outputType,
|
| 14 |
+
at::Device device);
|
| 15 |
+
Tensor computeAddMM(
|
| 16 |
+
const std::vector<ArgValue>& inputs,
|
| 17 |
+
const std::vector<ExprHandle>& outputShape,
|
| 18 |
+
const std::vector<ExprHandle>& outputStrides,
|
| 19 |
+
const c10::optional<ScalarType>& outputType,
|
| 20 |
+
at::Device device);
|
| 21 |
+
|
| 22 |
+
} // namespace tensorexpr
|
| 23 |
+
} // namespace jit
|
| 24 |
+
} // namespace torch
|
shared/package-files/2e/2eee023a23bca6fcc91e7cbd517a975efeaff648fa41ce8fbc2b0976dba35c7a/blob
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from torch.ao.nn.intrinsic.quantized import BNReLU2d
|
| 2 |
+
from torch.ao.nn.intrinsic.quantized import BNReLU3d
|
| 3 |
+
|
| 4 |
+
__all__ = [
|
| 5 |
+
'BNReLU2d',
|
| 6 |
+
'BNReLU3d',
|
| 7 |
+
]
|
shared/package-files/2e/2ef4c53f7fe3a7267b835cffebe135d5227ca23ad5243f61cf4a4427b55500dc/blob
ADDED
|
Binary file (888 Bytes). View file
|
|
|
shared/package-files/2e/2ef68fc1f8ccdabef7c89c1330dbb54a20cacd65aace12418cdfe48af9d8b32a/blob
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|