Publish 11 evaluated Astra histories with reproducible checkpoint artifacts (part 33)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +29 -0
- shared/package-files/9b/9b0e6d6337bf04cb3aba018465f83999c5e8227198767edfbd20984948bd06ac/blob +1429 -0
- shared/package-files/9b/9b0ff4cbf4f33264cfdb0515fe87c0c1c8a1d11ff29a1524401ac7063f64fe03/blob +324 -0
- shared/package-files/9b/9b105adfedc6b6b82f4695ca9bfe232393034cdf79803523f397a6dc5bf824d1/blob +0 -0
- shared/package-files/9b/9b1066af79ac4795bb4446ba33581ace72de0ee3bd979905840badd5598bda7a/blob +28 -0
- shared/package-files/9b/9b110614ea0eefae7c0d74748c47bf4ed50dd144a134754cef1a24705b9fb377/blob +11 -0
- shared/package-files/9b/9b149709fc0432cdc59b496b4e33cc35dafc99321bf7afd9092fe0400027a576/blob +39 -0
- shared/package-files/9b/9b14c96a807865ee74964fb64e0568a66aeb6ee41b12a52c6707372b51fcc3e4/blob +118 -0
- shared/package-files/9b/9b152deb0e3d095c45b1ce7937e25dc5c1d9e3aaf9bee11eb5b5444f590ab862/model.pt +3 -0
- shared/package-files/9b/9b156a37c540d4ea39994bad9664abd0a4bd57acfa72ffec72409c36a4532f2c/blob +3 -0
- shared/package-files/9b/9b15c668d6a6afe9d1ce1a3f5571f71da43266871a1cd698fb4913043d6d8c24/blob +24 -0
- shared/package-files/9b/9b16504660713d61693f7c7ebfe677239a640f93fc572807f3739fba203a2cdd/blob +468 -0
- shared/package-files/9b/9b1676a9f2beda4d06310328bd464e716ce1fd334045af3425b820b172c51c83/blob +163 -0
- shared/package-files/9b/9b16c7223d8223a77cbb4db2ee2fcc0dc2008526d6d3256a2e2fb3f2a95820fe/blob +3 -0
- shared/package-files/9b/9b17a60c7c785a7977fa093caca7705eb5730377a032a677f0500e979e459679/blob +123 -0
- shared/package-files/9b/9b18078f5451cc903075e2ffd8a901d0db1e90d593b42adae53ee8664882709f/blob +39 -0
- shared/package-files/9b/9b185eeba218c0a82e52dc46741cc08f676740e184182013738b2589c1fe99cb/blob +3 -0
- shared/package-files/9b/9b191f143dab35f83c9e7d69a7fe35dd2d2e09d617c9d3d605ccfd8a5806900d/blob +30 -0
- shared/package-files/9b/9b19609c87d0a3fecb06f22824bc0f37d67a64ad4847019250d0ff2509d160d0/blob +25 -0
- shared/package-files/9b/9b19d299da335885dc0cb64dcc28a6f809d3c9e82d9c09c43b9058eb4dc332c1/ring_fragments.py +42 -0
- shared/package-files/9b/9b218384eec238b9a6a2e721b23454e7b950a579c96a1cea69f7d79b26b8afa7/blob +12 -0
- shared/package-files/9b/9b23374ef43c10d49db0b72110877569dbd906b56d2c6747ef951c3c3152e868/blob +522 -0
- shared/package-files/9b/9b27bd125063a5d81de94b64d9628603c25d7ad3736eb823440180d76271bf83/blob +23 -0
- shared/package-files/9b/9b2824a306502b0a6f1290bd19fd1fcd2869bb52c21a5c33a1bc9480da5752dd/blob +413 -0
- shared/package-files/9b/9b29fc93ae95aef6672fa47a556e880cf4df3baf15c636c9f14a7922e4a314be/blob +88 -0
- shared/package-files/9b/9b2c1a62c96e69385c72c6f7d5499d217c1773c48436f016e83412ea582aace6/blob +57 -0
- shared/package-files/9b/9b2e55e0f1d3df31cb2b442f6a712a427eb98c9e7f9cd572eae97fd301d14f5f/blob +140 -0
- shared/package-files/9b/9b2f91be34024fbcf645f6ef92460e5f944ca6a16268b79478ab904b2934d357/blob +52 -0
- shared/package-files/9b/9b2ff15cb3d217ce7ef0b06547f16743aef6d5363072c505bff85d03e769596e/blob +360 -0
- shared/package-files/9b/9b34108030dba74e01d372b226ba2cb0ba7c62aef6449ce3a7edc0adf8db307f/blob +188 -0
- shared/package-files/9b/9b3bb70cade8184ee8eca3239aa7e6762ad6be906e15e8ea42ed5629b8abdafa/blob +200 -0
- shared/package-files/9b/9b3e92596047cab99a939229b56d656a7862d617eacf9291d7fa6f6c95f80e36/blob +570 -0
- shared/package-files/9b/9b45a809e914c434a5fedb1bcfe7f9bd9ee4471fd5d828bcafa59cd50b502507/blob +884 -0
- shared/package-files/9b/9b484599c4f3bd9f2c65b6e759e10dc332b2b9fa44f735b0651f96088e247695/blob +113 -0
- shared/package-files/9b/9b4b2ab4ef7b3c4bfcfff6eca7136078b7c168c81adab9d952790797eea37249/blob +63 -0
- shared/package-files/9b/9b4d6e6e077c5be4e16cbf790138fb75158aea70027ab99005cd0cac43cf42bf/blob +68 -0
- shared/package-files/9b/9b4fa9e614c6536132eee050ac1ecb48f813bd2d02f05afe480f5dd81017e8c9/blob +687 -0
- shared/package-files/9b/9b542cdd392345b80afdab68e0f7056548da6fee5a1315a7bf918d1b54bd957b/blob +11 -0
- shared/package-files/9b/9b5b3703806bbd17835f93e58836a5639dd884f7ef875b3ec7879f6b57e521a1/blob +95 -0
- shared/package-files/9b/9b62149e65ae88c6dd4da6bc3fd68cac9355d5be78045d9faf3270495fdc5451/blob +160 -0
- shared/package-files/9b/9b633e2d6aa5d803d19bb099de8163f7b49408a1bfaea3fe3e7d519e15dda808/blob +50 -0
- shared/package-files/9b/9b65eeebf6d708da9966136f37d3d3eef925cdce7587f22da457eeee1f8ba83e/blob +557 -0
- shared/package-files/9b/9b66f7e1cf75ec85b9a3e43fe936081e5b0af6549494d8b2ac84d3507ff3c1ec/blob +353 -0
- shared/package-files/9b/9b6742f1d21425a930997735c01c838096af851948a118f4923bade4c777e9e7/blob +24 -0
- shared/package-files/9b/9b6cdb3f80bbf7a16f415b15566b175028b3f0fae3d8efa94f9e6b6c70363700/blob +25 -0
- shared/package-files/9b/9b6d58df002d41cfa38ba55e6fa93f33983a034672148e1e81c853767c21fa94/blob +11 -0
- shared/package-files/9b/9b6e400eb85440ec64ab66b4ac111546585740c9ca61fd156400d7153cbad9f4/blob +335 -0
- shared/package-files/9b/9b6fd8df3c9d5193733e9bbcf27f303cd5aa6b17da01330a128ff30205ccab26/blob +166 -0
- shared/package-files/9b/9b717166deba6db15d053b26793d1c34c4a756495065bafecb0657dd9461794f/blob +57 -0
- shared/package-files/9b/9b7207dba4c2ccb0e94bc72dbf324a2c0f31e35e2eaf98e55f7b1d4f8b01e26f/blob +50 -0
.gitattributes
CHANGED
|
@@ -718,3 +718,32 @@ shared/package-files/99/998fef1dd6b7136df657284a08466c5be4c05ff233fd661a445ab5d6
|
|
| 718 |
shared/package-files/99/99acc1ddb4b5e74695bb8c19520ce6daa6f54afe1a03b420a38597979c29cf96/blob filter=lfs diff=lfs merge=lfs -text
|
| 719 |
shared/package-files/9a/9af2493792b640a5019720c3d6fae7fcb63d6e502cf7b43782374df87061b6d2/blob filter=lfs diff=lfs merge=lfs -text
|
| 720 |
shared/package-files/9b/9b0619ffc84440db3692b21c6de5e750acc668490c4ba38610192bb3553343b5/blob filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 718 |
shared/package-files/99/99acc1ddb4b5e74695bb8c19520ce6daa6f54afe1a03b420a38597979c29cf96/blob filter=lfs diff=lfs merge=lfs -text
|
| 719 |
shared/package-files/9a/9af2493792b640a5019720c3d6fae7fcb63d6e502cf7b43782374df87061b6d2/blob filter=lfs diff=lfs merge=lfs -text
|
| 720 |
shared/package-files/9b/9b0619ffc84440db3692b21c6de5e750acc668490c4ba38610192bb3553343b5/blob filter=lfs diff=lfs merge=lfs -text
|
| 721 |
+
shared/package-files/9b/9b156a37c540d4ea39994bad9664abd0a4bd57acfa72ffec72409c36a4532f2c/blob filter=lfs diff=lfs merge=lfs -text
|
| 722 |
+
shared/package-files/9b/9b16c7223d8223a77cbb4db2ee2fcc0dc2008526d6d3256a2e2fb3f2a95820fe/blob filter=lfs diff=lfs merge=lfs -text
|
| 723 |
+
shared/package-files/9b/9b185eeba218c0a82e52dc46741cc08f676740e184182013738b2589c1fe99cb/blob filter=lfs diff=lfs merge=lfs -text
|
| 724 |
+
shared/package-files/9b/9b73f686d2ddb70d184f449d22d666b0a1ea63797ad578875be8245c4efa817e/blob filter=lfs diff=lfs merge=lfs -text
|
| 725 |
+
shared/package-files/9c/9c5d4a71ea3cf87a657612cc682a348304d22d0458ff270f0695aeaf9388a2aa/blob filter=lfs diff=lfs merge=lfs -text
|
| 726 |
+
shared/package-files/9c/9c8f332f0979366cc303a064494a5e1538bd5859013021e7e6901ac47548cf9f/blob filter=lfs diff=lfs merge=lfs -text
|
| 727 |
+
shared/package-files/9d/9d75321ee95050c17ee5243dd85bb792a35ef9e24d33e9f0a8e87453afe397fb/blob filter=lfs diff=lfs merge=lfs -text
|
| 728 |
+
shared/package-files/9d/9daa832cd9158824f01bbccaf05916cb941f548fa6bedefc3257fca7ca81fd02/blob filter=lfs diff=lfs merge=lfs -text
|
| 729 |
+
shared/package-files/9e/9e37252bab966a08b28b2f6f5e4400812fcdfd0355cb307230ac59a2a57847cc/blob filter=lfs diff=lfs merge=lfs -text
|
| 730 |
+
shared/package-files/9e/9e580e6e2aede262d752c93d6e3f25ae62b3bd8fdb92764ac53297bc8e97642c/blob filter=lfs diff=lfs merge=lfs -text
|
| 731 |
+
shared/package-files/9e/9e7299a7432e9a547825e22403aeac2260f98cca8336c69f213120527273a9e9/blob filter=lfs diff=lfs merge=lfs -text
|
| 732 |
+
shared/package-files/9e/9e76d8350e857eba01bcd350d267300f0f924f152c0f486f21bfb46178ab071a/blob filter=lfs diff=lfs merge=lfs -text
|
| 733 |
+
shared/package-files/9e/9ea0a9db09e8e6688e31eb05f151e16da850fc93f94574f6d72b06f596717889/blob filter=lfs diff=lfs merge=lfs -text
|
| 734 |
+
shared/package-files/9e/9ea3b595a1060ba582a495c81145da0ef01e092303974cce944d5dffa42e9deb/blob filter=lfs diff=lfs merge=lfs -text
|
| 735 |
+
shared/package-files/9e/9ecd558955082ec491fe4f93fe8f816702b0bb14b25553c26ccafcb8a57f5ee2/blob filter=lfs diff=lfs merge=lfs -text
|
| 736 |
+
shared/package-files/9e/9ed4b4373dce636ead027ad1db453ba4788d4db0e6ab7f38f189b3eabe6810bc/blob filter=lfs diff=lfs merge=lfs -text
|
| 737 |
+
shared/package-files/9e/9ed8b3e7c98810034cc77adfbd8ce318397f0adc944db4364d7dd63e4b05ee27/blob filter=lfs diff=lfs merge=lfs -text
|
| 738 |
+
shared/package-files/9f/9f24f334e5a0a152c73c36a7cdb8e7c77c1c8a47e6195a59ac7428ed04ea006a/blob filter=lfs diff=lfs merge=lfs -text
|
| 739 |
+
shared/package-files/9f/9fa802bd46564846ee1d22e5ee7afa55da41d774b55ce3d85759171f8d76f2bd/blob filter=lfs diff=lfs merge=lfs -text
|
| 740 |
+
shared/package-files/9f/9faa58d24167d58a5cd87235f0727540ae015e8ada86d16df5ab0efb95153c52/blob filter=lfs diff=lfs merge=lfs -text
|
| 741 |
+
shared/package-files/a0/a0381910c322639fa56d516170f1497a8ebf92365c14ae478447b9aa257cfe55/blob filter=lfs diff=lfs merge=lfs -text
|
| 742 |
+
shared/package-files/a0/a076c9c834d073f49c19eaacf3021d247342088a7622153a0671aa2cf5d0abfd/blob filter=lfs diff=lfs merge=lfs -text
|
| 743 |
+
shared/package-files/a1/a13dad3c4f0cd7a1917d5b6763b27aaf3d38f3b7d775e747b61241ea36b681e0/blob filter=lfs diff=lfs merge=lfs -text
|
| 744 |
+
shared/package-files/a1/a14c7ed45816ea9c2404967c7b302ff4c3b181d5a547d4a47714c4dbd00a6b07/blob filter=lfs diff=lfs merge=lfs -text
|
| 745 |
+
shared/package-files/a1/a167fb78147766d380f75393bdd790258a2cd5a9f9ea6b06b09c2118e6a7de5a/blob filter=lfs diff=lfs merge=lfs -text
|
| 746 |
+
shared/package-files/a1/a16a23abdb9d9e88968ffe09beea9eccc9f9dcee84dbc61660b6bab1a83f0728/blob filter=lfs diff=lfs merge=lfs -text
|
| 747 |
+
shared/package-files/a1/a19740619863873a7fbece730f37e8c577889aab3ac5bfc303a09ac4868cf090/blob filter=lfs diff=lfs merge=lfs -text
|
| 748 |
+
shared/package-files/a1/a1e7d0bb7e8168c32be5773a7bae2fedd3e926237cbcd36cfe26b44b0f40e160/blob filter=lfs diff=lfs merge=lfs -text
|
| 749 |
+
shared/package-files/a2/a20bb2a7d5f35f2a502756822e79a2ecc09f43473ef17f1468e0cce7b42baecf/blob filter=lfs diff=lfs merge=lfs -text
|
shared/package-files/9b/9b0e6d6337bf04cb3aba018465f83999c5e8227198767edfbd20984948bd06ac/blob
ADDED
|
@@ -0,0 +1,1429 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
dtype,input,output,ulperrortol
|
| 2 |
+
np.float32,0x3f338252,0x3f1c8d9c,3
|
| 3 |
+
np.float32,0x7e569df2,0x3fc90fdb,3
|
| 4 |
+
np.float32,0xbf347e25,0xbf1d361f,3
|
| 5 |
+
np.float32,0xbf0a654e,0xbefdbfd2,3
|
| 6 |
+
np.float32,0x8070968e,0x8070968e,3
|
| 7 |
+
np.float32,0x803cfb27,0x803cfb27,3
|
| 8 |
+
np.float32,0x8024362e,0x8024362e,3
|
| 9 |
+
np.float32,0xfd55dca0,0xbfc90fdb,3
|
| 10 |
+
np.float32,0x592b82,0x592b82,3
|
| 11 |
+
np.float32,0x802eb8e1,0x802eb8e1,3
|
| 12 |
+
np.float32,0xbc5fef40,0xbc5febae,3
|
| 13 |
+
np.float32,0x3f1f6ce8,0x3f0e967c,3
|
| 14 |
+
np.float32,0x20bedc,0x20bedc,3
|
| 15 |
+
np.float32,0xbf058860,0xbef629c7,3
|
| 16 |
+
np.float32,0x311504,0x311504,3
|
| 17 |
+
np.float32,0xbd23f560,0xbd23defa,3
|
| 18 |
+
np.float32,0x800ff4e8,0x800ff4e8,3
|
| 19 |
+
np.float32,0x355009,0x355009,3
|
| 20 |
+
np.float32,0x3f7be42e,0x3f46fdb3,3
|
| 21 |
+
np.float32,0xbf225f7c,0xbf10b364,3
|
| 22 |
+
np.float32,0x8074fa9e,0x8074fa9e,3
|
| 23 |
+
np.float32,0xbea4b418,0xbe9f59ce,3
|
| 24 |
+
np.float32,0xbe909c14,0xbe8cf045,3
|
| 25 |
+
np.float32,0x80026bee,0x80026bee,3
|
| 26 |
+
np.float32,0x3d789c20,0x3d784e25,3
|
| 27 |
+
np.float32,0x7f56a4ba,0x3fc90fdb,3
|
| 28 |
+
np.float32,0xbf70d141,0xbf413db7,3
|
| 29 |
+
np.float32,0xbf2c4886,0xbf17a505,3
|
| 30 |
+
np.float32,0x7e2993bf,0x3fc90fdb,3
|
| 31 |
+
np.float32,0xbe2c8a30,0xbe2aef28,3
|
| 32 |
+
np.float32,0x803f82d9,0x803f82d9,3
|
| 33 |
+
np.float32,0x3f062fbc,0x3ef730a1,3
|
| 34 |
+
np.float32,0x3f349ee0,0x3f1d4bfa,3
|
| 35 |
+
np.float32,0x3eccfb69,0x3ec2f9e8,3
|
| 36 |
+
np.float32,0x7e8a85dd,0x3fc90fdb,3
|
| 37 |
+
np.float32,0x25331,0x25331,3
|
| 38 |
+
np.float32,0x464f19,0x464f19,3
|
| 39 |
+
np.float32,0x8035c818,0x8035c818,3
|
| 40 |
+
np.float32,0x802e5799,0x802e5799,3
|
| 41 |
+
np.float32,0x64e1c0,0x64e1c0,3
|
| 42 |
+
np.float32,0x701cc2,0x701cc2,3
|
| 43 |
+
np.float32,0x265c57,0x265c57,3
|
| 44 |
+
np.float32,0x807a053f,0x807a053f,3
|
| 45 |
+
np.float32,0x3bd2c412,0x3bd2c354,3
|
| 46 |
+
np.float32,0xff28f1c8,0xbfc90fdb,3
|
| 47 |
+
np.float32,0x7f08f08b,0x3fc90fdb,3
|
| 48 |
+
np.float32,0x800c50e4,0x800c50e4,3
|
| 49 |
+
np.float32,0x369674,0x369674,3
|
| 50 |
+
np.float32,0xbf5b7db3,0xbf3571bf,3
|
| 51 |
+
np.float32,0x7edcf5e2,0x3fc90fdb,3
|
| 52 |
+
np.float32,0x800e5d4b,0x800e5d4b,3
|
| 53 |
+
np.float32,0x80722554,0x80722554,3
|
| 54 |
+
np.float32,0x693f33,0x693f33,3
|
| 55 |
+
np.float32,0x800844e4,0x800844e4,3
|
| 56 |
+
np.float32,0xbf111b82,0xbf0402ec,3
|
| 57 |
+
np.float32,0x7df9c9ac,0x3fc90fdb,3
|
| 58 |
+
np.float32,0xbf6619a6,0xbf3b6f57,3
|
| 59 |
+
np.float32,0x8002fafe,0x8002fafe,3
|
| 60 |
+
np.float32,0xfe1e67f8,0xbfc90fdb,3
|
| 61 |
+
np.float32,0x3f7f4bf8,0x3f48b5b7,3
|
| 62 |
+
np.float32,0x7f017b20,0x3fc90fdb,3
|
| 63 |
+
np.float32,0x2d9b07,0x2d9b07,3
|
| 64 |
+
np.float32,0x803aa174,0x803aa174,3
|
| 65 |
+
np.float32,0x7d530336,0x3fc90fdb,3
|
| 66 |
+
np.float32,0x80662195,0x80662195,3
|
| 67 |
+
np.float32,0xfd5ebcf0,0xbfc90fdb,3
|
| 68 |
+
np.float32,0xbe7b8dcc,0xbe76ab59,3
|
| 69 |
+
np.float32,0x7f2bacaf,0x3fc90fdb,3
|
| 70 |
+
np.float32,0x3f194fc4,0x3f0a229e,3
|
| 71 |
+
np.float32,0x7ee21cdf,0x3fc90fdb,3
|
| 72 |
+
np.float32,0x3f5a17fc,0x3f34a307,3
|
| 73 |
+
np.float32,0x7f100c58,0x3fc90fdb,3
|
| 74 |
+
np.float32,0x7e9128f5,0x3fc90fdb,3
|
| 75 |
+
np.float32,0xbf2107c6,0xbf0fbdb4,3
|
| 76 |
+
np.float32,0xbd29c800,0xbd29af22,3
|
| 77 |
+
np.float32,0xbf5af499,0xbf3522a6,3
|
| 78 |
+
np.float32,0x801bde44,0x801bde44,3
|
| 79 |
+
np.float32,0xfeb4761a,0xbfc90fdb,3
|
| 80 |
+
np.float32,0x3d88aa1b,0x3d887650,3
|
| 81 |
+
np.float32,0x7eba5e0b,0x3fc90fdb,3
|
| 82 |
+
np.float32,0x803906bd,0x803906bd,3
|
| 83 |
+
np.float32,0x80101512,0x80101512,3
|
| 84 |
+
np.float32,0x7e898f83,0x3fc90fdb,3
|
| 85 |
+
np.float32,0x806406d3,0x806406d3,3
|
| 86 |
+
np.float32,0x7ed20fc0,0x3fc90fdb,3
|
| 87 |
+
np.float32,0x20827d,0x20827d,3
|
| 88 |
+
np.float32,0x3f361359,0x3f1e43fe,3
|
| 89 |
+
np.float32,0xfe4ef8d8,0xbfc90fdb,3
|
| 90 |
+
np.float32,0x805e7d2d,0x805e7d2d,3
|
| 91 |
+
np.float32,0xbe4316b0,0xbe40c745,3
|
| 92 |
+
np.float32,0xbf0a1c06,0xbefd4e5a,3
|
| 93 |
+
np.float32,0x3e202860,0x3e1edee1,3
|
| 94 |
+
np.float32,0xbeb32a2c,0xbeac5899,3
|
| 95 |
+
np.float32,0xfe528838,0xbfc90fdb,3
|
| 96 |
+
np.float32,0x2f73e2,0x2f73e2,3
|
| 97 |
+
np.float32,0xbe16e010,0xbe15cc27,3
|
| 98 |
+
np.float32,0x3f50d6c5,0x3f2f2d75,3
|
| 99 |
+
np.float32,0xbe88a6a2,0xbe8589c7,3
|
| 100 |
+
np.float32,0x3ee36060,0x3ed5fb36,3
|
| 101 |
+
np.float32,0x6c978b,0x6c978b,3
|
| 102 |
+
np.float32,0x7f1b735f,0x3fc90fdb,3
|
| 103 |
+
np.float32,0x3dad8256,0x3dad1885,3
|
| 104 |
+
np.float32,0x807f5094,0x807f5094,3
|
| 105 |
+
np.float32,0x65c358,0x65c358,3
|
| 106 |
+
np.float32,0xff315ce4,0xbfc90fdb,3
|
| 107 |
+
np.float32,0x7411a6,0x7411a6,3
|
| 108 |
+
np.float32,0x80757b04,0x80757b04,3
|
| 109 |
+
np.float32,0x3eec73a6,0x3edd82f4,3
|
| 110 |
+
np.float32,0xfe9f69e8,0xbfc90fdb,3
|
| 111 |
+
np.float32,0x801f4fa8,0x801f4fa8,3
|
| 112 |
+
np.float32,0xbf6f2fae,0xbf405f79,3
|
| 113 |
+
np.float32,0xfea206b6,0xbfc90fdb,3
|
| 114 |
+
np.float32,0x3f257301,0x3f12e1ee,3
|
| 115 |
+
np.float32,0x7ea6a506,0x3fc90fdb,3
|
| 116 |
+
np.float32,0x80800000,0x80800000,3
|
| 117 |
+
np.float32,0xff735c2d,0xbfc90fdb,3
|
| 118 |
+
np.float32,0x80197f95,0x80197f95,3
|
| 119 |
+
np.float32,0x7f4a354f,0x3fc90fdb,3
|
| 120 |
+
np.float32,0xff320c00,0xbfc90fdb,3
|
| 121 |
+
np.float32,0x3f2659de,0x3f138484,3
|
| 122 |
+
np.float32,0xbe5451bc,0xbe515a52,3
|
| 123 |
+
np.float32,0x3f6e228c,0x3f3fcf7c,3
|
| 124 |
+
np.float32,0x66855a,0x66855a,3
|
| 125 |
+
np.float32,0x8034b3a3,0x8034b3a3,3
|
| 126 |
+
np.float32,0xbe21a2fc,0xbe20505d,3
|
| 127 |
+
np.float32,0x7f79e2dc,0x3fc90fdb,3
|
| 128 |
+
np.float32,0xbe19a8e0,0xbe18858c,3
|
| 129 |
+
np.float32,0x10802c,0x10802c,3
|
| 130 |
+
np.float32,0xfeee579e,0xbfc90fdb,3
|
| 131 |
+
np.float32,0x3f3292c8,0x3f1becc0,3
|
| 132 |
+
np.float32,0xbf595a71,0xbf34350a,3
|
| 133 |
+
np.float32,0xbf7c3373,0xbf4725f4,3
|
| 134 |
+
np.float32,0xbdd30938,0xbdd24b36,3
|
| 135 |
+
np.float32,0x153a17,0x153a17,3
|
| 136 |
+
np.float32,0x807282a0,0x807282a0,3
|
| 137 |
+
np.float32,0xfe817322,0xbfc90fdb,3
|
| 138 |
+
np.float32,0x3f1b3628,0x3f0b8771,3
|
| 139 |
+
np.float32,0x41be8f,0x41be8f,3
|
| 140 |
+
np.float32,0x7f4a8343,0x3fc90fdb,3
|
| 141 |
+
np.float32,0x3dc4ea2b,0x3dc44fae,3
|
| 142 |
+
np.float32,0x802aac25,0x802aac25,3
|
| 143 |
+
np.float32,0xbf20e1d7,0xbf0fa284,3
|
| 144 |
+
np.float32,0xfd91a1b0,0xbfc90fdb,3
|
| 145 |
+
np.float32,0x3f0d5476,0x3f012265,3
|
| 146 |
+
np.float32,0x21c916,0x21c916,3
|
| 147 |
+
np.float32,0x807df399,0x807df399,3
|
| 148 |
+
np.float32,0x7e207b4c,0x3fc90fdb,3
|
| 149 |
+
np.float32,0x8055f8ff,0x8055f8ff,3
|
| 150 |
+
np.float32,0x7edf3b01,0x3fc90fdb,3
|
| 151 |
+
np.float32,0x803a8df3,0x803a8df3,3
|
| 152 |
+
np.float32,0x3ce3b002,0x3ce3a101,3
|
| 153 |
+
np.float32,0x3f62dd54,0x3f39a248,3
|
| 154 |
+
np.float32,0xff33ae10,0xbfc90fdb,3
|
| 155 |
+
np.float32,0x7e3de69d,0x3fc90fdb,3
|
| 156 |
+
np.float32,0x8024581e,0x8024581e,3
|
| 157 |
+
np.float32,0xbf4ac99d,0xbf2b807a,3
|
| 158 |
+
np.float32,0x3f157d19,0x3f074d8c,3
|
| 159 |
+
np.float32,0xfed383f4,0xbfc90fdb,3
|
| 160 |
+
np.float32,0xbf5a39fa,0xbf34b6b8,3
|
| 161 |
+
np.float32,0x800d757d,0x800d757d,3
|
| 162 |
+
np.float32,0x807d606b,0x807d606b,3
|
| 163 |
+
np.float32,0x3e828f89,0x3e7fac2d,3
|
| 164 |
+
np.float32,0x7a6604,0x7a6604,3
|
| 165 |
+
np.float32,0x7dc7e72b,0x3fc90fdb,3
|
| 166 |
+
np.float32,0x80144146,0x80144146,3
|
| 167 |
+
np.float32,0x7c2eed69,0x3fc90fdb,3
|
| 168 |
+
np.float32,0x3f5b4d8c,0x3f3555fc,3
|
| 169 |
+
np.float32,0xfd8b7778,0xbfc90fdb,3
|
| 170 |
+
np.float32,0xfc9d9140,0xbfc90fdb,3
|
| 171 |
+
np.float32,0xbea265d4,0xbe9d4232,3
|
| 172 |
+
np.float32,0xbe9344d0,0xbe8f65da,3
|
| 173 |
+
np.float32,0x3f71f19a,0x3f41d65b,3
|
| 174 |
+
np.float32,0x804a3f59,0x804a3f59,3
|
| 175 |
+
np.float32,0x3e596290,0x3e563476,3
|
| 176 |
+
np.float32,0x3e994ee4,0x3e94f546,3
|
| 177 |
+
np.float32,0xbc103e00,0xbc103d0c,3
|
| 178 |
+
np.float32,0xbf1cd896,0xbf0cb889,3
|
| 179 |
+
np.float32,0x7f52b080,0x3fc90fdb,3
|
| 180 |
+
np.float32,0xff584452,0xbfc90fdb,3
|
| 181 |
+
np.float32,0x58b26b,0x58b26b,3
|
| 182 |
+
np.float32,0x3f23cd4c,0x3f11b799,3
|
| 183 |
+
np.float32,0x707d7,0x707d7,3
|
| 184 |
+
np.float32,0xff732cff,0xbfc90fdb,3
|
| 185 |
+
np.float32,0x3e41c2a6,0x3e3f7f0f,3
|
| 186 |
+
np.float32,0xbf7058e9,0xbf40fdcf,3
|
| 187 |
+
np.float32,0x7dca9857,0x3fc90fdb,3
|
| 188 |
+
np.float32,0x7f0eb44b,0x3fc90fdb,3
|
| 189 |
+
np.float32,0x8000405c,0x8000405c,3
|
| 190 |
+
np.float32,0x4916ab,0x4916ab,3
|
| 191 |
+
np.float32,0x4811a8,0x4811a8,3
|
| 192 |
+
np.float32,0x3d69bf,0x3d69bf,3
|
| 193 |
+
np.float32,0xfeadcf1e,0xbfc90fdb,3
|
| 194 |
+
np.float32,0x3e08dbbf,0x3e080d58,3
|
| 195 |
+
np.float32,0xff031f88,0xbfc90fdb,3
|
| 196 |
+
np.float32,0xbe09cab8,0xbe08f818,3
|
| 197 |
+
np.float32,0x21d7cd,0x21d7cd,3
|
| 198 |
+
np.float32,0x3f23230d,0x3f113ea9,3
|
| 199 |
+
np.float32,0x7e8a48d4,0x3fc90fdb,3
|
| 200 |
+
np.float32,0x413869,0x413869,3
|
| 201 |
+
np.float32,0x7e832990,0x3fc90fdb,3
|
| 202 |
+
np.float32,0x800f5c09,0x800f5c09,3
|
| 203 |
+
np.float32,0x7f5893b6,0x3fc90fdb,3
|
| 204 |
+
np.float32,0x7f06b5b1,0x3fc90fdb,3
|
| 205 |
+
np.float32,0xbe1cbee8,0xbe1b89d6,3
|
| 206 |
+
np.float32,0xbf279f14,0xbf1468a8,3
|
| 207 |
+
np.float32,0xfea86060,0xbfc90fdb,3
|
| 208 |
+
np.float32,0x3e828174,0x3e7f91bb,3
|
| 209 |
+
np.float32,0xff682c82,0xbfc90fdb,3
|
| 210 |
+
np.float32,0x4e20f3,0x4e20f3,3
|
| 211 |
+
np.float32,0x7f17d7e9,0x3fc90fdb,3
|
| 212 |
+
np.float32,0x80671f92,0x80671f92,3
|
| 213 |
+
np.float32,0x7f6dd100,0x3fc90fdb,3
|
| 214 |
+
np.float32,0x3f219a4d,0x3f102695,3
|
| 215 |
+
np.float32,0x803c9808,0x803c9808,3
|
| 216 |
+
np.float32,0x3c432ada,0x3c43287d,3
|
| 217 |
+
np.float32,0xbd3db450,0xbd3d91a2,3
|
| 218 |
+
np.float32,0x3baac135,0x3baac0d0,3
|
| 219 |
+
np.float32,0xff7fffe1,0xbfc90fdb,3
|
| 220 |
+
np.float32,0xfe38a6f4,0xbfc90fdb,3
|
| 221 |
+
np.float32,0x3dfb0a04,0x3df9cb04,3
|
| 222 |
+
np.float32,0x800b05c2,0x800b05c2,3
|
| 223 |
+
np.float32,0x644163,0x644163,3
|
| 224 |
+
np.float32,0xff03a025,0xbfc90fdb,3
|
| 225 |
+
np.float32,0x3f7d506c,0x3f47b641,3
|
| 226 |
+
np.float32,0xff0e682a,0xbfc90fdb,3
|
| 227 |
+
np.float32,0x3e09b7b0,0x3e08e567,3
|
| 228 |
+
np.float32,0x7f72a216,0x3fc90fdb,3
|
| 229 |
+
np.float32,0x7f800000,0x3fc90fdb,3
|
| 230 |
+
np.float32,0x8050a281,0x8050a281,3
|
| 231 |
+
np.float32,0x7edafa2f,0x3fc90fdb,3
|
| 232 |
+
np.float32,0x3f4e0df6,0x3f2d7f2f,3
|
| 233 |
+
np.float32,0xbf6728e0,0xbf3c050f,3
|
| 234 |
+
np.float32,0x3e904ce4,0x3e8ca6eb,3
|
| 235 |
+
np.float32,0x0,0x0,3
|
| 236 |
+
np.float32,0xfd215070,0xbfc90fdb,3
|
| 237 |
+
np.float32,0x7e406b15,0x3fc90fdb,3
|
| 238 |
+
np.float32,0xbf2803c9,0xbf14af18,3
|
| 239 |
+
np.float32,0x5950c8,0x5950c8,3
|
| 240 |
+
np.float32,0xbeddcec8,0xbed14faa,3
|
| 241 |
+
np.float32,0xbec6457e,0xbebd2aa5,3
|
| 242 |
+
np.float32,0xbf42843c,0xbf2656db,3
|
| 243 |
+
np.float32,0x3ee9cba8,0x3edb5163,3
|
| 244 |
+
np.float32,0xbe30c954,0xbe2f0f90,3
|
| 245 |
+
np.float32,0xbeee6b44,0xbedf216f,3
|
| 246 |
+
np.float32,0xbe35d818,0xbe33f7cd,3
|
| 247 |
+
np.float32,0xbe47c630,0xbe454bc6,3
|
| 248 |
+
np.float32,0x801b146f,0x801b146f,3
|
| 249 |
+
np.float32,0x7f6788da,0x3fc90fdb,3
|
| 250 |
+
np.float32,0x3eaef088,0x3ea8927d,3
|
| 251 |
+
np.float32,0x3eb5983e,0x3eae81fc,3
|
| 252 |
+
np.float32,0x40b51d,0x40b51d,3
|
| 253 |
+
np.float32,0xfebddd04,0xbfc90fdb,3
|
| 254 |
+
np.float32,0x3e591aee,0x3e55efea,3
|
| 255 |
+
np.float32,0xbe2b6b48,0xbe29d81f,3
|
| 256 |
+
np.float32,0xff4a8826,0xbfc90fdb,3
|
| 257 |
+
np.float32,0x3e791df0,0x3e745eac,3
|
| 258 |
+
np.float32,0x7c8f681f,0x3fc90fdb,3
|
| 259 |
+
np.float32,0xfe7a15c4,0xbfc90fdb,3
|
| 260 |
+
np.float32,0x3c8963,0x3c8963,3
|
| 261 |
+
np.float32,0x3f0afa0a,0x3efea5cc,3
|
| 262 |
+
np.float32,0xbf0d2680,0xbf00ff29,3
|
| 263 |
+
np.float32,0x3dc306b0,0x3dc27096,3
|
| 264 |
+
np.float32,0x7f4cf105,0x3fc90fdb,3
|
| 265 |
+
np.float32,0xbe196060,0xbe183ea4,3
|
| 266 |
+
np.float32,0x5caf1c,0x5caf1c,3
|
| 267 |
+
np.float32,0x801f2852,0x801f2852,3
|
| 268 |
+
np.float32,0xbe01aa0c,0xbe00fa53,3
|
| 269 |
+
np.float32,0x3f0cfd32,0x3f00df7a,3
|
| 270 |
+
np.float32,0x7d82038e,0x3fc90fdb,3
|
| 271 |
+
np.float32,0x7f7b927f,0x3fc90fdb,3
|
| 272 |
+
np.float32,0xbe93b2e4,0xbe8fcb7f,3
|
| 273 |
+
np.float32,0x1ffe8c,0x1ffe8c,3
|
| 274 |
+
np.float32,0x3faaf6,0x3faaf6,3
|
| 275 |
+
np.float32,0x3e32b1b8,0x3e30e9ab,3
|
| 276 |
+
np.float32,0x802953c0,0x802953c0,3
|
| 277 |
+
np.float32,0xfe5d9844,0xbfc90fdb,3
|
| 278 |
+
np.float32,0x3e1a59d0,0x3e193292,3
|
| 279 |
+
np.float32,0x801c6edc,0x801c6edc,3
|
| 280 |
+
np.float32,0x1ecf41,0x1ecf41,3
|
| 281 |
+
np.float32,0xfe56b09c,0xbfc90fdb,3
|
| 282 |
+
np.float32,0x7e878351,0x3fc90fdb,3
|
| 283 |
+
np.float32,0x3f401e2c,0x3f24cfcb,3
|
| 284 |
+
np.float32,0xbf204a40,0xbf0f35bb,3
|
| 285 |
+
np.float32,0x3e155a98,0x3e144ee1,3
|
| 286 |
+
np.float32,0xbf34f929,0xbf1d8838,3
|
| 287 |
+
np.float32,0x801bbf70,0x801bbf70,3
|
| 288 |
+
np.float32,0x7e7c9730,0x3fc90fdb,3
|
| 289 |
+
np.float32,0x7cc23432,0x3fc90fdb,3
|
| 290 |
+
np.float32,0xbf351638,0xbf1d9b97,3
|
| 291 |
+
np.float32,0x80152094,0x80152094,3
|
| 292 |
+
np.float32,0x3f2d731c,0x3f187219,3
|
| 293 |
+
np.float32,0x804ab0b7,0x804ab0b7,3
|
| 294 |
+
np.float32,0x37d6db,0x37d6db,3
|
| 295 |
+
np.float32,0xbf3ccc56,0xbf22acbf,3
|
| 296 |
+
np.float32,0x3e546f8c,0x3e5176e7,3
|
| 297 |
+
np.float32,0xbe90e87e,0xbe8d3707,3
|
| 298 |
+
np.float32,0x48256c,0x48256c,3
|
| 299 |
+
np.float32,0x7e2468d0,0x3fc90fdb,3
|
| 300 |
+
np.float32,0x807af47e,0x807af47e,3
|
| 301 |
+
np.float32,0x3ed4b221,0x3ec996f0,3
|
| 302 |
+
np.float32,0x3d3b1956,0x3d3af811,3
|
| 303 |
+
np.float32,0xbe69d93c,0xbe65e7f0,3
|
| 304 |
+
np.float32,0xff03ff14,0xbfc90fdb,3
|
| 305 |
+
np.float32,0x801e79dc,0x801e79dc,3
|
| 306 |
+
np.float32,0x3f467c53,0x3f28d63d,3
|
| 307 |
+
np.float32,0x3eab6baa,0x3ea56a1c,3
|
| 308 |
+
np.float32,0xbf15519c,0xbf072d1c,3
|
| 309 |
+
np.float32,0x7f0bd8e8,0x3fc90fdb,3
|
| 310 |
+
np.float32,0xbe1e0d1c,0xbe1cd053,3
|
| 311 |
+
np.float32,0x8016edab,0x8016edab,3
|
| 312 |
+
np.float32,0x7ecaa09b,0x3fc90fdb,3
|
| 313 |
+
np.float32,0x3f72e6d9,0x3f4257a8,3
|
| 314 |
+
np.float32,0xbefe787e,0xbeec29a4,3
|
| 315 |
+
np.float32,0xbee989e8,0xbedb1af9,3
|
| 316 |
+
np.float32,0xbe662db0,0xbe626a45,3
|
| 317 |
+
np.float32,0x495bf7,0x495bf7,3
|
| 318 |
+
np.float32,0x26c379,0x26c379,3
|
| 319 |
+
np.float32,0x7f54d41a,0x3fc90fdb,3
|
| 320 |
+
np.float32,0x801e7dd9,0x801e7dd9,3
|
| 321 |
+
np.float32,0x80000000,0x80000000,3
|
| 322 |
+
np.float32,0xfa3d3000,0xbfc90fdb,3
|
| 323 |
+
np.float32,0xfa3cb800,0xbfc90fdb,3
|
| 324 |
+
np.float32,0x264894,0x264894,3
|
| 325 |
+
np.float32,0xff6de011,0xbfc90fdb,3
|
| 326 |
+
np.float32,0x7e9045b2,0x3fc90fdb,3
|
| 327 |
+
np.float32,0x3f2253a8,0x3f10aaf4,3
|
| 328 |
+
np.float32,0xbd462bf0,0xbd460469,3
|
| 329 |
+
np.float32,0x7f1796af,0x3fc90fdb,3
|
| 330 |
+
np.float32,0x3e718858,0x3e6d3279,3
|
| 331 |
+
np.float32,0xff437d7e,0xbfc90fdb,3
|
| 332 |
+
np.float32,0x805ae7cb,0x805ae7cb,3
|
| 333 |
+
np.float32,0x807e32e9,0x807e32e9,3
|
| 334 |
+
np.float32,0x3ee0bafc,0x3ed3c453,3
|
| 335 |
+
np.float32,0xbf721dee,0xbf41edc3,3
|
| 336 |
+
np.float32,0xfec9f792,0xbfc90fdb,3
|
| 337 |
+
np.float32,0x7f050720,0x3fc90fdb,3
|
| 338 |
+
np.float32,0x182261,0x182261,3
|
| 339 |
+
np.float32,0x3e39e678,0x3e37e5be,3
|
| 340 |
+
np.float32,0x7e096e4b,0x3fc90fdb,3
|
| 341 |
+
np.float32,0x103715,0x103715,3
|
| 342 |
+
np.float32,0x3f7e7741,0x3f484ae4,3
|
| 343 |
+
np.float32,0x3e29aea5,0x3e28277c,3
|
| 344 |
+
np.float32,0x58c183,0x58c183,3
|
| 345 |
+
np.float32,0xff72fdb2,0xbfc90fdb,3
|
| 346 |
+
np.float32,0xbd9a9420,0xbd9a493c,3
|
| 347 |
+
np.float32,0x7f1e07e7,0x3fc90fdb,3
|
| 348 |
+
np.float32,0xff79f522,0xbfc90fdb,3
|
| 349 |
+
np.float32,0x7c7d0e96,0x3fc90fdb,3
|
| 350 |
+
np.float32,0xbeba9e8e,0xbeb2f504,3
|
| 351 |
+
np.float32,0xfd880a80,0xbfc90fdb,3
|
| 352 |
+
np.float32,0xff7f2a33,0xbfc90fdb,3
|
| 353 |
+
np.float32,0x3e861ae0,0x3e83289c,3
|
| 354 |
+
np.float32,0x7f0161c1,0x3fc90fdb,3
|
| 355 |
+
np.float32,0xfe844ff8,0xbfc90fdb,3
|
| 356 |
+
np.float32,0xbebf4b98,0xbeb7128e,3
|
| 357 |
+
np.float32,0x652bee,0x652bee,3
|
| 358 |
+
np.float32,0xff188a4b,0xbfc90fdb,3
|
| 359 |
+
np.float32,0xbf800000,0xbf490fdb,3
|
| 360 |
+
np.float32,0x80418711,0x80418711,3
|
| 361 |
+
np.float32,0xbeb712d4,0xbeafd1f6,3
|
| 362 |
+
np.float32,0xbf7cee28,0xbf478491,3
|
| 363 |
+
np.float32,0xfe66c59c,0xbfc90fdb,3
|
| 364 |
+
np.float32,0x4166a2,0x4166a2,3
|
| 365 |
+
np.float32,0x3dfa1a2c,0x3df8deb5,3
|
| 366 |
+
np.float32,0xbdbfbcb8,0xbdbf2e0f,3
|
| 367 |
+
np.float32,0xfe60ef70,0xbfc90fdb,3
|
| 368 |
+
np.float32,0xfe009444,0xbfc90fdb,3
|
| 369 |
+
np.float32,0xfeb27aa0,0xbfc90fdb,3
|
| 370 |
+
np.float32,0xbe99f7bc,0xbe95902b,3
|
| 371 |
+
np.float32,0x8043d28d,0x8043d28d,3
|
| 372 |
+
np.float32,0xfe5328c4,0xbfc90fdb,3
|
| 373 |
+
np.float32,0x8017b27e,0x8017b27e,3
|
| 374 |
+
np.float32,0x3ef1d2cf,0x3ee1ebd7,3
|
| 375 |
+
np.float32,0x805ddd90,0x805ddd90,3
|
| 376 |
+
np.float32,0xbf424263,0xbf262d17,3
|
| 377 |
+
np.float32,0xfc99dde0,0xbfc90fdb,3
|
| 378 |
+
np.float32,0xbf7ec13b,0xbf487015,3
|
| 379 |
+
np.float32,0xbef727ea,0xbee64377,3
|
| 380 |
+
np.float32,0xff15ce95,0xbfc90fdb,3
|
| 381 |
+
np.float32,0x1fbba4,0x1fbba4,3
|
| 382 |
+
np.float32,0x3f3b2368,0x3f2198a9,3
|
| 383 |
+
np.float32,0xfefda26e,0xbfc90fdb,3
|
| 384 |
+
np.float32,0x801519ad,0x801519ad,3
|
| 385 |
+
np.float32,0x80473fa2,0x80473fa2,3
|
| 386 |
+
np.float32,0x7e7a8bc1,0x3fc90fdb,3
|
| 387 |
+
np.float32,0x3e8a9289,0x3e87548a,3
|
| 388 |
+
np.float32,0x3ed68987,0x3ecb2872,3
|
| 389 |
+
np.float32,0x805bca66,0x805bca66,3
|
| 390 |
+
np.float32,0x8079c4e3,0x8079c4e3,3
|
| 391 |
+
np.float32,0x3a2510,0x3a2510,3
|
| 392 |
+
np.float32,0x7eedc598,0x3fc90fdb,3
|
| 393 |
+
np.float32,0x80681956,0x80681956,3
|
| 394 |
+
np.float32,0xff64c778,0xbfc90fdb,3
|
| 395 |
+
np.float32,0x806bbc46,0x806bbc46,3
|
| 396 |
+
np.float32,0x433643,0x433643,3
|
| 397 |
+
np.float32,0x705b92,0x705b92,3
|
| 398 |
+
np.float32,0xff359392,0xbfc90fdb,3
|
| 399 |
+
np.float32,0xbee78672,0xbed96fa7,3
|
| 400 |
+
np.float32,0x3e21717b,0x3e202010,3
|
| 401 |
+
np.float32,0xfea13c34,0xbfc90fdb,3
|
| 402 |
+
np.float32,0x2c8895,0x2c8895,3
|
| 403 |
+
np.float32,0x3ed33290,0x3ec84f7c,3
|
| 404 |
+
np.float32,0x3e63031e,0x3e5f662e,3
|
| 405 |
+
np.float32,0x7e30907b,0x3fc90fdb,3
|
| 406 |
+
np.float32,0xbe293708,0xbe27b310,3
|
| 407 |
+
np.float32,0x3ed93738,0x3ecd6ea3,3
|
| 408 |
+
np.float32,0x9db7e,0x9db7e,3
|
| 409 |
+
np.float32,0x3f7cd1b8,0x3f47762c,3
|
| 410 |
+
np.float32,0x3eb5143c,0x3eae0cb0,3
|
| 411 |
+
np.float32,0xbe69b234,0xbe65c2d7,3
|
| 412 |
+
np.float32,0x3f6e74de,0x3f3ffb97,3
|
| 413 |
+
np.float32,0x5d0559,0x5d0559,3
|
| 414 |
+
np.float32,0x3e1e8c30,0x3e1d4c70,3
|
| 415 |
+
np.float32,0xbf2d1878,0xbf1833ef,3
|
| 416 |
+
np.float32,0xff2adf82,0xbfc90fdb,3
|
| 417 |
+
np.float32,0x8012e2c1,0x8012e2c1,3
|
| 418 |
+
np.float32,0x7f031be3,0x3fc90fdb,3
|
| 419 |
+
np.float32,0x805ff94e,0x805ff94e,3
|
| 420 |
+
np.float32,0x3e9d5b27,0x3e98aa31,3
|
| 421 |
+
np.float32,0x3f56d5cf,0x3f32bc9e,3
|
| 422 |
+
np.float32,0x3eaa0412,0x3ea4267f,3
|
| 423 |
+
np.float32,0xbe899ea4,0xbe86712f,3
|
| 424 |
+
np.float32,0x800f2f48,0x800f2f48,3
|
| 425 |
+
np.float32,0x3f1c2269,0x3f0c33ea,3
|
| 426 |
+
np.float32,0x3f4a5f64,0x3f2b3f28,3
|
| 427 |
+
np.float32,0x80739318,0x80739318,3
|
| 428 |
+
np.float32,0x806e9b47,0x806e9b47,3
|
| 429 |
+
np.float32,0x3c8cd300,0x3c8ccf73,3
|
| 430 |
+
np.float32,0x7f39a39d,0x3fc90fdb,3
|
| 431 |
+
np.float32,0x3ec95d61,0x3ebfd9dc,3
|
| 432 |
+
np.float32,0xff351ff8,0xbfc90fdb,3
|
| 433 |
+
np.float32,0xff3a8f58,0xbfc90fdb,3
|
| 434 |
+
np.float32,0x7f313ec0,0x3fc90fdb,3
|
| 435 |
+
np.float32,0x803aed13,0x803aed13,3
|
| 436 |
+
np.float32,0x7f771d9b,0x3fc90fdb,3
|
| 437 |
+
np.float32,0x8045a6d6,0x8045a6d6,3
|
| 438 |
+
np.float32,0xbc85f280,0xbc85ef72,3
|
| 439 |
+
np.float32,0x7e9c68f5,0x3fc90fdb,3
|
| 440 |
+
np.float32,0xbf0f9379,0xbf02d975,3
|
| 441 |
+
np.float32,0x7e97bcb1,0x3fc90fdb,3
|
| 442 |
+
np.float32,0x804a07d5,0x804a07d5,3
|
| 443 |
+
np.float32,0x802e6117,0x802e6117,3
|
| 444 |
+
np.float32,0x7ed5e388,0x3fc90fdb,3
|
| 445 |
+
np.float32,0x80750455,0x80750455,3
|
| 446 |
+
np.float32,0xff4a8325,0xbfc90fdb,3
|
| 447 |
+
np.float32,0xbedb6866,0xbecf497c,3
|
| 448 |
+
np.float32,0x52ea3b,0x52ea3b,3
|
| 449 |
+
np.float32,0xff773172,0xbfc90fdb,3
|
| 450 |
+
np.float32,0xbeaa8ff0,0xbea4a46e,3
|
| 451 |
+
np.float32,0x7eef2058,0x3fc90fdb,3
|
| 452 |
+
np.float32,0x3f712472,0x3f4169d3,3
|
| 453 |
+
np.float32,0xff6c8608,0xbfc90fdb,3
|
| 454 |
+
np.float32,0xbf6eaa41,0xbf40182a,3
|
| 455 |
+
np.float32,0x3eb03c24,0x3ea9bb34,3
|
| 456 |
+
np.float32,0xfe118cd4,0xbfc90fdb,3
|
| 457 |
+
np.float32,0x3e5b03b0,0x3e57c378,3
|
| 458 |
+
np.float32,0x7f34d92d,0x3fc90fdb,3
|
| 459 |
+
np.float32,0x806c3418,0x806c3418,3
|
| 460 |
+
np.float32,0x7f3074e3,0x3fc90fdb,3
|
| 461 |
+
np.float32,0x8002df02,0x8002df02,3
|
| 462 |
+
np.float32,0x3f6df63a,0x3f3fb7b7,3
|
| 463 |
+
np.float32,0xfd2b4100,0xbfc90fdb,3
|
| 464 |
+
np.float32,0x80363d5c,0x80363d5c,3
|
| 465 |
+
np.float32,0xbeac1f98,0xbea60bd6,3
|
| 466 |
+
np.float32,0xff7fffff,0xbfc90fdb,3
|
| 467 |
+
np.float32,0x80045097,0x80045097,3
|
| 468 |
+
np.float32,0xfe011100,0xbfc90fdb,3
|
| 469 |
+
np.float32,0x80739ef5,0x80739ef5,3
|
| 470 |
+
np.float32,0xff3976ed,0xbfc90fdb,3
|
| 471 |
+
np.float32,0xbe18e3a0,0xbe17c49e,3
|
| 472 |
+
np.float32,0xbe289294,0xbe2712f6,3
|
| 473 |
+
np.float32,0x3f1d41e7,0x3f0d050e,3
|
| 474 |
+
np.float32,0x39364a,0x39364a,3
|
| 475 |
+
np.float32,0x8072b77e,0x8072b77e,3
|
| 476 |
+
np.float32,0x3f7cfec0,0x3f478cf6,3
|
| 477 |
+
np.float32,0x2f68f6,0x2f68f6,3
|
| 478 |
+
np.float32,0xbf031fb8,0xbef25c84,3
|
| 479 |
+
np.float32,0xbf0b842c,0xbeff7afc,3
|
| 480 |
+
np.float32,0x3f081e7e,0x3efa3676,3
|
| 481 |
+
np.float32,0x7f7fffff,0x3fc90fdb,3
|
| 482 |
+
np.float32,0xff15da0e,0xbfc90fdb,3
|
| 483 |
+
np.float32,0x3d2001b2,0x3d1fece1,3
|
| 484 |
+
np.float32,0x7f76efef,0x3fc90fdb,3
|
| 485 |
+
np.float32,0x3f2405dd,0x3f11dfb7,3
|
| 486 |
+
np.float32,0xa0319,0xa0319,3
|
| 487 |
+
np.float32,0x3e23d2bd,0x3e227255,3
|
| 488 |
+
np.float32,0xbd4d4c50,0xbd4d205e,3
|
| 489 |
+
np.float32,0x382344,0x382344,3
|
| 490 |
+
np.float32,0x21bbf,0x21bbf,3
|
| 491 |
+
np.float32,0xbf209e82,0xbf0f7239,3
|
| 492 |
+
np.float32,0xff03bf9f,0xbfc90fdb,3
|
| 493 |
+
np.float32,0x7b1789,0x7b1789,3
|
| 494 |
+
np.float32,0xff314944,0xbfc90fdb,3
|
| 495 |
+
np.float32,0x1a63eb,0x1a63eb,3
|
| 496 |
+
np.float32,0x803dc983,0x803dc983,3
|
| 497 |
+
np.float32,0x3f0ff558,0x3f0323dc,3
|
| 498 |
+
np.float32,0x3f544f2c,0x3f313f58,3
|
| 499 |
+
np.float32,0xff032948,0xbfc90fdb,3
|
| 500 |
+
np.float32,0x7f4933cc,0x3fc90fdb,3
|
| 501 |
+
np.float32,0x7f14c5ed,0x3fc90fdb,3
|
| 502 |
+
np.float32,0x803aeebf,0x803aeebf,3
|
| 503 |
+
np.float32,0xbf0d4c0f,0xbf011bf5,3
|
| 504 |
+
np.float32,0xbeaf8de2,0xbea91f57,3
|
| 505 |
+
np.float32,0xff3ae030,0xbfc90fdb,3
|
| 506 |
+
np.float32,0xbb362d00,0xbb362ce1,3
|
| 507 |
+
np.float32,0x3d1f79e0,0x3d1f6544,3
|
| 508 |
+
np.float32,0x3f56e9d9,0x3f32c860,3
|
| 509 |
+
np.float32,0x3f723e5e,0x3f41fee2,3
|
| 510 |
+
np.float32,0x4c0179,0x4c0179,3
|
| 511 |
+
np.float32,0xfee36132,0xbfc90fdb,3
|
| 512 |
+
np.float32,0x619ae6,0x619ae6,3
|
| 513 |
+
np.float32,0xfde5d670,0xbfc90fdb,3
|
| 514 |
+
np.float32,0xff079ac5,0xbfc90fdb,3
|
| 515 |
+
np.float32,0x3e974fbd,0x3e931fae,3
|
| 516 |
+
np.float32,0x8020ae6b,0x8020ae6b,3
|
| 517 |
+
np.float32,0x6b5af1,0x6b5af1,3
|
| 518 |
+
np.float32,0xbeb57cd6,0xbeae69a3,3
|
| 519 |
+
np.float32,0x806e7eb2,0x806e7eb2,3
|
| 520 |
+
np.float32,0x7e666edb,0x3fc90fdb,3
|
| 521 |
+
np.float32,0xbf458c18,0xbf283ff0,3
|
| 522 |
+
np.float32,0x3e50518e,0x3e4d8399,3
|
| 523 |
+
np.float32,0x3e9ce224,0x3e983b98,3
|
| 524 |
+
np.float32,0x3e6bc067,0x3e67b6c6,3
|
| 525 |
+
np.float32,0x13783d,0x13783d,3
|
| 526 |
+
np.float32,0xff3d518c,0xbfc90fdb,3
|
| 527 |
+
np.float32,0xfeba5968,0xbfc90fdb,3
|
| 528 |
+
np.float32,0xbf0b9f76,0xbeffa50f,3
|
| 529 |
+
np.float32,0xfe174900,0xbfc90fdb,3
|
| 530 |
+
np.float32,0x3f38bb0a,0x3f200527,3
|
| 531 |
+
np.float32,0x7e94a77d,0x3fc90fdb,3
|
| 532 |
+
np.float32,0x29d776,0x29d776,3
|
| 533 |
+
np.float32,0xbf4e058d,0xbf2d7a15,3
|
| 534 |
+
np.float32,0xbd94abc8,0xbd946923,3
|
| 535 |
+
np.float32,0xbee62db0,0xbed85124,3
|
| 536 |
+
np.float32,0x800000,0x800000,3
|
| 537 |
+
np.float32,0xbef1df7e,0xbee1f636,3
|
| 538 |
+
np.float32,0xbcf3cd20,0xbcf3bab5,3
|
| 539 |
+
np.float32,0x80007b05,0x80007b05,3
|
| 540 |
+
np.float32,0x3d9b3f2e,0x3d9af351,3
|
| 541 |
+
np.float32,0xbf714a68,0xbf417dee,3
|
| 542 |
+
np.float32,0xbf2a2d37,0xbf163069,3
|
| 543 |
+
np.float32,0x8055104f,0x8055104f,3
|
| 544 |
+
np.float32,0x7f5c40d7,0x3fc90fdb,3
|
| 545 |
+
np.float32,0x1,0x1,3
|
| 546 |
+
np.float32,0xff35f3a6,0xbfc90fdb,3
|
| 547 |
+
np.float32,0xd9c7c,0xd9c7c,3
|
| 548 |
+
np.float32,0xbf440cfc,0xbf274f22,3
|
| 549 |
+
np.float32,0x8050ac43,0x8050ac43,3
|
| 550 |
+
np.float32,0x63ee16,0x63ee16,3
|
| 551 |
+
np.float32,0x7d90419b,0x3fc90fdb,3
|
| 552 |
+
np.float32,0xfee22198,0xbfc90fdb,3
|
| 553 |
+
np.float32,0xc2ead,0xc2ead,3
|
| 554 |
+
np.float32,0x7f5cd6a6,0x3fc90fdb,3
|
| 555 |
+
np.float32,0x3f6fab7e,0x3f40a184,3
|
| 556 |
+
np.float32,0x3ecf998c,0x3ec53a73,3
|
| 557 |
+
np.float32,0x7e5271f0,0x3fc90fdb,3
|
| 558 |
+
np.float32,0x67c016,0x67c016,3
|
| 559 |
+
np.float32,0x2189c8,0x2189c8,3
|
| 560 |
+
np.float32,0x27d892,0x27d892,3
|
| 561 |
+
np.float32,0x3f0d02c4,0x3f00e3c0,3
|
| 562 |
+
np.float32,0xbf69ebca,0xbf3d8862,3
|
| 563 |
+
np.float32,0x3e60c0d6,0x3e5d3ebb,3
|
| 564 |
+
np.float32,0x3f45206c,0x3f27fc66,3
|
| 565 |
+
np.float32,0xbf6b47dc,0xbf3e4592,3
|
| 566 |
+
np.float32,0xfe9be2e2,0xbfc90fdb,3
|
| 567 |
+
np.float32,0x7fa00000,0x7fe00000,3
|
| 568 |
+
np.float32,0xff271562,0xbfc90fdb,3
|
| 569 |
+
np.float32,0x3e2e5270,0x3e2caaaf,3
|
| 570 |
+
np.float32,0x80222934,0x80222934,3
|
| 571 |
+
np.float32,0xbd01d220,0xbd01c701,3
|
| 572 |
+
np.float32,0x223aa0,0x223aa0,3
|
| 573 |
+
np.float32,0x3f4b5a7e,0x3f2bd967,3
|
| 574 |
+
np.float32,0x3f217d85,0x3f101200,3
|
| 575 |
+
np.float32,0xbf57663a,0xbf331144,3
|
| 576 |
+
np.float32,0x3f219862,0x3f102536,3
|
| 577 |
+
np.float32,0x28a28c,0x28a28c,3
|
| 578 |
+
np.float32,0xbf3f55f4,0xbf244f86,3
|
| 579 |
+
np.float32,0xbf3de287,0xbf236092,3
|
| 580 |
+
np.float32,0xbf1c1ce2,0xbf0c2fe3,3
|
| 581 |
+
np.float32,0x80000001,0x80000001,3
|
| 582 |
+
np.float32,0x3db695d0,0x3db61a90,3
|
| 583 |
+
np.float32,0x6c39bf,0x6c39bf,3
|
| 584 |
+
np.float32,0x7e33a12f,0x3fc90fdb,3
|
| 585 |
+
np.float32,0x67623a,0x67623a,3
|
| 586 |
+
np.float32,0x3e45dc54,0x3e4373b6,3
|
| 587 |
+
np.float32,0x7f62fa68,0x3fc90fdb,3
|
| 588 |
+
np.float32,0x3f0e1d01,0x3f01bbe5,3
|
| 589 |
+
np.float32,0x3f13dc69,0x3f0615f5,3
|
| 590 |
+
np.float32,0x246703,0x246703,3
|
| 591 |
+
np.float32,0xbf1055b5,0xbf036d07,3
|
| 592 |
+
np.float32,0x7f46d3d0,0x3fc90fdb,3
|
| 593 |
+
np.float32,0x3d2b8086,0x3d2b66e5,3
|
| 594 |
+
np.float32,0xbf03be44,0xbef35776,3
|
| 595 |
+
np.float32,0x3f800000,0x3f490fdb,3
|
| 596 |
+
np.float32,0xbec8d226,0xbebf613d,3
|
| 597 |
+
np.float32,0x3d8faf00,0x3d8f72d4,3
|
| 598 |
+
np.float32,0x170c4e,0x170c4e,3
|
| 599 |
+
np.float32,0xff14c0f0,0xbfc90fdb,3
|
| 600 |
+
np.float32,0xff16245d,0xbfc90fdb,3
|
| 601 |
+
np.float32,0x7f44ce6d,0x3fc90fdb,3
|
| 602 |
+
np.float32,0xbe8175d8,0xbe7d9aeb,3
|
| 603 |
+
np.float32,0x3df7a4a1,0x3df67254,3
|
| 604 |
+
np.float32,0xfe2cc46c,0xbfc90fdb,3
|
| 605 |
+
np.float32,0x3f284e63,0x3f14e335,3
|
| 606 |
+
np.float32,0x7e46e5d6,0x3fc90fdb,3
|
| 607 |
+
np.float32,0x397be4,0x397be4,3
|
| 608 |
+
np.float32,0xbf2560bc,0xbf12d50b,3
|
| 609 |
+
np.float32,0x3ed9b8c1,0x3ecddc60,3
|
| 610 |
+
np.float32,0xfec18c5a,0xbfc90fdb,3
|
| 611 |
+
np.float32,0x64894d,0x64894d,3
|
| 612 |
+
np.float32,0x36a65d,0x36a65d,3
|
| 613 |
+
np.float32,0x804ffcd7,0x804ffcd7,3
|
| 614 |
+
np.float32,0x800f79e4,0x800f79e4,3
|
| 615 |
+
np.float32,0x5d45ac,0x5d45ac,3
|
| 616 |
+
np.float32,0x6cdda0,0x6cdda0,3
|
| 617 |
+
np.float32,0xbf7f2077,0xbf489fe5,3
|
| 618 |
+
np.float32,0xbf152f78,0xbf0713a1,3
|
| 619 |
+
np.float32,0x807bf344,0x807bf344,3
|
| 620 |
+
np.float32,0x3f775023,0x3f44a4d8,3
|
| 621 |
+
np.float32,0xbf3edf67,0xbf240365,3
|
| 622 |
+
np.float32,0x7eed729c,0x3fc90fdb,3
|
| 623 |
+
np.float32,0x14cc29,0x14cc29,3
|
| 624 |
+
np.float32,0x7edd7b6b,0x3fc90fdb,3
|
| 625 |
+
np.float32,0xbf3c6e2c,0xbf226fb7,3
|
| 626 |
+
np.float32,0x51b9ad,0x51b9ad,3
|
| 627 |
+
np.float32,0x3f617ee8,0x3f38dd7c,3
|
| 628 |
+
np.float32,0xff800000,0xbfc90fdb,3
|
| 629 |
+
np.float32,0x7f440ea0,0x3fc90fdb,3
|
| 630 |
+
np.float32,0x3e639893,0x3e5ff49e,3
|
| 631 |
+
np.float32,0xbd791bb0,0xbd78cd3c,3
|
| 632 |
+
np.float32,0x8059fcbc,0x8059fcbc,3
|
| 633 |
+
np.float32,0xbf7d1214,0xbf4796bd,3
|
| 634 |
+
np.float32,0x3ef368fa,0x3ee33788,3
|
| 635 |
+
np.float32,0xbecec0f4,0xbec48055,3
|
| 636 |
+
np.float32,0xbc83d940,0xbc83d656,3
|
| 637 |
+
np.float32,0xbce01220,0xbce003d4,3
|
| 638 |
+
np.float32,0x803192a5,0x803192a5,3
|
| 639 |
+
np.float32,0xbe40e0c0,0xbe3ea4f0,3
|
| 640 |
+
np.float32,0xfb692600,0xbfc90fdb,3
|
| 641 |
+
np.float32,0x3f1bec65,0x3f0c0c88,3
|
| 642 |
+
np.float32,0x7f042798,0x3fc90fdb,3
|
| 643 |
+
np.float32,0xbe047374,0xbe03b83b,3
|
| 644 |
+
np.float32,0x7f7c6630,0x3fc90fdb,3
|
| 645 |
+
np.float32,0x7f58dae3,0x3fc90fdb,3
|
| 646 |
+
np.float32,0x80691c92,0x80691c92,3
|
| 647 |
+
np.float32,0x7dbe76,0x7dbe76,3
|
| 648 |
+
np.float32,0xbf231384,0xbf11339d,3
|
| 649 |
+
np.float32,0xbef4acf8,0xbee43f8b,3
|
| 650 |
+
np.float32,0x3ee9f9d0,0x3edb7793,3
|
| 651 |
+
np.float32,0x3f0064f6,0x3eee04a8,3
|
| 652 |
+
np.float32,0x313732,0x313732,3
|
| 653 |
+
np.float32,0xfd58cf80,0xbfc90fdb,3
|
| 654 |
+
np.float32,0x3f7a2bc9,0x3f461d30,3
|
| 655 |
+
np.float32,0x7f7681af,0x3fc90fdb,3
|
| 656 |
+
np.float32,0x7f504211,0x3fc90fdb,3
|
| 657 |
+
np.float32,0xfeae0c00,0xbfc90fdb,3
|
| 658 |
+
np.float32,0xbee14396,0xbed436d1,3
|
| 659 |
+
np.float32,0x7fc00000,0x7fc00000,3
|
| 660 |
+
np.float32,0x693406,0x693406,3
|
| 661 |
+
np.float32,0x3eb4a679,0x3eadab1b,3
|
| 662 |
+
np.float32,0x550505,0x550505,3
|
| 663 |
+
np.float32,0xfd493d10,0xbfc90fdb,3
|
| 664 |
+
np.float32,0x3f4fc907,0x3f2e8b2c,3
|
| 665 |
+
np.float32,0x80799aa4,0x80799aa4,3
|
| 666 |
+
np.float32,0xff1ea89b,0xbfc90fdb,3
|
| 667 |
+
np.float32,0xff424510,0xbfc90fdb,3
|
| 668 |
+
np.float32,0x7f68d026,0x3fc90fdb,3
|
| 669 |
+
np.float32,0xbea230ca,0xbe9d1200,3
|
| 670 |
+
np.float32,0x7ea585da,0x3fc90fdb,3
|
| 671 |
+
np.float32,0x3f3db211,0x3f23414c,3
|
| 672 |
+
np.float32,0xfea4d964,0xbfc90fdb,3
|
| 673 |
+
np.float32,0xbf17fe18,0xbf092984,3
|
| 674 |
+
np.float32,0x7cc8a2,0x7cc8a2,3
|
| 675 |
+
np.float32,0xff0330ba,0xbfc90fdb,3
|
| 676 |
+
np.float32,0x3f769835,0x3f444592,3
|
| 677 |
+
np.float32,0xeb0ac,0xeb0ac,3
|
| 678 |
+
np.float32,0x7f7e45de,0x3fc90fdb,3
|
| 679 |
+
np.float32,0xbdb510a8,0xbdb49873,3
|
| 680 |
+
np.float32,0x3ebf900b,0x3eb74e9c,3
|
| 681 |
+
np.float32,0xbf21bbce,0xbf103e89,3
|
| 682 |
+
np.float32,0xbf3f4682,0xbf24459d,3
|
| 683 |
+
np.float32,0x7eb6e9c8,0x3fc90fdb,3
|
| 684 |
+
np.float32,0xbf42532d,0xbf2637be,3
|
| 685 |
+
np.float32,0xbd3b2600,0xbd3b04b4,3
|
| 686 |
+
np.float32,0x3f1fa9aa,0x3f0ec23e,3
|
| 687 |
+
np.float32,0x7ed6a0f1,0x3fc90fdb,3
|
| 688 |
+
np.float32,0xff4759a1,0xbfc90fdb,3
|
| 689 |
+
np.float32,0x6d26e3,0x6d26e3,3
|
| 690 |
+
np.float32,0xfe1108e0,0xbfc90fdb,3
|
| 691 |
+
np.float32,0xfdf76900,0xbfc90fdb,3
|
| 692 |
+
np.float32,0xfec66f22,0xbfc90fdb,3
|
| 693 |
+
np.float32,0xbf3d097f,0xbf22d458,3
|
| 694 |
+
np.float32,0x3d85be25,0x3d858d99,3
|
| 695 |
+
np.float32,0x7f36739f,0x3fc90fdb,3
|
| 696 |
+
np.float32,0x7bc0a304,0x3fc90fdb,3
|
| 697 |
+
np.float32,0xff48dd90,0xbfc90fdb,3
|
| 698 |
+
np.float32,0x48cab0,0x48cab0,3
|
| 699 |
+
np.float32,0x3ed3943c,0x3ec8a2ef,3
|
| 700 |
+
np.float32,0xbf61488e,0xbf38bede,3
|
| 701 |
+
np.float32,0x3f543df5,0x3f313525,3
|
| 702 |
+
np.float32,0x5cf2ca,0x5cf2ca,3
|
| 703 |
+
np.float32,0x572686,0x572686,3
|
| 704 |
+
np.float32,0x80369c7c,0x80369c7c,3
|
| 705 |
+
np.float32,0xbd2c1d20,0xbd2c0338,3
|
| 706 |
+
np.float32,0x3e255428,0x3e23ea0b,3
|
| 707 |
+
np.float32,0xbeba9ee0,0xbeb2f54c,3
|
| 708 |
+
np.float32,0x8015c165,0x8015c165,3
|
| 709 |
+
np.float32,0x3d31f488,0x3d31d7e6,3
|
| 710 |
+
np.float32,0x3f68591c,0x3f3cac43,3
|
| 711 |
+
np.float32,0xf5ed5,0xf5ed5,3
|
| 712 |
+
np.float32,0xbf3b1d34,0xbf21949e,3
|
| 713 |
+
np.float32,0x1f0343,0x1f0343,3
|
| 714 |
+
np.float32,0x3f0e52b5,0x3f01e4ef,3
|
| 715 |
+
np.float32,0x7f57c596,0x3fc90fdb,3
|
| 716 |
+
np.float64,0x7fd8e333ddb1c667,0x3ff921fb54442d18,3
|
| 717 |
+
np.float64,0x800bcc9cdad7993a,0x800bcc9cdad7993a,3
|
| 718 |
+
np.float64,0x3fcd6f81df3adf00,0x3fcceebbafc5d55e,3
|
| 719 |
+
np.float64,0x3fed7338a57ae671,0x3fe7ce3e5811fc0a,3
|
| 720 |
+
np.float64,0x7fe64994fcac9329,0x3ff921fb54442d18,3
|
| 721 |
+
np.float64,0xfa5a6345f4b4d,0xfa5a6345f4b4d,3
|
| 722 |
+
np.float64,0xe9dcd865d3b9b,0xe9dcd865d3b9b,3
|
| 723 |
+
np.float64,0x7fea6cffabf4d9fe,0x3ff921fb54442d18,3
|
| 724 |
+
np.float64,0xa9e1de6153c3c,0xa9e1de6153c3c,3
|
| 725 |
+
np.float64,0xab6bdc5356d7c,0xab6bdc5356d7c,3
|
| 726 |
+
np.float64,0x80062864a02c50ca,0x80062864a02c50ca,3
|
| 727 |
+
np.float64,0xbfdac03aa7b58076,0xbfd9569f3230128d,3
|
| 728 |
+
np.float64,0xbfe61b77752c36ef,0xbfe3588f51b8be8f,3
|
| 729 |
+
np.float64,0x800bc854c8d790aa,0x800bc854c8d790aa,3
|
| 730 |
+
np.float64,0x3feed1a2da3da346,0x3fe887f9b8ea031f,3
|
| 731 |
+
np.float64,0x3fe910d3697221a7,0x3fe54365a53d840e,3
|
| 732 |
+
np.float64,0x7fe7ab4944ef5692,0x3ff921fb54442d18,3
|
| 733 |
+
np.float64,0x3fa462f1a028c5e3,0x3fa460303a6a4e69,3
|
| 734 |
+
np.float64,0x800794f1a3af29e4,0x800794f1a3af29e4,3
|
| 735 |
+
np.float64,0x3fee6fe7fafcdfd0,0x3fe854f863816d55,3
|
| 736 |
+
np.float64,0x8000000000000000,0x8000000000000000,3
|
| 737 |
+
np.float64,0x7f336472fe66d,0x7f336472fe66d,3
|
| 738 |
+
np.float64,0xffb1623ac822c478,0xbff921fb54442d18,3
|
| 739 |
+
np.float64,0x3fbacd68ce359ad2,0x3fbab480b3638846,3
|
| 740 |
+
np.float64,0xffd5c02706ab804e,0xbff921fb54442d18,3
|
| 741 |
+
np.float64,0xbfd4daf03d29b5e0,0xbfd42928f069c062,3
|
| 742 |
+
np.float64,0x800c6e85dbd8dd0c,0x800c6e85dbd8dd0c,3
|
| 743 |
+
np.float64,0x800e3599c5bc6b34,0x800e3599c5bc6b34,3
|
| 744 |
+
np.float64,0x2c0d654c581ad,0x2c0d654c581ad,3
|
| 745 |
+
np.float64,0xbfdd3eb13fba7d62,0xbfdb6e8143302de7,3
|
| 746 |
+
np.float64,0x800b60cb8776c197,0x800b60cb8776c197,3
|
| 747 |
+
np.float64,0x80089819ad113034,0x80089819ad113034,3
|
| 748 |
+
np.float64,0x29fe721453fcf,0x29fe721453fcf,3
|
| 749 |
+
np.float64,0x3fe8722f4df0e45f,0x3fe4e026d9eadb4d,3
|
| 750 |
+
np.float64,0xffd1fbcd01a3f79a,0xbff921fb54442d18,3
|
| 751 |
+
np.float64,0x7fc74e1e982e9c3c,0x3ff921fb54442d18,3
|
| 752 |
+
np.float64,0x800c09d3d15813a8,0x800c09d3d15813a8,3
|
| 753 |
+
np.float64,0xbfeee4578b3dc8af,0xbfe891ab3d6c3ce4,3
|
| 754 |
+
np.float64,0xffdd01a6f33a034e,0xbff921fb54442d18,3
|
| 755 |
+
np.float64,0x7fcc130480382608,0x3ff921fb54442d18,3
|
| 756 |
+
np.float64,0xffcbb6bd1d376d7c,0xbff921fb54442d18,3
|
| 757 |
+
np.float64,0xc068a53780d15,0xc068a53780d15,3
|
| 758 |
+
np.float64,0xbfc974f15532e9e4,0xbfc92100b355f3e7,3
|
| 759 |
+
np.float64,0x3fe6da79442db4f3,0x3fe3d87393b082e7,3
|
| 760 |
+
np.float64,0xd9d9be4db3b38,0xd9d9be4db3b38,3
|
| 761 |
+
np.float64,0x5ea50a20bd4a2,0x5ea50a20bd4a2,3
|
| 762 |
+
np.float64,0xbfe5597f7d2ab2ff,0xbfe2d3ccc544b52b,3
|
| 763 |
+
np.float64,0x80019364e4e326cb,0x80019364e4e326cb,3
|
| 764 |
+
np.float64,0x3fed2902c3fa5206,0x3fe7a5e1df07e5c1,3
|
| 765 |
+
np.float64,0xbfa7b72b5c2f6e50,0xbfa7b2d545b3cc1f,3
|
| 766 |
+
np.float64,0xffdb60dd43b6c1ba,0xbff921fb54442d18,3
|
| 767 |
+
np.float64,0x81a65d8b034cc,0x81a65d8b034cc,3
|
| 768 |
+
np.float64,0x8000c30385818608,0x8000c30385818608,3
|
| 769 |
+
np.float64,0x6022f5f4c045f,0x6022f5f4c045f,3
|
| 770 |
+
np.float64,0x8007a2bb810f4578,0x8007a2bb810f4578,3
|
| 771 |
+
np.float64,0x7fdc68893238d111,0x3ff921fb54442d18,3
|
| 772 |
+
np.float64,0x7fd443454ea8868a,0x3ff921fb54442d18,3
|
| 773 |
+
np.float64,0xffe6b04209ed6084,0xbff921fb54442d18,3
|
| 774 |
+
np.float64,0x7fcd9733d13b2e67,0x3ff921fb54442d18,3
|
| 775 |
+
np.float64,0xf5ee80a9ebdd0,0xf5ee80a9ebdd0,3
|
| 776 |
+
np.float64,0x3fe3788e8de6f11e,0x3fe17dec7e6843a0,3
|
| 777 |
+
np.float64,0x3fee36f62f7c6dec,0x3fe836f832515b43,3
|
| 778 |
+
np.float64,0xf6cb49aded969,0xf6cb49aded969,3
|
| 779 |
+
np.float64,0x3fd2b15ea4a562bc,0x3fd22fdc09920e67,3
|
| 780 |
+
np.float64,0x7fccf6aef139ed5d,0x3ff921fb54442d18,3
|
| 781 |
+
np.float64,0x3fd396b8ce272d72,0x3fd3026118857bd4,3
|
| 782 |
+
np.float64,0x7fe53d3c80ea7a78,0x3ff921fb54442d18,3
|
| 783 |
+
np.float64,0x3feae88fc4f5d120,0x3fe65fb04b18ef7a,3
|
| 784 |
+
np.float64,0x3fedc643747b8c86,0x3fe7fafa6c20e25a,3
|
| 785 |
+
np.float64,0xffdb2dc0df365b82,0xbff921fb54442d18,3
|
| 786 |
+
np.float64,0xbfa2af3658255e70,0xbfa2ad17348f4253,3
|
| 787 |
+
np.float64,0x3f8aa77b30354ef6,0x3f8aa71892336a69,3
|
| 788 |
+
np.float64,0xbfdd1b1efbba363e,0xbfdb510dcd186820,3
|
| 789 |
+
np.float64,0x800f50d99c5ea1b3,0x800f50d99c5ea1b3,3
|
| 790 |
+
np.float64,0xff6ed602403dac00,0xbff921fb54442d18,3
|
| 791 |
+
np.float64,0x800477d71aa8efaf,0x800477d71aa8efaf,3
|
| 792 |
+
np.float64,0xbfe729a9e86e5354,0xbfe40ca78d9eefcf,3
|
| 793 |
+
np.float64,0x3fd81ab2d4303566,0x3fd70d7e3937ea22,3
|
| 794 |
+
np.float64,0xb617cbab6c2fa,0xb617cbab6c2fa,3
|
| 795 |
+
np.float64,0x7fefffffffffffff,0x3ff921fb54442d18,3
|
| 796 |
+
np.float64,0xffa40933ac281260,0xbff921fb54442d18,3
|
| 797 |
+
np.float64,0xbfe1ede621e3dbcc,0xbfe057bb2b341ced,3
|
| 798 |
+
np.float64,0xbfec700f03b8e01e,0xbfe73fb190bc722e,3
|
| 799 |
+
np.float64,0x6e28af02dc517,0x6e28af02dc517,3
|
| 800 |
+
np.float64,0x3fe37ad37ae6f5a7,0x3fe17f94674818a9,3
|
| 801 |
+
np.float64,0x8000cbdeeae197bf,0x8000cbdeeae197bf,3
|
| 802 |
+
np.float64,0x3fe8fd1f01f1fa3e,0x3fe5372bbec5d72c,3
|
| 803 |
+
np.float64,0x3f8f9229103f2452,0x3f8f918531894256,3
|
| 804 |
+
np.float64,0x800536858e0a6d0c,0x800536858e0a6d0c,3
|
| 805 |
+
np.float64,0x7fe82bb4f9f05769,0x3ff921fb54442d18,3
|
| 806 |
+
np.float64,0xffc1c2fb592385f8,0xbff921fb54442d18,3
|
| 807 |
+
np.float64,0x7f924ddfc0249bbf,0x3ff921fb54442d18,3
|
| 808 |
+
np.float64,0xffd5e125c52bc24c,0xbff921fb54442d18,3
|
| 809 |
+
np.float64,0xbfef0d8738be1b0e,0xbfe8a6ef17b16c10,3
|
| 810 |
+
np.float64,0x3fc9c8875233910f,0x3fc9715e708503cb,3
|
| 811 |
+
np.float64,0xbfe2d926f4e5b24e,0xbfe108956e61cbb3,3
|
| 812 |
+
np.float64,0x7fd61c496dac3892,0x3ff921fb54442d18,3
|
| 813 |
+
np.float64,0x7fed545c6b7aa8b8,0x3ff921fb54442d18,3
|
| 814 |
+
np.float64,0x8003746fea86e8e1,0x8003746fea86e8e1,3
|
| 815 |
+
np.float64,0x3fdf515e75bea2bd,0x3fdd201a5585caa3,3
|
| 816 |
+
np.float64,0xffda87c8ee350f92,0xbff921fb54442d18,3
|
| 817 |
+
np.float64,0xffc675d8e22cebb0,0xbff921fb54442d18,3
|
| 818 |
+
np.float64,0xffcdc173433b82e8,0xbff921fb54442d18,3
|
| 819 |
+
np.float64,0xffed9df1517b3be2,0xbff921fb54442d18,3
|
| 820 |
+
np.float64,0x3fd6a2eec72d45de,0x3fd5c1f1d7dcddcf,3
|
| 821 |
+
np.float64,0xffec116a66f822d4,0xbff921fb54442d18,3
|
| 822 |
+
np.float64,0x8007c2a2458f8545,0x8007c2a2458f8545,3
|
| 823 |
+
np.float64,0x3fe4ee80d969dd02,0x3fe2895076094668,3
|
| 824 |
+
np.float64,0x3fe3cae7116795ce,0x3fe1b9c07e0d03a7,3
|
| 825 |
+
np.float64,0xbfd81bf8d8b037f2,0xbfd70e9bbbb4ca57,3
|
| 826 |
+
np.float64,0x800c88ccd1f9119a,0x800c88ccd1f9119a,3
|
| 827 |
+
np.float64,0xffdab2aee2b5655e,0xbff921fb54442d18,3
|
| 828 |
+
np.float64,0x3fe743d227ee87a4,0x3fe41dcaef186d96,3
|
| 829 |
+
np.float64,0x3fb060fd0220c1fa,0x3fb05b47f56ebbb4,3
|
| 830 |
+
np.float64,0xbfd3f03772a7e06e,0xbfd3541522377291,3
|
| 831 |
+
np.float64,0x190a5ae03216,0x190a5ae03216,3
|
| 832 |
+
np.float64,0x3fe48c71916918e4,0x3fe24442f45b3183,3
|
| 833 |
+
np.float64,0x800862470590c48e,0x800862470590c48e,3
|
| 834 |
+
np.float64,0x7fd3ced89d279db0,0x3ff921fb54442d18,3
|
| 835 |
+
np.float64,0x3feb3d9b4ab67b37,0x3fe69140cf2623f7,3
|
| 836 |
+
np.float64,0xbc3f296b787e5,0xbc3f296b787e5,3
|
| 837 |
+
np.float64,0xbfed6b905dfad721,0xbfe7ca1881a8c0fd,3
|
| 838 |
+
np.float64,0xbfe621c2aaac4386,0xbfe35cd1969a82db,3
|
| 839 |
+
np.float64,0x8009e7b17593cf63,0x8009e7b17593cf63,3
|
| 840 |
+
np.float64,0x80045f580ca8beb1,0x80045f580ca8beb1,3
|
| 841 |
+
np.float64,0xbfea2e177e745c2f,0xbfe5f13971633339,3
|
| 842 |
+
np.float64,0x3fee655787fccab0,0x3fe84f6b98b6de26,3
|
| 843 |
+
np.float64,0x3fc9cde92f339bd0,0x3fc9768a88b2c97c,3
|
| 844 |
+
np.float64,0x3fc819c3b3303388,0x3fc7d25e1526e731,3
|
| 845 |
+
np.float64,0x3fd3e848d2a7d090,0x3fd34cd9e6af558f,3
|
| 846 |
+
np.float64,0x3fe19dacac633b5a,0x3fe01a6b4d27adc2,3
|
| 847 |
+
np.float64,0x800b190da316321c,0x800b190da316321c,3
|
| 848 |
+
np.float64,0xd5c69711ab8d3,0xd5c69711ab8d3,3
|
| 849 |
+
np.float64,0xbfdc31bed7b8637e,0xbfda8ea3c1309d6d,3
|
| 850 |
+
np.float64,0xbfd02ba007a05740,0xbfcfad86f0d756dc,3
|
| 851 |
+
np.float64,0x3fe874473d70e88e,0x3fe4e1793cd82123,3
|
| 852 |
+
np.float64,0xffb465585c28cab0,0xbff921fb54442d18,3
|
| 853 |
+
np.float64,0xbfb5d8e13e2bb1c0,0xbfb5cb5c7807fc4d,3
|
| 854 |
+
np.float64,0xffe80f933bf01f26,0xbff921fb54442d18,3
|
| 855 |
+
np.float64,0x7feea783f5fd4f07,0x3ff921fb54442d18,3
|
| 856 |
+
np.float64,0xbfae6665f43cccd0,0xbfae5d45b0a6f90a,3
|
| 857 |
+
np.float64,0x800bd6ef5a77addf,0x800bd6ef5a77addf,3
|
| 858 |
+
np.float64,0x800d145babda28b8,0x800d145babda28b8,3
|
| 859 |
+
np.float64,0x39de155473bc3,0x39de155473bc3,3
|
| 860 |
+
np.float64,0x3fefbd6bb1ff7ad8,0x3fe9008e73a3296e,3
|
| 861 |
+
np.float64,0x3fc40bca3d281798,0x3fc3e2710e167007,3
|
| 862 |
+
np.float64,0x3fcae0918335c120,0x3fca7e09e704a678,3
|
| 863 |
+
np.float64,0x51287fbea2511,0x51287fbea2511,3
|
| 864 |
+
np.float64,0x7fa6bc33a82d7866,0x3ff921fb54442d18,3
|
| 865 |
+
np.float64,0xe72a2bebce546,0xe72a2bebce546,3
|
| 866 |
+
np.float64,0x3fe1c8fd686391fa,0x3fe03b9622aeb4e3,3
|
| 867 |
+
np.float64,0x3fe2a73ac3654e76,0x3fe0e36bc1ee4ac4,3
|
| 868 |
+
np.float64,0x59895218b312b,0x59895218b312b,3
|
| 869 |
+
np.float64,0xc6dc25c78db85,0xc6dc25c78db85,3
|
| 870 |
+
np.float64,0xbfc06cfac520d9f4,0xbfc0561f85d2c907,3
|
| 871 |
+
np.float64,0xbfea912dc4f5225c,0xbfe62c3b1c01c793,3
|
| 872 |
+
np.float64,0x3fb78ce89a2f19d0,0x3fb77bfcb65a67d3,3
|
| 873 |
+
np.float64,0xbfece5cdea39cb9c,0xbfe78103d24099e5,3
|
| 874 |
+
np.float64,0x30d3054e61a61,0x30d3054e61a61,3
|
| 875 |
+
np.float64,0xbfd3fe26fba7fc4e,0xbfd360c8447c4f7a,3
|
| 876 |
+
np.float64,0x800956072a92ac0f,0x800956072a92ac0f,3
|
| 877 |
+
np.float64,0x7fe639b3b6ec7366,0x3ff921fb54442d18,3
|
| 878 |
+
np.float64,0x800ee30240bdc605,0x800ee30240bdc605,3
|
| 879 |
+
np.float64,0x7fef6af0d2bed5e1,0x3ff921fb54442d18,3
|
| 880 |
+
np.float64,0xffefce8725ff9d0d,0xbff921fb54442d18,3
|
| 881 |
+
np.float64,0x3fe2e311da65c624,0x3fe10ff1623089dc,3
|
| 882 |
+
np.float64,0xbfe7e5cbe56fcb98,0xbfe486c3daeda67c,3
|
| 883 |
+
np.float64,0x80095bc14472b783,0x80095bc14472b783,3
|
| 884 |
+
np.float64,0xffef0cb4553e1968,0xbff921fb54442d18,3
|
| 885 |
+
np.float64,0xe3e60567c7cc1,0xe3e60567c7cc1,3
|
| 886 |
+
np.float64,0xffde919f06bd233e,0xbff921fb54442d18,3
|
| 887 |
+
np.float64,0x3fe3f9632e27f2c6,0x3fe1db49ebd21c4e,3
|
| 888 |
+
np.float64,0x9dee9a233bdd4,0x9dee9a233bdd4,3
|
| 889 |
+
np.float64,0xbfe3bb0602e7760c,0xbfe1ae41b6d4c488,3
|
| 890 |
+
np.float64,0x3fc46945a128d288,0x3fc43da54c6c6a2a,3
|
| 891 |
+
np.float64,0x7fdef149ac3de292,0x3ff921fb54442d18,3
|
| 892 |
+
np.float64,0x800a96c76d752d8f,0x800a96c76d752d8f,3
|
| 893 |
+
np.float64,0x3f971a32382e3464,0x3f9719316b9e9baf,3
|
| 894 |
+
np.float64,0x7fe97bcf15b2f79d,0x3ff921fb54442d18,3
|
| 895 |
+
np.float64,0x7fea894558f5128a,0x3ff921fb54442d18,3
|
| 896 |
+
np.float64,0x3fc9e3be1933c780,0x3fc98b847c3923eb,3
|
| 897 |
+
np.float64,0x3f7accac40359959,0x3f7acc9330741b64,3
|
| 898 |
+
np.float64,0xa80c136950183,0xa80c136950183,3
|
| 899 |
+
np.float64,0x3fe408732b2810e6,0x3fe1e61e7cbc8824,3
|
| 900 |
+
np.float64,0xffa775bc042eeb80,0xbff921fb54442d18,3
|
| 901 |
+
np.float64,0x3fbf04bd223e0980,0x3fbede37b8fc697e,3
|
| 902 |
+
np.float64,0x7fd999b34c333366,0x3ff921fb54442d18,3
|
| 903 |
+
np.float64,0xe72146dfce429,0xe72146dfce429,3
|
| 904 |
+
np.float64,0x4f511ee49ea24,0x4f511ee49ea24,3
|
| 905 |
+
np.float64,0xffb3e6e58827cdc8,0xbff921fb54442d18,3
|
| 906 |
+
np.float64,0x3fd1f180cfa3e300,0x3fd17e85b2871de2,3
|
| 907 |
+
np.float64,0x97c8e45b2f91d,0x97c8e45b2f91d,3
|
| 908 |
+
np.float64,0xbfeeb20e88fd641d,0xbfe8778f878440bf,3
|
| 909 |
+
np.float64,0xbfe1fc6dee23f8dc,0xbfe062c815a93cde,3
|
| 910 |
+
np.float64,0xab4bf71f5697f,0xab4bf71f5697f,3
|
| 911 |
+
np.float64,0xa9675a2952cec,0xa9675a2952cec,3
|
| 912 |
+
np.float64,0xbfef3ea4a33e7d49,0xbfe8c02743ebc1b6,3
|
| 913 |
+
np.float64,0x3fe22a2eafa4545d,0x3fe08577afca52a9,3
|
| 914 |
+
np.float64,0x3fe8a08daaf1411c,0x3fe4fd5a34f05305,3
|
| 915 |
+
np.float64,0xbfc6cda77b2d9b50,0xbfc6910bcfa0cf4f,3
|
| 916 |
+
np.float64,0x3fec398394387307,0x3fe7211dd5276500,3
|
| 917 |
+
np.float64,0x3fe36c95c626d92c,0x3fe1752e5aa2357b,3
|
| 918 |
+
np.float64,0xffd8b9e7073173ce,0xbff921fb54442d18,3
|
| 919 |
+
np.float64,0xffe19f043ae33e08,0xbff921fb54442d18,3
|
| 920 |
+
np.float64,0x800e3640709c6c81,0x800e3640709c6c81,3
|
| 921 |
+
np.float64,0x3fe7d6c20aafad84,0x3fe47d1a3307d9c8,3
|
| 922 |
+
np.float64,0x80093fd63b727fad,0x80093fd63b727fad,3
|
| 923 |
+
np.float64,0xffe1a671a4634ce3,0xbff921fb54442d18,3
|
| 924 |
+
np.float64,0xbfe53a6b386a74d6,0xbfe2be41859cb10d,3
|
| 925 |
+
np.float64,0xbfed149a097a2934,0xbfe79ab7e3e93c1c,3
|
| 926 |
+
np.float64,0x7fc2769a5724ed34,0x3ff921fb54442d18,3
|
| 927 |
+
np.float64,0xffd01e4e99a03c9e,0xbff921fb54442d18,3
|
| 928 |
+
np.float64,0xa61f38434c3e7,0xa61f38434c3e7,3
|
| 929 |
+
np.float64,0x800ad4ac5195a959,0x800ad4ac5195a959,3
|
| 930 |
+
np.float64,0x7ff8000000000000,0x7ff8000000000000,3
|
| 931 |
+
np.float64,0x80034a45b6c6948c,0x80034a45b6c6948c,3
|
| 932 |
+
np.float64,0x6350b218c6a17,0x6350b218c6a17,3
|
| 933 |
+
np.float64,0xfff0000000000000,0xbff921fb54442d18,3
|
| 934 |
+
np.float64,0x3fe363e759e6c7cf,0x3fe16ed58d80f9ce,3
|
| 935 |
+
np.float64,0xffe3b98e59e7731c,0xbff921fb54442d18,3
|
| 936 |
+
np.float64,0x3fdbf7b40337ef68,0x3fda5df7ad3c80f9,3
|
| 937 |
+
np.float64,0xbfe9cdf784739bef,0xbfe5b74f346ef93d,3
|
| 938 |
+
np.float64,0xbfc321bea326437c,0xbfc2fdc0d4ff7561,3
|
| 939 |
+
np.float64,0xbfe40f77d2a81ef0,0xbfe1eb28c4ae4dde,3
|
| 940 |
+
np.float64,0x7fe071806960e300,0x3ff921fb54442d18,3
|
| 941 |
+
np.float64,0x7fd269006ea4d200,0x3ff921fb54442d18,3
|
| 942 |
+
np.float64,0x80017a56e0e2f4af,0x80017a56e0e2f4af,3
|
| 943 |
+
np.float64,0x8004b4ea09a969d5,0x8004b4ea09a969d5,3
|
| 944 |
+
np.float64,0xbfedbb01e63b7604,0xbfe7f4f0e84297df,3
|
| 945 |
+
np.float64,0x3fe44454826888a9,0x3fe210ff6d005706,3
|
| 946 |
+
np.float64,0xbfe0e77e6ea1cefd,0xbfdf1a977da33402,3
|
| 947 |
+
np.float64,0xbfed6d4c8c3ada99,0xbfe7cb0932093f60,3
|
| 948 |
+
np.float64,0x1d74cb9e3ae9a,0x1d74cb9e3ae9a,3
|
| 949 |
+
np.float64,0x80082a785d1054f1,0x80082a785d1054f1,3
|
| 950 |
+
np.float64,0x3fe58393266b0726,0x3fe2f0d8e91d4887,3
|
| 951 |
+
np.float64,0xffe4028899680510,0xbff921fb54442d18,3
|
| 952 |
+
np.float64,0x783a2e5af0746,0x783a2e5af0746,3
|
| 953 |
+
np.float64,0x7fcdce88e73b9d11,0x3ff921fb54442d18,3
|
| 954 |
+
np.float64,0x3fc58672a72b0ce5,0x3fc5535e090e56e2,3
|
| 955 |
+
np.float64,0x800889c839b11391,0x800889c839b11391,3
|
| 956 |
+
np.float64,0xffe5e05c466bc0b8,0xbff921fb54442d18,3
|
| 957 |
+
np.float64,0xbfcbef6ebe37dedc,0xbfcb810752468f49,3
|
| 958 |
+
np.float64,0xffe9408563b2810a,0xbff921fb54442d18,3
|
| 959 |
+
np.float64,0xbfee4738367c8e70,0xbfe83f8e5dd7602f,3
|
| 960 |
+
np.float64,0xbfe4aeb587295d6b,0xbfe25c7a0c76a454,3
|
| 961 |
+
np.float64,0xffc9aea0a7335d40,0xbff921fb54442d18,3
|
| 962 |
+
np.float64,0xe1e02199c3c04,0xe1e02199c3c04,3
|
| 963 |
+
np.float64,0xbfbd9400783b2800,0xbfbd729345d1d14f,3
|
| 964 |
+
np.float64,0x7a5418bcf4a84,0x7a5418bcf4a84,3
|
| 965 |
+
np.float64,0x3fdc1c2fa5b83860,0x3fda7c935965ae72,3
|
| 966 |
+
np.float64,0x80076a9f58ced53f,0x80076a9f58ced53f,3
|
| 967 |
+
np.float64,0x3fedc4bf957b897f,0x3fe7fa2a83148f1c,3
|
| 968 |
+
np.float64,0x800981b8a9d30372,0x800981b8a9d30372,3
|
| 969 |
+
np.float64,0xffe1082311621046,0xbff921fb54442d18,3
|
| 970 |
+
np.float64,0xe0091f89c0124,0xe0091f89c0124,3
|
| 971 |
+
np.float64,0xbfce8d674f3d1ad0,0xbfcdfdbf2ddaa0ca,3
|
| 972 |
+
np.float64,0x800516e72eaa2dcf,0x800516e72eaa2dcf,3
|
| 973 |
+
np.float64,0xffe61ee64c6c3dcc,0xbff921fb54442d18,3
|
| 974 |
+
np.float64,0x7fed2683cafa4d07,0x3ff921fb54442d18,3
|
| 975 |
+
np.float64,0xffd4faf27729f5e4,0xbff921fb54442d18,3
|
| 976 |
+
np.float64,0x7fe308fa842611f4,0x3ff921fb54442d18,3
|
| 977 |
+
np.float64,0x3fc612a62b2c2550,0x3fc5db9ddbd4e159,3
|
| 978 |
+
np.float64,0xbfe5b01e766b603d,0xbfe30f72a875e988,3
|
| 979 |
+
np.float64,0x3fc2dd8b9a25bb17,0x3fc2bb06246b9f78,3
|
| 980 |
+
np.float64,0x8170908102e12,0x8170908102e12,3
|
| 981 |
+
np.float64,0x800c1c8a8a583915,0x800c1c8a8a583915,3
|
| 982 |
+
np.float64,0xffe5d91e8b6bb23c,0xbff921fb54442d18,3
|
| 983 |
+
np.float64,0xffd140adee22815c,0xbff921fb54442d18,3
|
| 984 |
+
np.float64,0xbfe2f1f5f8e5e3ec,0xbfe11afa5d749952,3
|
| 985 |
+
np.float64,0xbfed6d1d587ada3b,0xbfe7caef9ecf7651,3
|
| 986 |
+
np.float64,0x3fe9b85e67f370bd,0x3fe5aa3474768982,3
|
| 987 |
+
np.float64,0x7fdc8932edb91265,0x3ff921fb54442d18,3
|
| 988 |
+
np.float64,0x7fd136bc54a26d78,0x3ff921fb54442d18,3
|
| 989 |
+
np.float64,0x800a1ea12a343d43,0x800a1ea12a343d43,3
|
| 990 |
+
np.float64,0x3fec6a5c1b78d4b8,0x3fe73c82235c3f8f,3
|
| 991 |
+
np.float64,0x800fbf6a00df7ed4,0x800fbf6a00df7ed4,3
|
| 992 |
+
np.float64,0xbfd0e6e0cda1cdc2,0xbfd0864bf8cad294,3
|
| 993 |
+
np.float64,0x3fc716df482e2dbf,0x3fc6d7fbfd4a8470,3
|
| 994 |
+
np.float64,0xbfe75990936eb321,0xbfe42bffec3fa0d7,3
|
| 995 |
+
np.float64,0x3fd58e54a02b1ca9,0x3fd4cace1107a5cc,3
|
| 996 |
+
np.float64,0xbfc9c04136338084,0xbfc9696ad2591d54,3
|
| 997 |
+
np.float64,0xdd1f0147ba3e0,0xdd1f0147ba3e0,3
|
| 998 |
+
np.float64,0x5c86a940b90e,0x5c86a940b90e,3
|
| 999 |
+
np.float64,0xbfecae3b8e795c77,0xbfe7624d4988c612,3
|
| 1000 |
+
np.float64,0xffd0370595206e0c,0xbff921fb54442d18,3
|
| 1001 |
+
np.float64,0xbfdc26d443384da8,0xbfda857ecd33ba9f,3
|
| 1002 |
+
np.float64,0xbfd1c849d9a39094,0xbfd15849449cc378,3
|
| 1003 |
+
np.float64,0xffee04acdb3c0959,0xbff921fb54442d18,3
|
| 1004 |
+
np.float64,0xbfded1056dbda20a,0xbfdcb83b30e1528c,3
|
| 1005 |
+
np.float64,0x7fb7b826622f704c,0x3ff921fb54442d18,3
|
| 1006 |
+
np.float64,0xbfee4df8ae7c9bf1,0xbfe8431df9dfd05d,3
|
| 1007 |
+
np.float64,0x7fe7f3670e2fe6cd,0x3ff921fb54442d18,3
|
| 1008 |
+
np.float64,0x8008ac9ae0d15936,0x8008ac9ae0d15936,3
|
| 1009 |
+
np.float64,0x800dce9f3b3b9d3f,0x800dce9f3b3b9d3f,3
|
| 1010 |
+
np.float64,0x7fbb19db203633b5,0x3ff921fb54442d18,3
|
| 1011 |
+
np.float64,0x3fe56c7f302ad8fe,0x3fe2e0eec3ad45fd,3
|
| 1012 |
+
np.float64,0x7fe82c05c570580b,0x3ff921fb54442d18,3
|
| 1013 |
+
np.float64,0xc0552b7780aa6,0xc0552b7780aa6,3
|
| 1014 |
+
np.float64,0x39d40e3073a83,0x39d40e3073a83,3
|
| 1015 |
+
np.float64,0x3fd8db54d731b6aa,0x3fd7b589b3ee9b20,3
|
| 1016 |
+
np.float64,0xffcdd355233ba6ac,0xbff921fb54442d18,3
|
| 1017 |
+
np.float64,0x3fbe97b3a43d2f67,0x3fbe72bca9be0348,3
|
| 1018 |
+
np.float64,0xbff0000000000000,0xbfe921fb54442d18,3
|
| 1019 |
+
np.float64,0xbfb4f55e6229eac0,0xbfb4e96df18a75a7,3
|
| 1020 |
+
np.float64,0xbfc66399ba2cc734,0xbfc62a3298bd96fc,3
|
| 1021 |
+
np.float64,0x3fd00988bb201311,0x3fcf6d67a9374c38,3
|
| 1022 |
+
np.float64,0x7fe471867d28e30c,0x3ff921fb54442d18,3
|
| 1023 |
+
np.float64,0xbfe38e0e64271c1d,0xbfe18d9888b7523b,3
|
| 1024 |
+
np.float64,0x8009dc127573b825,0x8009dc127573b825,3
|
| 1025 |
+
np.float64,0x800047bde4608f7d,0x800047bde4608f7d,3
|
| 1026 |
+
np.float64,0xffeede42c77dbc85,0xbff921fb54442d18,3
|
| 1027 |
+
np.float64,0xd8cf6d13b19ee,0xd8cf6d13b19ee,3
|
| 1028 |
+
np.float64,0xbfd08fb302a11f66,0xbfd034b1f8235e23,3
|
| 1029 |
+
np.float64,0x7fdb404c0b368097,0x3ff921fb54442d18,3
|
| 1030 |
+
np.float64,0xbfd6ba0438ad7408,0xbfd5d673e3276ec1,3
|
| 1031 |
+
np.float64,0xffd9568027b2ad00,0xbff921fb54442d18,3
|
| 1032 |
+
np.float64,0xbfb313b73e262770,0xbfb30ab4acb4fa67,3
|
| 1033 |
+
np.float64,0xbfe2dc1a15e5b834,0xbfe10ac5f8f3acd3,3
|
| 1034 |
+
np.float64,0xbfee426bf4bc84d8,0xbfe83d061df91edd,3
|
| 1035 |
+
np.float64,0xd9142c2fb2286,0xd9142c2fb2286,3
|
| 1036 |
+
np.float64,0x7feb0d11dff61a23,0x3ff921fb54442d18,3
|
| 1037 |
+
np.float64,0x800fea5b509fd4b7,0x800fea5b509fd4b7,3
|
| 1038 |
+
np.float64,0x3fe1a8818da35103,0x3fe022ba1bdf366e,3
|
| 1039 |
+
np.float64,0x8010000000000000,0x8010000000000000,3
|
| 1040 |
+
np.float64,0xbfd8fc6de6b1f8dc,0xbfd7d24726ed8dcc,3
|
| 1041 |
+
np.float64,0xf4b3dc2de967c,0xf4b3dc2de967c,3
|
| 1042 |
+
np.float64,0x8af0409b15e08,0x8af0409b15e08,3
|
| 1043 |
+
np.float64,0x3fb21e6934243cd2,0x3fb216b065f8709a,3
|
| 1044 |
+
np.float64,0x3fc53069392a60d2,0x3fc4ffa931211fb9,3
|
| 1045 |
+
np.float64,0xffc955812c32ab04,0xbff921fb54442d18,3
|
| 1046 |
+
np.float64,0xbfe3de42b1a7bc86,0xbfe1c7bd1324de75,3
|
| 1047 |
+
np.float64,0x1dc149a03b82a,0x1dc149a03b82a,3
|
| 1048 |
+
np.float64,0x8001bc5a24a378b5,0x8001bc5a24a378b5,3
|
| 1049 |
+
np.float64,0x3da14c407b44,0x3da14c407b44,3
|
| 1050 |
+
np.float64,0x80025e8da924bd1c,0x80025e8da924bd1c,3
|
| 1051 |
+
np.float64,0xbfcb0141c9360284,0xbfca9d572ea5e1f3,3
|
| 1052 |
+
np.float64,0xc90036fd92007,0xc90036fd92007,3
|
| 1053 |
+
np.float64,0x138312c427063,0x138312c427063,3
|
| 1054 |
+
np.float64,0x800dda3a963bb475,0x800dda3a963bb475,3
|
| 1055 |
+
np.float64,0x3fe9339934f26732,0x3fe558e723291f78,3
|
| 1056 |
+
np.float64,0xbfea8357027506ae,0xbfe6240826faaf48,3
|
| 1057 |
+
np.float64,0x7fe04735cae08e6b,0x3ff921fb54442d18,3
|
| 1058 |
+
np.float64,0x3fe29aca3c653594,0x3fe0da214c8bc6a4,3
|
| 1059 |
+
np.float64,0x3fbe1f09a03c3e13,0x3fbdfbbefef0155b,3
|
| 1060 |
+
np.float64,0x816ee4ad02ddd,0x816ee4ad02ddd,3
|
| 1061 |
+
np.float64,0xffddd1b31d3ba366,0xbff921fb54442d18,3
|
| 1062 |
+
np.float64,0x3fe2e01e0625c03c,0x3fe10dc0bd6677c2,3
|
| 1063 |
+
np.float64,0x3fec6bcf1978d79e,0x3fe73d518cddeb7c,3
|
| 1064 |
+
np.float64,0x7fe01aaaf8603555,0x3ff921fb54442d18,3
|
| 1065 |
+
np.float64,0xdf300cc5be602,0xdf300cc5be602,3
|
| 1066 |
+
np.float64,0xbfe71c01a36e3804,0xbfe403af80ce47b8,3
|
| 1067 |
+
np.float64,0xffa5be00ac2b7c00,0xbff921fb54442d18,3
|
| 1068 |
+
np.float64,0xbfda9ba711b5374e,0xbfd93775e3ac6bda,3
|
| 1069 |
+
np.float64,0xbfe56d8a27eadb14,0xbfe2e1a7185e8e6d,3
|
| 1070 |
+
np.float64,0x800f1bc937be3792,0x800f1bc937be3792,3
|
| 1071 |
+
np.float64,0x800a61d93c74c3b3,0x800a61d93c74c3b3,3
|
| 1072 |
+
np.float64,0x7fe71a52fcae34a5,0x3ff921fb54442d18,3
|
| 1073 |
+
np.float64,0x7fb4aef256295de4,0x3ff921fb54442d18,3
|
| 1074 |
+
np.float64,0x3fe6c1e861ed83d1,0x3fe3c828f281a7ef,3
|
| 1075 |
+
np.float64,0x3fba128402342508,0x3fb9fb94cf141860,3
|
| 1076 |
+
np.float64,0x3fee55a7ecfcab50,0x3fe8472a9af893ee,3
|
| 1077 |
+
np.float64,0x3fe586f31b2b0de6,0x3fe2f32bce9e91bc,3
|
| 1078 |
+
np.float64,0xbfbb1d1442363a28,0xbfbb034c7729d5f2,3
|
| 1079 |
+
np.float64,0xc78b4d3f8f16a,0xc78b4d3f8f16a,3
|
| 1080 |
+
np.float64,0x7fdbc277d4b784ef,0x3ff921fb54442d18,3
|
| 1081 |
+
np.float64,0xbfa728ca2c2e5190,0xbfa724c04e73ccbd,3
|
| 1082 |
+
np.float64,0x7fefc7b2143f8f63,0x3ff921fb54442d18,3
|
| 1083 |
+
np.float64,0x3fd153a3dda2a748,0x3fd0ebccd33a4dca,3
|
| 1084 |
+
np.float64,0xbfe18a6eace314de,0xbfe00ba32ec89d30,3
|
| 1085 |
+
np.float64,0x7feef518537dea30,0x3ff921fb54442d18,3
|
| 1086 |
+
np.float64,0x8005f007cd4be010,0x8005f007cd4be010,3
|
| 1087 |
+
np.float64,0x7fd890b840b12170,0x3ff921fb54442d18,3
|
| 1088 |
+
np.float64,0x7feed0582ebda0af,0x3ff921fb54442d18,3
|
| 1089 |
+
np.float64,0x1013f53220280,0x1013f53220280,3
|
| 1090 |
+
np.float64,0xbfe77273986ee4e7,0xbfe43c375a8bf6de,3
|
| 1091 |
+
np.float64,0x7fe3ab8918675711,0x3ff921fb54442d18,3
|
| 1092 |
+
np.float64,0xbfc6ad515b2d5aa4,0xbfc671b2f7f86624,3
|
| 1093 |
+
np.float64,0x7fcd86231d3b0c45,0x3ff921fb54442d18,3
|
| 1094 |
+
np.float64,0xffe2523299a4a464,0xbff921fb54442d18,3
|
| 1095 |
+
np.float64,0x7fcadc5a1b35b8b3,0x3ff921fb54442d18,3
|
| 1096 |
+
np.float64,0x3fe5e020c4ebc042,0x3fe330418eec75bd,3
|
| 1097 |
+
np.float64,0x7fe332a9dc266553,0x3ff921fb54442d18,3
|
| 1098 |
+
np.float64,0xfa11dc21f425,0xfa11dc21f425,3
|
| 1099 |
+
np.float64,0xbec800177d900,0xbec800177d900,3
|
| 1100 |
+
np.float64,0x3fcadd057835ba0b,0x3fca7aa42face8bc,3
|
| 1101 |
+
np.float64,0xbfe6b9a206ad7344,0xbfe3c2a9719803de,3
|
| 1102 |
+
np.float64,0x3fbb4250b63684a0,0x3fbb281e9cefc519,3
|
| 1103 |
+
np.float64,0x7fef8787517f0f0e,0x3ff921fb54442d18,3
|
| 1104 |
+
np.float64,0x8001315c2d6262b9,0x8001315c2d6262b9,3
|
| 1105 |
+
np.float64,0xbfd94e3cf2b29c7a,0xbfd819257d36f56c,3
|
| 1106 |
+
np.float64,0xf1f325abe3e65,0xf1f325abe3e65,3
|
| 1107 |
+
np.float64,0x7fd6c07079ad80e0,0x3ff921fb54442d18,3
|
| 1108 |
+
np.float64,0x7fe328b075a65160,0x3ff921fb54442d18,3
|
| 1109 |
+
np.float64,0x7fe7998f812f331e,0x3ff921fb54442d18,3
|
| 1110 |
+
np.float64,0xffe026bb65604d76,0xbff921fb54442d18,3
|
| 1111 |
+
np.float64,0xffd6c06de8ad80dc,0xbff921fb54442d18,3
|
| 1112 |
+
np.float64,0x3fcd5a37bf3ab46f,0x3fccda82935d98ce,3
|
| 1113 |
+
np.float64,0xffc3e5a45227cb48,0xbff921fb54442d18,3
|
| 1114 |
+
np.float64,0x3febf7dd8177efbc,0x3fe6fc0bb999883e,3
|
| 1115 |
+
np.float64,0x7fd7047ea92e08fc,0x3ff921fb54442d18,3
|
| 1116 |
+
np.float64,0x35b3fc406b680,0x35b3fc406b680,3
|
| 1117 |
+
np.float64,0x7fd52e97632a5d2e,0x3ff921fb54442d18,3
|
| 1118 |
+
np.float64,0x3fd464d401a8c9a8,0x3fd3be2967fc97c3,3
|
| 1119 |
+
np.float64,0x800e815b2ebd02b6,0x800e815b2ebd02b6,3
|
| 1120 |
+
np.float64,0x3fca8428af350850,0x3fca257b466b8970,3
|
| 1121 |
+
np.float64,0x8007b7526f6f6ea6,0x8007b7526f6f6ea6,3
|
| 1122 |
+
np.float64,0x82f60a8f05ec2,0x82f60a8f05ec2,3
|
| 1123 |
+
np.float64,0x3fb71a5d0a2e34c0,0x3fb70a629ef8e2a2,3
|
| 1124 |
+
np.float64,0x7fc8570c7d30ae18,0x3ff921fb54442d18,3
|
| 1125 |
+
np.float64,0x7fe5528e77eaa51c,0x3ff921fb54442d18,3
|
| 1126 |
+
np.float64,0xffc20dbbf1241b78,0xbff921fb54442d18,3
|
| 1127 |
+
np.float64,0xeb13368fd6267,0xeb13368fd6267,3
|
| 1128 |
+
np.float64,0x7fe7d529056faa51,0x3ff921fb54442d18,3
|
| 1129 |
+
np.float64,0x3fecd02eabf9a05d,0x3fe77516f0ba1ac4,3
|
| 1130 |
+
np.float64,0x800fcba6a09f974d,0x800fcba6a09f974d,3
|
| 1131 |
+
np.float64,0x7fe7e8e015afd1bf,0x3ff921fb54442d18,3
|
| 1132 |
+
np.float64,0xbfd271a382a4e348,0xbfd1f513a191c595,3
|
| 1133 |
+
np.float64,0x9f1014013e21,0x9f1014013e21,3
|
| 1134 |
+
np.float64,0x3fc05da47f20bb49,0x3fc04708a13a3a47,3
|
| 1135 |
+
np.float64,0x3fe0f427dda1e850,0x3fdf2e60ba8678b9,3
|
| 1136 |
+
np.float64,0xbfecb29fa539653f,0xbfe764bc791c45dd,3
|
| 1137 |
+
np.float64,0x45881ec68b104,0x45881ec68b104,3
|
| 1138 |
+
np.float64,0x8000000000000001,0x8000000000000001,3
|
| 1139 |
+
np.float64,0x3fe9c67ee1338cfe,0x3fe5b2c7b3df6ce8,3
|
| 1140 |
+
np.float64,0x7fedb8fef6bb71fd,0x3ff921fb54442d18,3
|
| 1141 |
+
np.float64,0x3fe54f6aaaea9ed6,0x3fe2ccd1df2abaa9,3
|
| 1142 |
+
np.float64,0x7feff58a1bbfeb13,0x3ff921fb54442d18,3
|
| 1143 |
+
np.float64,0x7fe3b62827276c4f,0x3ff921fb54442d18,3
|
| 1144 |
+
np.float64,0x3fe5feb682ebfd6d,0x3fe345105bc6d980,3
|
| 1145 |
+
np.float64,0x3fe49f38d9693e72,0x3fe2518b2824757f,3
|
| 1146 |
+
np.float64,0x8006bfd27c6d7fa6,0x8006bfd27c6d7fa6,3
|
| 1147 |
+
np.float64,0x3fc13409e2226814,0x3fc119ce0c01a5a2,3
|
| 1148 |
+
np.float64,0x95f8c7212bf19,0x95f8c7212bf19,3
|
| 1149 |
+
np.float64,0x3fd9f0fa6133e1f5,0x3fd8a567515edecf,3
|
| 1150 |
+
np.float64,0x3fef95cbe5ff2b98,0x3fe8ec88c768ba0b,3
|
| 1151 |
+
np.float64,0x3fbed28bba3da510,0x3fbeacbf136e51c2,3
|
| 1152 |
+
np.float64,0xbfd3987aeca730f6,0xbfd303fca58e3e60,3
|
| 1153 |
+
np.float64,0xbfed0f90cbfa1f22,0xbfe797f59249410d,3
|
| 1154 |
+
np.float64,0xffe55d8cbf2abb19,0xbff921fb54442d18,3
|
| 1155 |
+
np.float64,0x3feb4d9fc6769b40,0x3fe69a88131a1f1f,3
|
| 1156 |
+
np.float64,0x80085569acd0aad4,0x80085569acd0aad4,3
|
| 1157 |
+
np.float64,0x20557a6e40ab0,0x20557a6e40ab0,3
|
| 1158 |
+
np.float64,0x3fead2fd5df5a5fb,0x3fe653091f33b27f,3
|
| 1159 |
+
np.float64,0x3fe7b9983eaf7330,0x3fe46a50c4b5235e,3
|
| 1160 |
+
np.float64,0xffdad237ffb5a470,0xbff921fb54442d18,3
|
| 1161 |
+
np.float64,0xbfe5cc39a4eb9874,0xbfe322ad3a903f93,3
|
| 1162 |
+
np.float64,0x800ad6eecb35adde,0x800ad6eecb35adde,3
|
| 1163 |
+
np.float64,0xffec620f6438c41e,0xbff921fb54442d18,3
|
| 1164 |
+
np.float64,0xbfe5ef29122bde52,0xbfe33a7dfcc255e2,3
|
| 1165 |
+
np.float64,0x3fd451e7d0a8a3d0,0x3fd3acfa4939af10,3
|
| 1166 |
+
np.float64,0x8003ea93c127d528,0x8003ea93c127d528,3
|
| 1167 |
+
np.float64,0x800b48d37c9691a7,0x800b48d37c9691a7,3
|
| 1168 |
+
np.float64,0x3fe7e202acafc405,0x3fe484558246069b,3
|
| 1169 |
+
np.float64,0x80070c9b686e1938,0x80070c9b686e1938,3
|
| 1170 |
+
np.float64,0xbfda90bbc6352178,0xbfd92e25fcd12288,3
|
| 1171 |
+
np.float64,0x800e1ffebb1c3ffe,0x800e1ffebb1c3ffe,3
|
| 1172 |
+
np.float64,0x3ff0000000000000,0x3fe921fb54442d18,3
|
| 1173 |
+
np.float64,0xffd8cfdd46319fba,0xbff921fb54442d18,3
|
| 1174 |
+
np.float64,0x7fd8cd4182319a82,0x3ff921fb54442d18,3
|
| 1175 |
+
np.float64,0x3fed8bb778bb176f,0x3fe7db7c77c4c694,3
|
| 1176 |
+
np.float64,0x3fc74a70302e94e0,0x3fc709e95d6defec,3
|
| 1177 |
+
np.float64,0x3fe87269d070e4d4,0x3fe4e04bcc4a2137,3
|
| 1178 |
+
np.float64,0x7fb48223f6290447,0x3ff921fb54442d18,3
|
| 1179 |
+
np.float64,0xffe8ec444b71d888,0xbff921fb54442d18,3
|
| 1180 |
+
np.float64,0x7fde17d280bc2fa4,0x3ff921fb54442d18,3
|
| 1181 |
+
np.float64,0x3fd1cbde01a397bc,0x3fd15b9bb7b3147b,3
|
| 1182 |
+
np.float64,0x800883a64451074d,0x800883a64451074d,3
|
| 1183 |
+
np.float64,0x7fe3160a3f262c13,0x3ff921fb54442d18,3
|
| 1184 |
+
np.float64,0xbfe051d4d9a0a3aa,0xbfde2ecf14dc75fb,3
|
| 1185 |
+
np.float64,0xbfd89de689b13bce,0xbfd780176d1a28a3,3
|
| 1186 |
+
np.float64,0x3fecde2bf779bc58,0x3fe77ccf10bdd8e2,3
|
| 1187 |
+
np.float64,0xffe75774dc6eaee9,0xbff921fb54442d18,3
|
| 1188 |
+
np.float64,0x7fe834414d706882,0x3ff921fb54442d18,3
|
| 1189 |
+
np.float64,0x1,0x1,3
|
| 1190 |
+
np.float64,0xbfea5e4e4a74bc9c,0xbfe60e0601711835,3
|
| 1191 |
+
np.float64,0xffec248d4cb8491a,0xbff921fb54442d18,3
|
| 1192 |
+
np.float64,0xffd9942c2c332858,0xbff921fb54442d18,3
|
| 1193 |
+
np.float64,0xa9db36a553b67,0xa9db36a553b67,3
|
| 1194 |
+
np.float64,0x7fec630718b8c60d,0x3ff921fb54442d18,3
|
| 1195 |
+
np.float64,0xbfd062188f20c432,0xbfd009ecd652be89,3
|
| 1196 |
+
np.float64,0x8001b84e3023709d,0x8001b84e3023709d,3
|
| 1197 |
+
np.float64,0xbfe9e26d7cb3c4db,0xbfe5c3b157ecf668,3
|
| 1198 |
+
np.float64,0xbfef66ddf33ecdbc,0xbfe8d4b1f6410a24,3
|
| 1199 |
+
np.float64,0x3fd8d7109431ae21,0x3fd7b1d4860719a2,3
|
| 1200 |
+
np.float64,0xffee0f53107c1ea5,0xbff921fb54442d18,3
|
| 1201 |
+
np.float64,0x80000b4fd60016a0,0x80000b4fd60016a0,3
|
| 1202 |
+
np.float64,0xbfd99ff6e5333fee,0xbfd85fb3cbdaa049,3
|
| 1203 |
+
np.float64,0xbfe9cfd268339fa5,0xbfe5b86ef021a1b1,3
|
| 1204 |
+
np.float64,0xe32eace1c65d6,0xe32eace1c65d6,3
|
| 1205 |
+
np.float64,0xffc81f6627303ecc,0xbff921fb54442d18,3
|
| 1206 |
+
np.float64,0x7fe98dadde331b5b,0x3ff921fb54442d18,3
|
| 1207 |
+
np.float64,0xbfbcebd11e39d7a0,0xbfbccc8ec47883c7,3
|
| 1208 |
+
np.float64,0x7fe164880f22c90f,0x3ff921fb54442d18,3
|
| 1209 |
+
np.float64,0x800467c0cae8cf82,0x800467c0cae8cf82,3
|
| 1210 |
+
np.float64,0x800071e4b140e3ca,0x800071e4b140e3ca,3
|
| 1211 |
+
np.float64,0xbfc87a7eae30f4fc,0xbfc82fbc55bb0f24,3
|
| 1212 |
+
np.float64,0xffb2e0e23225c1c8,0xbff921fb54442d18,3
|
| 1213 |
+
np.float64,0x20ef338041df,0x20ef338041df,3
|
| 1214 |
+
np.float64,0x7fe6de71ca6dbce3,0x3ff921fb54442d18,3
|
| 1215 |
+
np.float64,0x5d1fa026ba3f5,0x5d1fa026ba3f5,3
|
| 1216 |
+
np.float64,0xffd112a9ce222554,0xbff921fb54442d18,3
|
| 1217 |
+
np.float64,0x3fb351f66626a3ed,0x3fb3489ab578c452,3
|
| 1218 |
+
np.float64,0x7fef7b2bd3bef657,0x3ff921fb54442d18,3
|
| 1219 |
+
np.float64,0xffe144f5d4e289eb,0xbff921fb54442d18,3
|
| 1220 |
+
np.float64,0xffd63a6750ac74ce,0xbff921fb54442d18,3
|
| 1221 |
+
np.float64,0x7fd2d8bb25a5b175,0x3ff921fb54442d18,3
|
| 1222 |
+
np.float64,0x3fec5920a078b242,0x3fe732dcffcf6521,3
|
| 1223 |
+
np.float64,0x80009a8b7f813518,0x80009a8b7f813518,3
|
| 1224 |
+
np.float64,0x3fdea220893d4441,0x3fdc921edf6bf3d8,3
|
| 1225 |
+
np.float64,0x8006cee2208d9dc5,0x8006cee2208d9dc5,3
|
| 1226 |
+
np.float64,0xdd0b0081ba17,0xdd0b0081ba17,3
|
| 1227 |
+
np.float64,0x7ff4000000000000,0x7ffc000000000000,3
|
| 1228 |
+
np.float64,0xbfdac33955358672,0xbfd9592bce7daf1f,3
|
| 1229 |
+
np.float64,0x7fe8301d7170603a,0x3ff921fb54442d18,3
|
| 1230 |
+
np.float64,0xbfc1d34d8523a69c,0xbfc1b62449af9684,3
|
| 1231 |
+
np.float64,0x800c62239458c447,0x800c62239458c447,3
|
| 1232 |
+
np.float64,0xffd398c009a73180,0xbff921fb54442d18,3
|
| 1233 |
+
np.float64,0xbfe0c6d9ee218db4,0xbfdee777557f4401,3
|
| 1234 |
+
np.float64,0x3feccdd373799ba7,0x3fe773c9c2263f89,3
|
| 1235 |
+
np.float64,0xbfd21898bda43132,0xbfd1a2be8545fcc5,3
|
| 1236 |
+
np.float64,0x3fd77019b62ee033,0x3fd67793cabdf267,3
|
| 1237 |
+
np.float64,0x7fa609cad42c1395,0x3ff921fb54442d18,3
|
| 1238 |
+
np.float64,0x7fb4eaea5a29d5d4,0x3ff921fb54442d18,3
|
| 1239 |
+
np.float64,0x3fc570dc9a2ae1b9,0x3fc53e5f6218a799,3
|
| 1240 |
+
np.float64,0x800344ae8466895e,0x800344ae8466895e,3
|
| 1241 |
+
np.float64,0xbfc7c985252f930c,0xbfc784d60fa27bac,3
|
| 1242 |
+
np.float64,0xffaa2929fc345250,0xbff921fb54442d18,3
|
| 1243 |
+
np.float64,0xffe63e5ee9ac7cbe,0xbff921fb54442d18,3
|
| 1244 |
+
np.float64,0x73f0280ce7e06,0x73f0280ce7e06,3
|
| 1245 |
+
np.float64,0xffc525f8822a4bf0,0xbff921fb54442d18,3
|
| 1246 |
+
np.float64,0x7fd744d00aae899f,0x3ff921fb54442d18,3
|
| 1247 |
+
np.float64,0xbfe0fe590761fcb2,0xbfdf3e493e8b1f32,3
|
| 1248 |
+
np.float64,0xfae04ae7f5c0a,0xfae04ae7f5c0a,3
|
| 1249 |
+
np.float64,0xef821939df043,0xef821939df043,3
|
| 1250 |
+
np.float64,0x7fef6135843ec26a,0x3ff921fb54442d18,3
|
| 1251 |
+
np.float64,0xbfebf34dcbf7e69c,0xbfe6f97588a8f911,3
|
| 1252 |
+
np.float64,0xbfeec0b498fd8169,0xbfe87f2eceeead12,3
|
| 1253 |
+
np.float64,0x7fb67161b42ce2c2,0x3ff921fb54442d18,3
|
| 1254 |
+
np.float64,0x3fdcfd998639fb33,0x3fdb38934927c096,3
|
| 1255 |
+
np.float64,0xffda5960bc34b2c2,0xbff921fb54442d18,3
|
| 1256 |
+
np.float64,0xbfe11f8c71223f19,0xbfdf71fe770c96ab,3
|
| 1257 |
+
np.float64,0x3fe4ac1bab695838,0x3fe25aa4517b8322,3
|
| 1258 |
+
np.float64,0x3f730458a02608b1,0x3f73044fabb5e999,3
|
| 1259 |
+
np.float64,0x3fdb14ffcdb62a00,0x3fd99ea6c241a3ed,3
|
| 1260 |
+
np.float64,0xbfc93208cd326410,0xbfc8e09d78b6d4db,3
|
| 1261 |
+
np.float64,0x19e734dc33ce8,0x19e734dc33ce8,3
|
| 1262 |
+
np.float64,0x3fe5e98428abd308,0x3fe336a6a085eb55,3
|
| 1263 |
+
np.float64,0x7fec672a1378ce53,0x3ff921fb54442d18,3
|
| 1264 |
+
np.float64,0x800f8bd8d4ff17b2,0x800f8bd8d4ff17b2,3
|
| 1265 |
+
np.float64,0xbfe5a12e4e6b425c,0xbfe30533f99d5d06,3
|
| 1266 |
+
np.float64,0x75a34cb0eb46a,0x75a34cb0eb46a,3
|
| 1267 |
+
np.float64,0x7fe1d21d16a3a439,0x3ff921fb54442d18,3
|
| 1268 |
+
np.float64,0x7ff0000000000000,0x3ff921fb54442d18,3
|
| 1269 |
+
np.float64,0xffe0f50db261ea1b,0xbff921fb54442d18,3
|
| 1270 |
+
np.float64,0xbfd9dc22feb3b846,0xbfd8937ec965a501,3
|
| 1271 |
+
np.float64,0x8009d68e48d3ad1d,0x8009d68e48d3ad1d,3
|
| 1272 |
+
np.float64,0xbfe2eba620e5d74c,0xbfe1164d7d273c60,3
|
| 1273 |
+
np.float64,0x992efa09325e0,0x992efa09325e0,3
|
| 1274 |
+
np.float64,0x3fdab640ea356c82,0x3fd94e20cab88db2,3
|
| 1275 |
+
np.float64,0x69a6f04ad34df,0x69a6f04ad34df,3
|
| 1276 |
+
np.float64,0x3fe397df25272fbe,0x3fe194bd1a3a6192,3
|
| 1277 |
+
np.float64,0xebcce9fdd799d,0xebcce9fdd799d,3
|
| 1278 |
+
np.float64,0x3fbb49490c369292,0x3fbb2f02eccc497d,3
|
| 1279 |
+
np.float64,0xffd871f980b0e3f4,0xbff921fb54442d18,3
|
| 1280 |
+
np.float64,0x800348f6966691ee,0x800348f6966691ee,3
|
| 1281 |
+
np.float64,0xbfebc270a7f784e1,0xbfe6dda8d0d80f26,3
|
| 1282 |
+
np.float64,0xffd6d559b1adaab4,0xbff921fb54442d18,3
|
| 1283 |
+
np.float64,0x3fec3635c0b86c6c,0x3fe71f420256e43e,3
|
| 1284 |
+
np.float64,0x7fbc82ad7039055a,0x3ff921fb54442d18,3
|
| 1285 |
+
np.float64,0x7f873050602e60a0,0x3ff921fb54442d18,3
|
| 1286 |
+
np.float64,0x3fca44b8c3348970,0x3fc9e8a1a1a2d96e,3
|
| 1287 |
+
np.float64,0x3fe0fc308fe1f861,0x3fdf3aeb469ea225,3
|
| 1288 |
+
np.float64,0x7fefc27de8bf84fb,0x3ff921fb54442d18,3
|
| 1289 |
+
np.float64,0x8005f3f3916be7e8,0x8005f3f3916be7e8,3
|
| 1290 |
+
np.float64,0xbfd4278c7c284f18,0xbfd38678988873b6,3
|
| 1291 |
+
np.float64,0x435eafc486bd7,0x435eafc486bd7,3
|
| 1292 |
+
np.float64,0xbfd01f5199203ea4,0xbfcf96631f2108a3,3
|
| 1293 |
+
np.float64,0xffd5ee9185abdd24,0xbff921fb54442d18,3
|
| 1294 |
+
np.float64,0xffedb363257b66c5,0xbff921fb54442d18,3
|
| 1295 |
+
np.float64,0x800d68e6e11ad1ce,0x800d68e6e11ad1ce,3
|
| 1296 |
+
np.float64,0xbfcf687f8e3ed100,0xbfceccb771b0d39a,3
|
| 1297 |
+
np.float64,0x7feb3b9ef2f6773d,0x3ff921fb54442d18,3
|
| 1298 |
+
np.float64,0x3fe15ec5ca62bd8c,0x3fdfd3fab9d96f81,3
|
| 1299 |
+
np.float64,0x10000000000000,0x10000000000000,3
|
| 1300 |
+
np.float64,0xd2386f81a470e,0xd2386f81a470e,3
|
| 1301 |
+
np.float64,0xb9feed4573fde,0xb9feed4573fde,3
|
| 1302 |
+
np.float64,0x3fe7ed25c9efda4c,0x3fe48b7b72db4014,3
|
| 1303 |
+
np.float64,0xbfe01478726028f1,0xbfddcd1f5a2efc59,3
|
| 1304 |
+
np.float64,0x9946d02f328da,0x9946d02f328da,3
|
| 1305 |
+
np.float64,0xbfe3bb67f06776d0,0xbfe1ae88aa81c5a6,3
|
| 1306 |
+
np.float64,0xbfd3fd8a4c27fb14,0xbfd3603982e3b78d,3
|
| 1307 |
+
np.float64,0xffd5c3ab912b8758,0xbff921fb54442d18,3
|
| 1308 |
+
np.float64,0xffd5f502b12bea06,0xbff921fb54442d18,3
|
| 1309 |
+
np.float64,0xbfc64981ec2c9304,0xbfc610e0382b1fa6,3
|
| 1310 |
+
np.float64,0xffec42e3413885c6,0xbff921fb54442d18,3
|
| 1311 |
+
np.float64,0x80084eb4ed109d6a,0x80084eb4ed109d6a,3
|
| 1312 |
+
np.float64,0xbfd17cac9fa2f95a,0xbfd112020588a4b3,3
|
| 1313 |
+
np.float64,0xbfd06c1359a0d826,0xbfd0134a28aa9a66,3
|
| 1314 |
+
np.float64,0x7fdc3d7c03b87af7,0x3ff921fb54442d18,3
|
| 1315 |
+
np.float64,0x7bdf5aaaf7bec,0x7bdf5aaaf7bec,3
|
| 1316 |
+
np.float64,0xbfee3cd966fc79b3,0xbfe83a14bc07ac3b,3
|
| 1317 |
+
np.float64,0x7fec910da3f9221a,0x3ff921fb54442d18,3
|
| 1318 |
+
np.float64,0xffb4ea667029d4d0,0xbff921fb54442d18,3
|
| 1319 |
+
np.float64,0x800103d7cce207b0,0x800103d7cce207b0,3
|
| 1320 |
+
np.float64,0x7fbb229a6c364534,0x3ff921fb54442d18,3
|
| 1321 |
+
np.float64,0x0,0x0,3
|
| 1322 |
+
np.float64,0xffd8fccd0331f99a,0xbff921fb54442d18,3
|
| 1323 |
+
np.float64,0xbfd0784ae1a0f096,0xbfd01ebff62e39ad,3
|
| 1324 |
+
np.float64,0xbfed2ec9b3ba5d93,0xbfe7a9099410bc76,3
|
| 1325 |
+
np.float64,0x800690b8d16d2172,0x800690b8d16d2172,3
|
| 1326 |
+
np.float64,0x7fc061b26520c364,0x3ff921fb54442d18,3
|
| 1327 |
+
np.float64,0x8007ec47054fd88f,0x8007ec47054fd88f,3
|
| 1328 |
+
np.float64,0x775546b6eeaa9,0x775546b6eeaa9,3
|
| 1329 |
+
np.float64,0x8005e00fb56bc020,0x8005e00fb56bc020,3
|
| 1330 |
+
np.float64,0xbfe510f8d0ea21f2,0xbfe2a16862b5a37f,3
|
| 1331 |
+
np.float64,0xffd87a6bf3b0f4d8,0xbff921fb54442d18,3
|
| 1332 |
+
np.float64,0x800906e3d0520dc8,0x800906e3d0520dc8,3
|
| 1333 |
+
np.float64,0x2296f000452f,0x2296f000452f,3
|
| 1334 |
+
np.float64,0xbfe3189fa2e63140,0xbfe1378c0e005be4,3
|
| 1335 |
+
np.float64,0xb4d2447f69a49,0xb4d2447f69a49,3
|
| 1336 |
+
np.float64,0xffd056a24a20ad44,0xbff921fb54442d18,3
|
| 1337 |
+
np.float64,0xbfe3b23fe4e76480,0xbfe1a7e5840fcbeb,3
|
| 1338 |
+
np.float64,0x80018ee270831dc6,0x80018ee270831dc6,3
|
| 1339 |
+
np.float64,0x800df89f245bf13e,0x800df89f245bf13e,3
|
| 1340 |
+
np.float64,0x3fee1409d7bc2814,0x3fe824779d133232,3
|
| 1341 |
+
np.float64,0xbfef8d81667f1b03,0xbfe8e85523620368,3
|
| 1342 |
+
np.float64,0xffd8a6519b314ca4,0xbff921fb54442d18,3
|
| 1343 |
+
np.float64,0x7fc7bc86f32f790d,0x3ff921fb54442d18,3
|
| 1344 |
+
np.float64,0xffea6159e674c2b3,0xbff921fb54442d18,3
|
| 1345 |
+
np.float64,0x3fe153c3fba2a788,0x3fdfc2f74769d300,3
|
| 1346 |
+
np.float64,0xffc4261ef3284c3c,0xbff921fb54442d18,3
|
| 1347 |
+
np.float64,0x7fe8a8961ff1512b,0x3ff921fb54442d18,3
|
| 1348 |
+
np.float64,0xbfe3fb1fd167f640,0xbfe1dc89dcb7ecdf,3
|
| 1349 |
+
np.float64,0x3fd88577c2b10af0,0x3fd76acc09660704,3
|
| 1350 |
+
np.float64,0x3fe128ec27e251d8,0x3fdf808fc7ebcd8f,3
|
| 1351 |
+
np.float64,0xbfed6ca7c4fad950,0xbfe7caafe9a3e213,3
|
| 1352 |
+
np.float64,0xbf9a3912b8347220,0xbf9a379b3349352e,3
|
| 1353 |
+
np.float64,0xbfd724d7bcae49b0,0xbfd6351efa2a5fc5,3
|
| 1354 |
+
np.float64,0xbfed59700a7ab2e0,0xbfe7c043014c694c,3
|
| 1355 |
+
np.float64,0x8002ad435bc55a87,0x8002ad435bc55a87,3
|
| 1356 |
+
np.float64,0xffe46ed345a8dda6,0xbff921fb54442d18,3
|
| 1357 |
+
np.float64,0x7fd2f1d1d825e3a3,0x3ff921fb54442d18,3
|
| 1358 |
+
np.float64,0xbfea0265e23404cc,0xbfe5d6fb3fd30464,3
|
| 1359 |
+
np.float64,0xbfd17e049122fc0a,0xbfd113421078bbae,3
|
| 1360 |
+
np.float64,0xffea03b986b40772,0xbff921fb54442d18,3
|
| 1361 |
+
np.float64,0x800b55331a16aa67,0x800b55331a16aa67,3
|
| 1362 |
+
np.float64,0xbfc6fcafbf2df960,0xbfc6be9ecd0ebc1f,3
|
| 1363 |
+
np.float64,0xd6a36017ad46c,0xd6a36017ad46c,3
|
| 1364 |
+
np.float64,0xbfe9ba86dfb3750e,0xbfe5ab840cb0ef86,3
|
| 1365 |
+
np.float64,0x75c4a108eb895,0x75c4a108eb895,3
|
| 1366 |
+
np.float64,0x8008d6bc8051ad79,0x8008d6bc8051ad79,3
|
| 1367 |
+
np.float64,0xbfd3dc5984a7b8b4,0xbfd341f78e0528ec,3
|
| 1368 |
+
np.float64,0xffe1cbb01aa39760,0xbff921fb54442d18,3
|
| 1369 |
+
np.float64,0x3fc7e292f52fc526,0x3fc79d0ce9365767,3
|
| 1370 |
+
np.float64,0xbfcbeae2bd37d5c4,0xbfcb7cb034f82467,3
|
| 1371 |
+
np.float64,0x8000f0c62e21e18d,0x8000f0c62e21e18d,3
|
| 1372 |
+
np.float64,0xbfe23d8bc6247b18,0xbfe09418ee35c3c7,3
|
| 1373 |
+
np.float64,0x717394bae2e73,0x717394bae2e73,3
|
| 1374 |
+
np.float64,0xffa2ef1cc425de40,0xbff921fb54442d18,3
|
| 1375 |
+
np.float64,0x3fd938c229b27184,0x3fd806900735c99d,3
|
| 1376 |
+
np.float64,0x800bf3ec8a77e7d9,0x800bf3ec8a77e7d9,3
|
| 1377 |
+
np.float64,0xffeef41dd57de83b,0xbff921fb54442d18,3
|
| 1378 |
+
np.float64,0x8008df97e5b1bf30,0x8008df97e5b1bf30,3
|
| 1379 |
+
np.float64,0xffe9ab9d0db35739,0xbff921fb54442d18,3
|
| 1380 |
+
np.float64,0x99ff391333fe7,0x99ff391333fe7,3
|
| 1381 |
+
np.float64,0x3fb864b4a630c969,0x3fb851e883ea2cf9,3
|
| 1382 |
+
np.float64,0x22c1230a45825,0x22c1230a45825,3
|
| 1383 |
+
np.float64,0xff2336fbfe467,0xff2336fbfe467,3
|
| 1384 |
+
np.float64,0xbfd488f4cea911ea,0xbfd3def0490f5414,3
|
| 1385 |
+
np.float64,0x3fa379c78426f38f,0x3fa377607370800b,3
|
| 1386 |
+
np.float64,0xbfb0873302210e68,0xbfb08155b78dfd53,3
|
| 1387 |
+
np.float64,0xbfdf9ff7c2bf3ff0,0xbfdd5f658e357ad2,3
|
| 1388 |
+
np.float64,0x800978719192f0e4,0x800978719192f0e4,3
|
| 1389 |
+
np.float64,0xbfba8759ea350eb0,0xbfba6f325013b9e5,3
|
| 1390 |
+
np.float64,0xbfdd3e6b06ba7cd6,0xbfdb6e472b6091b0,3
|
| 1391 |
+
np.float64,0x7fe0c334a7a18668,0x3ff921fb54442d18,3
|
| 1392 |
+
np.float64,0xbfeb971feb772e40,0xbfe6c4e0f61404d1,3
|
| 1393 |
+
np.float64,0x3fe2a50968e54a13,0x3fe0e1c8b8d96e85,3
|
| 1394 |
+
np.float64,0x800fa9c5515f538b,0x800fa9c5515f538b,3
|
| 1395 |
+
np.float64,0x800f8532fbbf0a66,0x800f8532fbbf0a66,3
|
| 1396 |
+
np.float64,0x167d6f1e2cfaf,0x167d6f1e2cfaf,3
|
| 1397 |
+
np.float64,0xffee88e769fd11ce,0xbff921fb54442d18,3
|
| 1398 |
+
np.float64,0xbfeecc8529fd990a,0xbfe885520cdad8ea,3
|
| 1399 |
+
np.float64,0xffefffffffffffff,0xbff921fb54442d18,3
|
| 1400 |
+
np.float64,0xbfef6a566afed4ad,0xbfe8d6767b4c4235,3
|
| 1401 |
+
np.float64,0xffec12415af82482,0xbff921fb54442d18,3
|
| 1402 |
+
np.float64,0x3678a20a6cf15,0x3678a20a6cf15,3
|
| 1403 |
+
np.float64,0xffe468d54ee8d1aa,0xbff921fb54442d18,3
|
| 1404 |
+
np.float64,0x800ad6006795ac01,0x800ad6006795ac01,3
|
| 1405 |
+
np.float64,0x8001d5b61063ab6d,0x8001d5b61063ab6d,3
|
| 1406 |
+
np.float64,0x800dfcd1863bf9a3,0x800dfcd1863bf9a3,3
|
| 1407 |
+
np.float64,0xc9fbff6f93f80,0xc9fbff6f93f80,3
|
| 1408 |
+
np.float64,0xffe55c20f9eab842,0xbff921fb54442d18,3
|
| 1409 |
+
np.float64,0xbfcb596b6536b2d8,0xbfcaf1b339c5c615,3
|
| 1410 |
+
np.float64,0xbfe092689ea124d1,0xbfde94fa58946e51,3
|
| 1411 |
+
np.float64,0x3fe9ec733af3d8e6,0x3fe5c9bf5dee2623,3
|
| 1412 |
+
np.float64,0x3fe30f3d83261e7b,0x3fe1309fd6620e03,3
|
| 1413 |
+
np.float64,0xffd31d7f84263b00,0xbff921fb54442d18,3
|
| 1414 |
+
np.float64,0xbfe88d2d3e711a5a,0xbfe4f12b5a136178,3
|
| 1415 |
+
np.float64,0xffc81e4ce1303c98,0xbff921fb54442d18,3
|
| 1416 |
+
np.float64,0xffe5b96ebfab72dd,0xbff921fb54442d18,3
|
| 1417 |
+
np.float64,0x512f0502a25e1,0x512f0502a25e1,3
|
| 1418 |
+
np.float64,0x7fa3a376982746ec,0x3ff921fb54442d18,3
|
| 1419 |
+
np.float64,0x80005b5f2f60b6bf,0x80005b5f2f60b6bf,3
|
| 1420 |
+
np.float64,0xc337cc69866fa,0xc337cc69866fa,3
|
| 1421 |
+
np.float64,0x3fe7719c4caee339,0x3fe43bab42b19e64,3
|
| 1422 |
+
np.float64,0x7fde7ec1d93cfd83,0x3ff921fb54442d18,3
|
| 1423 |
+
np.float64,0x3fd2f38f3825e71e,0x3fd26cc7b1dd0acb,3
|
| 1424 |
+
np.float64,0x7fce298b993c5316,0x3ff921fb54442d18,3
|
| 1425 |
+
np.float64,0x56ae3b2cad5c8,0x56ae3b2cad5c8,3
|
| 1426 |
+
np.float64,0x3fe9299f2bf2533e,0x3fe552bddd999e72,3
|
| 1427 |
+
np.float64,0x7feff3a4823fe748,0x3ff921fb54442d18,3
|
| 1428 |
+
np.float64,0xbfd05c670aa0b8ce,0xbfd00494d78e9e97,3
|
| 1429 |
+
np.float64,0xffe745323eae8a64,0xbff921fb54442d18,3
|
shared/package-files/9b/9b0ff4cbf4f33264cfdb0515fe87c0c1c8a1d11ff29a1524401ac7063f64fe03/blob
ADDED
|
@@ -0,0 +1,324 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Public testing utilities.
|
| 3 |
+
|
| 4 |
+
See also _lib._testing for additional private testing utilities.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
from __future__ import annotations
|
| 8 |
+
|
| 9 |
+
import contextlib
|
| 10 |
+
from collections.abc import Callable, Iterable, Iterator, Sequence
|
| 11 |
+
from functools import wraps
|
| 12 |
+
from types import ModuleType
|
| 13 |
+
from typing import TYPE_CHECKING, Any, ParamSpec, TypeVar, cast
|
| 14 |
+
|
| 15 |
+
from ._lib._utils._compat import is_dask_namespace, is_jax_namespace
|
| 16 |
+
|
| 17 |
+
__all__ = ["lazy_xp_function", "patch_lazy_xp_functions"]
|
| 18 |
+
|
| 19 |
+
if TYPE_CHECKING: # pragma: no cover
|
| 20 |
+
# TODO import override from typing (requires Python >=3.12)
|
| 21 |
+
import pytest
|
| 22 |
+
from dask.typing import Graph, Key, SchedulerGetCallable
|
| 23 |
+
from typing_extensions import override
|
| 24 |
+
|
| 25 |
+
else:
|
| 26 |
+
# Sphinx hacks
|
| 27 |
+
SchedulerGetCallable = object
|
| 28 |
+
|
| 29 |
+
def override(func: object) -> object:
|
| 30 |
+
return func
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
P = ParamSpec("P")
|
| 34 |
+
T = TypeVar("T")
|
| 35 |
+
|
| 36 |
+
_ufuncs_tags: dict[object, dict[str, Any]] = {} # type: ignore[explicit-any]
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def lazy_xp_function( # type: ignore[explicit-any]
|
| 40 |
+
func: Callable[..., Any],
|
| 41 |
+
*,
|
| 42 |
+
allow_dask_compute: int = 0,
|
| 43 |
+
jax_jit: bool = True,
|
| 44 |
+
static_argnums: int | Sequence[int] | None = None,
|
| 45 |
+
static_argnames: str | Iterable[str] | None = None,
|
| 46 |
+
) -> None: # numpydoc ignore=GL07
|
| 47 |
+
"""
|
| 48 |
+
Tag a function to be tested on lazy backends.
|
| 49 |
+
|
| 50 |
+
Tag a function so that when any tests are executed with ``xp=jax.numpy`` the
|
| 51 |
+
function is replaced with a jitted version of itself, and when it is executed with
|
| 52 |
+
``xp=dask.array`` the function will raise if it attempts to materialize the graph.
|
| 53 |
+
This will be later expanded to provide test coverage for other lazy backends.
|
| 54 |
+
|
| 55 |
+
In order for the tag to be effective, the test or a fixture must call
|
| 56 |
+
:func:`patch_lazy_xp_functions`.
|
| 57 |
+
|
| 58 |
+
Parameters
|
| 59 |
+
----------
|
| 60 |
+
func : callable
|
| 61 |
+
Function to be tested.
|
| 62 |
+
allow_dask_compute : int, optional
|
| 63 |
+
Number of times `func` is allowed to internally materialize the Dask graph. This
|
| 64 |
+
is typically triggered by ``bool()``, ``float()``, or ``np.asarray()``.
|
| 65 |
+
|
| 66 |
+
Set to 1 if you are aware that `func` converts the input parameters to NumPy and
|
| 67 |
+
want to let it do so at least for the time being, knowing that it is going to be
|
| 68 |
+
extremely detrimental for performance.
|
| 69 |
+
|
| 70 |
+
If a test needs values higher than 1 to pass, it is a canary that the conversion
|
| 71 |
+
to NumPy/bool/float is happening multiple times, which translates to multiple
|
| 72 |
+
computations of the whole graph. Short of making the function fully lazy, you
|
| 73 |
+
should at least add explicit calls to ``np.asarray()`` early in the function.
|
| 74 |
+
*Note:* the counter of `allow_dask_compute` resets after each call to `func`, so
|
| 75 |
+
a test function that invokes `func` multiple times should still work with this
|
| 76 |
+
parameter set to 1.
|
| 77 |
+
|
| 78 |
+
Default: 0, meaning that `func` must be fully lazy and never materialize the
|
| 79 |
+
graph.
|
| 80 |
+
jax_jit : bool, optional
|
| 81 |
+
Set to True to replace `func` with ``jax.jit(func)`` after calling the
|
| 82 |
+
:func:`patch_lazy_xp_functions` test helper with ``xp=jax.numpy``. Set to False
|
| 83 |
+
if `func` is only compatible with eager (non-jitted) JAX. Default: True.
|
| 84 |
+
static_argnums : int | Sequence[int], optional
|
| 85 |
+
Passed to jax.jit. Positional arguments to treat as static (compile-time
|
| 86 |
+
constant). Default: infer from `static_argnames` using
|
| 87 |
+
`inspect.signature(func)`.
|
| 88 |
+
static_argnames : str | Iterable[str], optional
|
| 89 |
+
Passed to jax.jit. Named arguments to treat as static (compile-time constant).
|
| 90 |
+
Default: infer from `static_argnums` using `inspect.signature(func)`.
|
| 91 |
+
|
| 92 |
+
See Also
|
| 93 |
+
--------
|
| 94 |
+
patch_lazy_xp_functions : Companion function to call from the test or fixture.
|
| 95 |
+
jax.jit : JAX function to compile a function for performance.
|
| 96 |
+
|
| 97 |
+
Examples
|
| 98 |
+
--------
|
| 99 |
+
In ``test_mymodule.py``::
|
| 100 |
+
|
| 101 |
+
from array_api_extra.testing import lazy_xp_function from mymodule import myfunc
|
| 102 |
+
|
| 103 |
+
lazy_xp_function(myfunc)
|
| 104 |
+
|
| 105 |
+
def test_myfunc(xp):
|
| 106 |
+
a = xp.asarray([1, 2])
|
| 107 |
+
# When xp=jax.numpy, this is the same as `b = jax.jit(myfunc)(a)`
|
| 108 |
+
# When xp=dask.array, crash on compute() or persist()
|
| 109 |
+
b = myfunc(a)
|
| 110 |
+
|
| 111 |
+
Notes
|
| 112 |
+
-----
|
| 113 |
+
In order for this tag to be effective, the test function must be imported into the
|
| 114 |
+
test module globals without its namespace; alternatively its namespace must be
|
| 115 |
+
declared in a ``lazy_xp_modules`` list in the test module globals.
|
| 116 |
+
|
| 117 |
+
Example 1::
|
| 118 |
+
|
| 119 |
+
from mymodule import myfunc
|
| 120 |
+
|
| 121 |
+
lazy_xp_function(myfunc)
|
| 122 |
+
|
| 123 |
+
def test_myfunc(xp):
|
| 124 |
+
x = myfunc(xp.asarray([1, 2]))
|
| 125 |
+
|
| 126 |
+
Example 2::
|
| 127 |
+
|
| 128 |
+
import mymodule
|
| 129 |
+
|
| 130 |
+
lazy_xp_modules = [mymodule]
|
| 131 |
+
lazy_xp_function(mymodule.myfunc)
|
| 132 |
+
|
| 133 |
+
def test_myfunc(xp):
|
| 134 |
+
x = mymodule.myfunc(xp.asarray([1, 2]))
|
| 135 |
+
|
| 136 |
+
A test function can circumvent this monkey-patching system by using a namespace
|
| 137 |
+
outside of the two above patterns. You need to sanitize your code to make sure this
|
| 138 |
+
only happens intentionally.
|
| 139 |
+
|
| 140 |
+
Example 1::
|
| 141 |
+
|
| 142 |
+
import mymodule
|
| 143 |
+
from mymodule import myfunc
|
| 144 |
+
|
| 145 |
+
lazy_xp_function(myfunc)
|
| 146 |
+
|
| 147 |
+
def test_myfunc(xp):
|
| 148 |
+
a = xp.asarray([1, 2])
|
| 149 |
+
b = myfunc(a) # This is wrapped when xp=jax.numpy or xp=dask.array
|
| 150 |
+
c = mymodule.myfunc(a) # This is not
|
| 151 |
+
|
| 152 |
+
Example 2::
|
| 153 |
+
|
| 154 |
+
import mymodule
|
| 155 |
+
|
| 156 |
+
class naked:
|
| 157 |
+
myfunc = mymodule.myfunc
|
| 158 |
+
|
| 159 |
+
lazy_xp_modules = [mymodule]
|
| 160 |
+
lazy_xp_function(mymodule.myfunc)
|
| 161 |
+
|
| 162 |
+
def test_myfunc(xp):
|
| 163 |
+
a = xp.asarray([1, 2])
|
| 164 |
+
b = mymodule.myfunc(a) # This is wrapped when xp=jax.numpy or xp=dask.array
|
| 165 |
+
c = naked.myfunc(a) # This is not
|
| 166 |
+
"""
|
| 167 |
+
tags = {
|
| 168 |
+
"allow_dask_compute": allow_dask_compute,
|
| 169 |
+
"jax_jit": jax_jit,
|
| 170 |
+
"static_argnums": static_argnums,
|
| 171 |
+
"static_argnames": static_argnames,
|
| 172 |
+
}
|
| 173 |
+
try:
|
| 174 |
+
func._lazy_xp_function = tags # type: ignore[attr-defined] # pylint: disable=protected-access # pyright: ignore[reportFunctionMemberAccess]
|
| 175 |
+
except AttributeError: # @cython.vectorize
|
| 176 |
+
_ufuncs_tags[func] = tags
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
def patch_lazy_xp_functions(
|
| 180 |
+
request: pytest.FixtureRequest, monkeypatch: pytest.MonkeyPatch, *, xp: ModuleType
|
| 181 |
+
) -> None:
|
| 182 |
+
"""
|
| 183 |
+
Test lazy execution of functions tagged with :func:`lazy_xp_function`.
|
| 184 |
+
|
| 185 |
+
If ``xp==jax.numpy``, search for all functions which have been tagged with
|
| 186 |
+
:func:`lazy_xp_function` in the globals of the module that defines the current test,
|
| 187 |
+
as well as in the ``lazy_xp_modules`` list in the globals of the same module,
|
| 188 |
+
and wrap them with :func:`jax.jit`. Unwrap them at the end of the test.
|
| 189 |
+
|
| 190 |
+
If ``xp==dask.array``, wrap the functions with a decorator that disables
|
| 191 |
+
``compute()`` and ``persist()`` and ensures that exceptions and warnings are raised
|
| 192 |
+
eagerly.
|
| 193 |
+
|
| 194 |
+
This function should be typically called by your library's `xp` fixture that runs
|
| 195 |
+
tests on multiple backends::
|
| 196 |
+
|
| 197 |
+
@pytest.fixture(params=[numpy, array_api_strict, jax.numpy, dask.array])
|
| 198 |
+
def xp(request, monkeypatch):
|
| 199 |
+
patch_lazy_xp_functions(request, monkeypatch, xp=request.param)
|
| 200 |
+
return request.param
|
| 201 |
+
|
| 202 |
+
but it can be otherwise be called by the test itself too.
|
| 203 |
+
|
| 204 |
+
Parameters
|
| 205 |
+
----------
|
| 206 |
+
request : pytest.FixtureRequest
|
| 207 |
+
Pytest fixture, as acquired by the test itself or by one of its fixtures.
|
| 208 |
+
monkeypatch : pytest.MonkeyPatch
|
| 209 |
+
Pytest fixture, as acquired by the test itself or by one of its fixtures.
|
| 210 |
+
xp : array_namespace
|
| 211 |
+
Array namespace to be tested.
|
| 212 |
+
|
| 213 |
+
See Also
|
| 214 |
+
--------
|
| 215 |
+
lazy_xp_function : Tag a function to be tested on lazy backends.
|
| 216 |
+
pytest.FixtureRequest : `request` test function parameter.
|
| 217 |
+
"""
|
| 218 |
+
mod = cast(ModuleType, request.module)
|
| 219 |
+
mods = [mod, *cast(list[ModuleType], getattr(mod, "lazy_xp_modules", []))]
|
| 220 |
+
|
| 221 |
+
def iter_tagged() -> ( # type: ignore[explicit-any]
|
| 222 |
+
Iterator[tuple[ModuleType, str, Callable[..., Any], dict[str, Any]]]
|
| 223 |
+
):
|
| 224 |
+
for mod in mods:
|
| 225 |
+
for name, func in mod.__dict__.items():
|
| 226 |
+
tags: dict[str, Any] | None = None # type: ignore[explicit-any]
|
| 227 |
+
with contextlib.suppress(AttributeError):
|
| 228 |
+
tags = func._lazy_xp_function # pylint: disable=protected-access
|
| 229 |
+
if tags is None:
|
| 230 |
+
with contextlib.suppress(KeyError, TypeError):
|
| 231 |
+
tags = _ufuncs_tags[func]
|
| 232 |
+
if tags is not None:
|
| 233 |
+
yield mod, name, func, tags
|
| 234 |
+
|
| 235 |
+
if is_dask_namespace(xp):
|
| 236 |
+
for mod, name, func, tags in iter_tagged():
|
| 237 |
+
n = tags["allow_dask_compute"]
|
| 238 |
+
wrapped = _dask_wrap(func, n)
|
| 239 |
+
monkeypatch.setattr(mod, name, wrapped)
|
| 240 |
+
|
| 241 |
+
elif is_jax_namespace(xp):
|
| 242 |
+
import jax
|
| 243 |
+
|
| 244 |
+
for mod, name, func, tags in iter_tagged():
|
| 245 |
+
if tags["jax_jit"]:
|
| 246 |
+
# suppress unused-ignore to run mypy in -e lint as well as -e dev
|
| 247 |
+
wrapped = cast( # type: ignore[explicit-any]
|
| 248 |
+
Callable[..., Any],
|
| 249 |
+
jax.jit(
|
| 250 |
+
func,
|
| 251 |
+
static_argnums=tags["static_argnums"],
|
| 252 |
+
static_argnames=tags["static_argnames"],
|
| 253 |
+
),
|
| 254 |
+
)
|
| 255 |
+
monkeypatch.setattr(mod, name, wrapped)
|
| 256 |
+
|
| 257 |
+
|
| 258 |
+
class CountingDaskScheduler(SchedulerGetCallable):
|
| 259 |
+
"""
|
| 260 |
+
Dask scheduler that counts how many times `dask.compute` is called.
|
| 261 |
+
|
| 262 |
+
If the number of times exceeds 'max_count', it raises an error.
|
| 263 |
+
This is a wrapper around Dask's own 'synchronous' scheduler.
|
| 264 |
+
|
| 265 |
+
Parameters
|
| 266 |
+
----------
|
| 267 |
+
max_count : int
|
| 268 |
+
Maximum number of allowed calls to `dask.compute`.
|
| 269 |
+
msg : str
|
| 270 |
+
Assertion to raise when the count exceeds `max_count`.
|
| 271 |
+
"""
|
| 272 |
+
|
| 273 |
+
count: int
|
| 274 |
+
max_count: int
|
| 275 |
+
msg: str
|
| 276 |
+
|
| 277 |
+
def __init__(self, max_count: int, msg: str): # numpydoc ignore=GL08
|
| 278 |
+
self.count = 0
|
| 279 |
+
self.max_count = max_count
|
| 280 |
+
self.msg = msg
|
| 281 |
+
|
| 282 |
+
@override
|
| 283 |
+
def __call__(self, dsk: Graph, keys: Sequence[Key] | Key, **kwargs: Any) -> Any: # type: ignore[decorated-any,explicit-any] # numpydoc ignore=GL08
|
| 284 |
+
import dask
|
| 285 |
+
|
| 286 |
+
self.count += 1
|
| 287 |
+
# This should yield a nice traceback to the
|
| 288 |
+
# offending line in the user's code
|
| 289 |
+
assert self.count <= self.max_count, self.msg
|
| 290 |
+
|
| 291 |
+
return dask.get(dsk, keys, **kwargs) # type: ignore[attr-defined,no-untyped-call] # pyright: ignore[reportPrivateImportUsage]
|
| 292 |
+
|
| 293 |
+
|
| 294 |
+
def _dask_wrap(
|
| 295 |
+
func: Callable[P, T], n: int
|
| 296 |
+
) -> Callable[P, T]: # numpydoc ignore=PR01,RT01
|
| 297 |
+
"""
|
| 298 |
+
Wrap `func` to raise if it attempts to call `dask.compute` more than `n` times.
|
| 299 |
+
|
| 300 |
+
After the function returns, materialize the graph in order to re-raise exceptions.
|
| 301 |
+
"""
|
| 302 |
+
import dask
|
| 303 |
+
|
| 304 |
+
func_name = getattr(func, "__name__", str(func))
|
| 305 |
+
n_str = f"only up to {n}" if n else "no"
|
| 306 |
+
msg = (
|
| 307 |
+
f"Called `dask.compute()` or `dask.persist()` {n + 1} times, "
|
| 308 |
+
f"but {n_str} calls are allowed. Set "
|
| 309 |
+
f"`lazy_xp_function({func_name}, allow_dask_compute={n + 1})` "
|
| 310 |
+
"to allow for more (but note that this will harm performance). "
|
| 311 |
+
)
|
| 312 |
+
|
| 313 |
+
@wraps(func)
|
| 314 |
+
def wrapper(*args: P.args, **kwargs: P.kwargs) -> T: # numpydoc ignore=GL08
|
| 315 |
+
scheduler = CountingDaskScheduler(n, msg)
|
| 316 |
+
with dask.config.set({"scheduler": scheduler}): # pyright: ignore[reportPrivateImportUsage]
|
| 317 |
+
out = func(*args, **kwargs)
|
| 318 |
+
|
| 319 |
+
# Block until the graph materializes and reraise exceptions. This allows
|
| 320 |
+
# `pytest.raises` and `pytest.warns` to work as expected. Note that this would
|
| 321 |
+
# not work on scheduler='distributed', as it would not block.
|
| 322 |
+
return dask.persist(out, scheduler="threads")[0] # type: ignore[attr-defined,no-untyped-call,func-returns-value,index] # pyright: ignore[reportPrivateImportUsage]
|
| 323 |
+
|
| 324 |
+
return wrapper
|
shared/package-files/9b/9b105adfedc6b6b82f4695ca9bfe232393034cdf79803523f397a6dc5bf824d1/blob
ADDED
|
Binary file (1.54 kB). View file
|
|
|
shared/package-files/9b/9b1066af79ac4795bb4446ba33581ace72de0ee3bd979905840badd5598bda7a/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 _sparse_mm_reduce_impl {
|
| 18 |
+
using schema = ::std::tuple<at::Tensor,at::Tensor> (const at::Tensor &, const at::Tensor &, c10::string_view);
|
| 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::_sparse_mm_reduce_impl")
|
| 22 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
|
| 23 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_sparse_mm_reduce_impl(Tensor self, Tensor other, str reduce) -> (Tensor, Tensor)")
|
| 24 |
+
static ::std::tuple<at::Tensor,at::Tensor> call(const at::Tensor & self, const at::Tensor & other, c10::string_view reduce);
|
| 25 |
+
static ::std::tuple<at::Tensor,at::Tensor> redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Tensor & other, c10::string_view reduce);
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
}} // namespace at::_ops
|
shared/package-files/9b/9b110614ea0eefae7c0d74748c47bf4ed50dd144a134754cef1a24705b9fb377/blob
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
#include <ATen/detail/CUDAHooksInterface.h>
|
| 3 |
+
namespace at::cuda {
|
| 4 |
+
// Forward-declares at::cuda::NVRTC
|
| 5 |
+
struct NVRTC;
|
| 6 |
+
|
| 7 |
+
namespace detail {
|
| 8 |
+
extern NVRTC lazyNVRTC;
|
| 9 |
+
} // namespace detail
|
| 10 |
+
|
| 11 |
+
} // namespace at::cuda
|
shared/package-files/9b/9b149709fc0432cdc59b496b4e33cc35dafc99321bf7afd9092fe0400027a576/blob
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Shared result type for the AR/ARMA parameter estimation functions in
|
| 3 |
+
statsmodels.tsa.arima.estimators.
|
| 4 |
+
|
| 5 |
+
Author: Chad Fulton
|
| 6 |
+
License: BSD-3
|
| 7 |
+
"""
|
| 8 |
+
from typing import NamedTuple
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class ARMAEstimationResult(NamedTuple):
|
| 12 |
+
"""
|
| 13 |
+
Result of an ARIMA parameter estimator.
|
| 14 |
+
|
| 15 |
+
Common to :func:`~statsmodels.tsa.arima.estimators.burg.burg`,
|
| 16 |
+
:func:`~statsmodels.tsa.arima.estimators.gls.gls`,
|
| 17 |
+
:func:`~statsmodels.tsa.arima.estimators.hannan_rissanen.hannan_rissanen`,
|
| 18 |
+
:func:`~statsmodels.tsa.arima.estimators.innovations.innovations`,
|
| 19 |
+
:func:`~statsmodels.tsa.arima.estimators.innovations.innovations_mle`,
|
| 20 |
+
:func:`~statsmodels.tsa.arima.estimators.yule_walker.yule_walker`,
|
| 21 |
+
:func:`~statsmodels.tsa.arima.estimators.durbin_levinson.durbin_levinson`,
|
| 22 |
+
and :func:`~statsmodels.tsa.arima.estimators.statespace.statespace`.
|
| 23 |
+
|
| 24 |
+
Parameters
|
| 25 |
+
----------
|
| 26 |
+
parameters : SARIMAXParams or list of SARIMAXParams
|
| 27 |
+
Contains the parameter estimates from the final iteration. A list
|
| 28 |
+
of ``SARIMAXParams`` objects for :func:`innovations` and
|
| 29 |
+
:func:`durbin_levinson`, which estimate at multiple orders; a
|
| 30 |
+
single ``SARIMAXParams`` object for all other estimators.
|
| 31 |
+
other_results : Bunch
|
| 32 |
+
Estimator-specific ancillary results, always including at least
|
| 33 |
+
``spec``, the ``SARIMAXSpecification`` instance corresponding to
|
| 34 |
+
the input arguments. See the individual estimator's docstring for
|
| 35 |
+
the full set of components.
|
| 36 |
+
"""
|
| 37 |
+
|
| 38 |
+
parameters: object
|
| 39 |
+
other_results: object
|
shared/package-files/9b/9b14c96a807865ee74964fb64e0568a66aeb6ee41b12a52c6707372b51fcc3e4/blob
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from sympy.core.symbol import symbols, Dummy
|
| 2 |
+
from sympy.matrices.expressions.applyfunc import ElementwiseApplyFunction
|
| 3 |
+
from sympy.core.function import Lambda
|
| 4 |
+
from sympy.functions.elementary.exponential import exp
|
| 5 |
+
from sympy.functions.elementary.trigonometric import sin
|
| 6 |
+
from sympy.matrices.dense import Matrix
|
| 7 |
+
from sympy.matrices.expressions.matexpr import MatrixSymbol
|
| 8 |
+
from sympy.matrices.expressions.matmul import MatMul
|
| 9 |
+
from sympy.simplify.simplify import simplify
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
X = MatrixSymbol("X", 3, 3)
|
| 13 |
+
Y = MatrixSymbol("Y", 3, 3)
|
| 14 |
+
|
| 15 |
+
k = symbols("k")
|
| 16 |
+
Xk = MatrixSymbol("X", k, k)
|
| 17 |
+
|
| 18 |
+
Xd = X.as_explicit()
|
| 19 |
+
|
| 20 |
+
x, y, z, t = symbols("x y z t")
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def test_applyfunc_matrix():
|
| 24 |
+
x = Dummy('x')
|
| 25 |
+
double = Lambda(x, x**2)
|
| 26 |
+
|
| 27 |
+
expr = ElementwiseApplyFunction(double, Xd)
|
| 28 |
+
assert isinstance(expr, ElementwiseApplyFunction)
|
| 29 |
+
assert expr.doit() == Xd.applyfunc(lambda x: x**2)
|
| 30 |
+
assert expr.shape == (3, 3)
|
| 31 |
+
assert expr.func(*expr.args) == expr
|
| 32 |
+
assert simplify(expr) == expr
|
| 33 |
+
assert expr[0, 0] == double(Xd[0, 0])
|
| 34 |
+
|
| 35 |
+
expr = ElementwiseApplyFunction(double, X)
|
| 36 |
+
assert isinstance(expr, ElementwiseApplyFunction)
|
| 37 |
+
assert isinstance(expr.doit(), ElementwiseApplyFunction)
|
| 38 |
+
assert expr == X.applyfunc(double)
|
| 39 |
+
assert expr.func(*expr.args) == expr
|
| 40 |
+
|
| 41 |
+
expr = ElementwiseApplyFunction(exp, X*Y)
|
| 42 |
+
assert expr.expr == X*Y
|
| 43 |
+
assert expr.function.dummy_eq(Lambda(x, exp(x)))
|
| 44 |
+
assert expr.dummy_eq((X*Y).applyfunc(exp))
|
| 45 |
+
assert expr.func(*expr.args) == expr
|
| 46 |
+
|
| 47 |
+
assert isinstance(X*expr, MatMul)
|
| 48 |
+
assert (X*expr).shape == (3, 3)
|
| 49 |
+
Z = MatrixSymbol("Z", 2, 3)
|
| 50 |
+
assert (Z*expr).shape == (2, 3)
|
| 51 |
+
|
| 52 |
+
expr = ElementwiseApplyFunction(exp, Z.T)*ElementwiseApplyFunction(exp, Z)
|
| 53 |
+
assert expr.shape == (3, 3)
|
| 54 |
+
expr = ElementwiseApplyFunction(exp, Z)*ElementwiseApplyFunction(exp, Z.T)
|
| 55 |
+
assert expr.shape == (2, 2)
|
| 56 |
+
|
| 57 |
+
M = Matrix([[x, y], [z, t]])
|
| 58 |
+
expr = ElementwiseApplyFunction(sin, M)
|
| 59 |
+
assert isinstance(expr, ElementwiseApplyFunction)
|
| 60 |
+
assert expr.function.dummy_eq(Lambda(x, sin(x)))
|
| 61 |
+
assert expr.expr == M
|
| 62 |
+
assert expr.doit() == M.applyfunc(sin)
|
| 63 |
+
assert expr.doit() == Matrix([[sin(x), sin(y)], [sin(z), sin(t)]])
|
| 64 |
+
assert expr.func(*expr.args) == expr
|
| 65 |
+
|
| 66 |
+
expr = ElementwiseApplyFunction(double, Xk)
|
| 67 |
+
assert expr.doit() == expr
|
| 68 |
+
assert expr.subs(k, 2).shape == (2, 2)
|
| 69 |
+
assert (expr*expr).shape == (k, k)
|
| 70 |
+
M = MatrixSymbol("M", k, t)
|
| 71 |
+
expr2 = M.T*expr*M
|
| 72 |
+
assert isinstance(expr2, MatMul)
|
| 73 |
+
assert expr2.args[1] == expr
|
| 74 |
+
assert expr2.shape == (t, t)
|
| 75 |
+
expr3 = expr*M
|
| 76 |
+
assert expr3.shape == (k, t)
|
| 77 |
+
|
| 78 |
+
expr1 = ElementwiseApplyFunction(lambda x: x+1, Xk)
|
| 79 |
+
expr2 = ElementwiseApplyFunction(lambda x: x, Xk)
|
| 80 |
+
assert expr1 != expr2
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
def test_applyfunc_entry():
|
| 84 |
+
|
| 85 |
+
af = X.applyfunc(sin)
|
| 86 |
+
assert af[0, 0] == sin(X[0, 0])
|
| 87 |
+
|
| 88 |
+
af = Xd.applyfunc(sin)
|
| 89 |
+
assert af[0, 0] == sin(X[0, 0])
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
def test_applyfunc_as_explicit():
|
| 93 |
+
|
| 94 |
+
af = X.applyfunc(sin)
|
| 95 |
+
assert af.as_explicit() == Matrix([
|
| 96 |
+
[sin(X[0, 0]), sin(X[0, 1]), sin(X[0, 2])],
|
| 97 |
+
[sin(X[1, 0]), sin(X[1, 1]), sin(X[1, 2])],
|
| 98 |
+
[sin(X[2, 0]), sin(X[2, 1]), sin(X[2, 2])],
|
| 99 |
+
])
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
def test_applyfunc_transpose():
|
| 103 |
+
|
| 104 |
+
af = Xk.applyfunc(sin)
|
| 105 |
+
assert af.T.dummy_eq(Xk.T.applyfunc(sin))
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def test_applyfunc_shape_11_matrices():
|
| 109 |
+
M = MatrixSymbol("M", 1, 1)
|
| 110 |
+
|
| 111 |
+
double = Lambda(x, x*2)
|
| 112 |
+
|
| 113 |
+
expr = M.applyfunc(sin)
|
| 114 |
+
assert isinstance(expr, ElementwiseApplyFunction)
|
| 115 |
+
|
| 116 |
+
expr = M.applyfunc(double)
|
| 117 |
+
assert isinstance(expr, MatMul)
|
| 118 |
+
assert expr == 2*M
|
shared/package-files/9b/9b152deb0e3d095c45b1ce7937e25dc5c1d9e3aaf9bee11eb5b5444f590ab862/model.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9b152deb0e3d095c45b1ce7937e25dc5c1d9e3aaf9bee11eb5b5444f590ab862
|
| 3 |
+
size 2235917054
|
shared/package-files/9b/9b156a37c540d4ea39994bad9664abd0a4bd57acfa72ffec72409c36a4532f2c/blob
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9b156a37c540d4ea39994bad9664abd0a4bd57acfa72ffec72409c36a4532f2c
|
| 3 |
+
size 417616
|
shared/package-files/9b/9b15c668d6a6afe9d1ce1a3f5571f71da43266871a1cd698fb4913043d6d8c24/blob
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace cpu {
|
| 19 |
+
|
| 20 |
+
TORCH_API at::Tensor & logical_or_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & other);
|
| 21 |
+
TORCH_API at::Tensor & logical_or_outf(const at::Tensor & self, const at::Tensor & other, at::Tensor & out);
|
| 22 |
+
|
| 23 |
+
} // namespace cpu
|
| 24 |
+
} // namespace at
|
shared/package-files/9b/9b16504660713d61693f7c7ebfe677239a640f93fc572807f3739fba203a2cdd/blob
ADDED
|
@@ -0,0 +1,468 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 49 |
+
-0.03
|
| 50 |
+
-0.01
|
| 51 |
+
0.07
|
| 52 |
+
0.12
|
| 53 |
+
0.05
|
| 54 |
+
0.09
|
| 55 |
+
0.04
|
| 56 |
+
-0.03
|
| 57 |
+
-0.04
|
| 58 |
+
0.04
|
| 59 |
+
0.06
|
| 60 |
+
0.05
|
| 61 |
+
-0.11
|
| 62 |
+
0.03
|
| 63 |
+
-0.02
|
| 64 |
+
-0.01
|
| 65 |
+
-0.01
|
| 66 |
+
0.01
|
| 67 |
+
0
|
| 68 |
+
0.01
|
| 69 |
+
0.01
|
| 70 |
+
0.02
|
| 71 |
+
-0.01
|
| 72 |
+
-0.02
|
| 73 |
+
0
|
| 74 |
+
0.02
|
| 75 |
+
0.04
|
| 76 |
+
0.08
|
| 77 |
+
0.13
|
| 78 |
+
0.08
|
| 79 |
+
0
|
| 80 |
+
-0.01
|
| 81 |
+
0.03
|
| 82 |
+
-0.06
|
| 83 |
+
-0.07
|
| 84 |
+
-0.01
|
| 85 |
+
-0.03
|
| 86 |
+
-0.1
|
| 87 |
+
-0.1
|
| 88 |
+
-0.04
|
| 89 |
+
0
|
| 90 |
+
0.02
|
| 91 |
+
0.01
|
| 92 |
+
-0.01
|
| 93 |
+
-0.02
|
| 94 |
+
-0.01
|
| 95 |
+
-0.01
|
| 96 |
+
0
|
| 97 |
+
0
|
| 98 |
+
0.02
|
| 99 |
+
0.01
|
| 100 |
+
0.01
|
| 101 |
+
0.01
|
| 102 |
+
0.01
|
| 103 |
+
0.01
|
| 104 |
+
0.04
|
| 105 |
+
0.03
|
| 106 |
+
0
|
| 107 |
+
-0.01
|
| 108 |
+
0.04
|
| 109 |
+
-0.02
|
| 110 |
+
-0.02
|
| 111 |
+
0.02
|
| 112 |
+
0.08
|
| 113 |
+
0.05
|
| 114 |
+
0.03
|
| 115 |
+
0.04
|
| 116 |
+
0.13
|
| 117 |
+
0.14
|
| 118 |
+
0.1
|
| 119 |
+
0.07
|
| 120 |
+
0.13
|
| 121 |
+
0.12
|
| 122 |
+
-0.02
|
| 123 |
+
-0.04
|
| 124 |
+
0.01
|
| 125 |
+
0.08
|
| 126 |
+
0.11
|
| 127 |
+
0.1
|
| 128 |
+
0.09
|
| 129 |
+
0.11
|
| 130 |
+
0.06
|
| 131 |
+
0.1
|
| 132 |
+
-0.06
|
| 133 |
+
-0.2
|
| 134 |
+
-0.17
|
| 135 |
+
0.02
|
| 136 |
+
-0.01
|
| 137 |
+
-0.05
|
| 138 |
+
-0.07
|
| 139 |
+
-0.02
|
| 140 |
+
0.14
|
| 141 |
+
0.2
|
| 142 |
+
0.05
|
| 143 |
+
-0.05
|
| 144 |
+
-0.02
|
| 145 |
+
0.02
|
| 146 |
+
0.02
|
| 147 |
+
-0.04
|
| 148 |
+
0.01
|
| 149 |
+
0.1
|
| 150 |
+
0.08
|
| 151 |
+
0.04
|
| 152 |
+
0.01
|
| 153 |
+
0.09
|
| 154 |
+
0.1
|
| 155 |
+
-0.02
|
| 156 |
+
0.02
|
| 157 |
+
0.06
|
| 158 |
+
0
|
| 159 |
+
-0.09
|
| 160 |
+
-0.05
|
| 161 |
+
0.08
|
| 162 |
+
-0.02
|
| 163 |
+
-0.04
|
| 164 |
+
-0.14
|
| 165 |
+
-0.07
|
| 166 |
+
0.1
|
| 167 |
+
-0.03
|
| 168 |
+
0.02
|
| 169 |
+
0
|
| 170 |
+
-0.03
|
| 171 |
+
-0.05
|
| 172 |
+
-0.01
|
| 173 |
+
0
|
| 174 |
+
0.02
|
| 175 |
+
0.06
|
| 176 |
+
0.02
|
| 177 |
+
0.01
|
| 178 |
+
0.01
|
| 179 |
+
-0.02
|
| 180 |
+
-0.01
|
| 181 |
+
-0.02
|
| 182 |
+
-0.01
|
| 183 |
+
-0.03
|
| 184 |
+
-0.02
|
| 185 |
+
-0.02
|
| 186 |
+
0.02
|
| 187 |
+
0.03
|
| 188 |
+
0.01
|
| 189 |
+
-0.03
|
| 190 |
+
-0.04
|
| 191 |
+
-0.03
|
| 192 |
+
-0.04
|
| 193 |
+
-0.01
|
| 194 |
+
-0.02
|
| 195 |
+
-0.01
|
| 196 |
+
-0.01
|
| 197 |
+
-0.02
|
| 198 |
+
-0.01
|
| 199 |
+
0
|
| 200 |
+
-0.01
|
| 201 |
+
0.01
|
| 202 |
+
-0.01
|
| 203 |
+
0.01
|
| 204 |
+
0.01
|
| 205 |
+
-0.02
|
| 206 |
+
0
|
| 207 |
+
0
|
| 208 |
+
0.02
|
| 209 |
+
0
|
| 210 |
+
0
|
| 211 |
+
-0.02
|
| 212 |
+
-0.01
|
| 213 |
+
0
|
| 214 |
+
-0.01
|
| 215 |
+
0
|
| 216 |
+
0
|
| 217 |
+
-0.01
|
| 218 |
+
-0.02
|
| 219 |
+
0
|
| 220 |
+
0.02
|
| 221 |
+
0.01
|
| 222 |
+
0.04
|
| 223 |
+
0.03
|
| 224 |
+
0
|
| 225 |
+
0.03
|
| 226 |
+
0.02
|
| 227 |
+
0.02
|
| 228 |
+
0.07
|
| 229 |
+
0.04
|
| 230 |
+
0.06
|
| 231 |
+
0.2
|
| 232 |
+
0.09
|
| 233 |
+
0.07
|
| 234 |
+
0.1
|
| 235 |
+
0.1
|
| 236 |
+
0.15
|
| 237 |
+
0.26
|
| 238 |
+
0.01
|
| 239 |
+
0.03
|
| 240 |
+
0.05
|
| 241 |
+
-0.21
|
| 242 |
+
-0.15
|
| 243 |
+
0.03
|
| 244 |
+
-0.02
|
| 245 |
+
0.13
|
| 246 |
+
0.19
|
| 247 |
+
0.11
|
| 248 |
+
0.07
|
| 249 |
+
0.07
|
| 250 |
+
0.12
|
| 251 |
+
0.2
|
| 252 |
+
0.21
|
| 253 |
+
-0.09
|
| 254 |
+
-0.04
|
| 255 |
+
0.05
|
| 256 |
+
0.12
|
| 257 |
+
0.06
|
| 258 |
+
0.04
|
| 259 |
+
-0.09
|
| 260 |
+
-0.16
|
| 261 |
+
-0.03
|
| 262 |
+
0.05
|
| 263 |
+
0.17
|
| 264 |
+
0.22
|
| 265 |
+
0.09
|
| 266 |
+
-0.02
|
| 267 |
+
0.21
|
| 268 |
+
0.03
|
| 269 |
+
-0.02
|
| 270 |
+
0.18
|
| 271 |
+
0.14
|
| 272 |
+
0.02
|
| 273 |
+
0.19
|
| 274 |
+
0.17
|
| 275 |
+
0.03
|
| 276 |
+
0.4
|
| 277 |
+
0.21
|
| 278 |
+
-0.08
|
| 279 |
+
-0.15
|
| 280 |
+
0.07
|
| 281 |
+
0.28
|
| 282 |
+
0.27
|
| 283 |
+
0.15
|
| 284 |
+
0.04
|
| 285 |
+
-0.05
|
| 286 |
+
-0.06
|
| 287 |
+
0.05
|
| 288 |
+
-0.26
|
| 289 |
+
-0.38
|
| 290 |
+
-0.35
|
| 291 |
+
0.07
|
| 292 |
+
-0.01
|
| 293 |
+
0.17
|
| 294 |
+
0.13
|
| 295 |
+
0.01
|
| 296 |
+
0
|
| 297 |
+
-0.17
|
| 298 |
+
-0.11
|
| 299 |
+
-0.1
|
| 300 |
+
0
|
| 301 |
+
-0.15
|
| 302 |
+
0
|
| 303 |
+
0
|
| 304 |
+
0.01
|
| 305 |
+
-0.01
|
| 306 |
+
-0.03
|
| 307 |
+
0.03
|
| 308 |
+
-0.04
|
| 309 |
+
-0.1
|
| 310 |
+
-0.03
|
| 311 |
+
-0.07
|
| 312 |
+
-0.06
|
| 313 |
+
-0.03
|
| 314 |
+
0.07
|
| 315 |
+
0.06
|
| 316 |
+
0.06
|
| 317 |
+
-0.03
|
| 318 |
+
0.07
|
| 319 |
+
0.11
|
| 320 |
+
0.29
|
| 321 |
+
0.1
|
| 322 |
+
-0.22
|
| 323 |
+
0.01
|
| 324 |
+
0.06
|
| 325 |
+
0
|
| 326 |
+
0.05
|
| 327 |
+
0.09
|
| 328 |
+
0.25
|
| 329 |
+
0.18
|
| 330 |
+
0.22
|
| 331 |
+
0.21
|
| 332 |
+
0.29
|
| 333 |
+
0.41
|
| 334 |
+
0.3
|
| 335 |
+
0.12
|
| 336 |
+
0.03
|
| 337 |
+
0.18
|
| 338 |
+
-0.16
|
| 339 |
+
-0.17
|
| 340 |
+
0.1
|
| 341 |
+
0.11
|
| 342 |
+
-0.07
|
| 343 |
+
-0.07
|
| 344 |
+
0.04
|
| 345 |
+
0.02
|
| 346 |
+
0.01
|
| 347 |
+
-0.06
|
| 348 |
+
0
|
| 349 |
+
-0.15
|
| 350 |
+
-0.17
|
| 351 |
+
-0.12
|
| 352 |
+
-0.18
|
| 353 |
+
-0.08
|
| 354 |
+
0.03
|
| 355 |
+
-0.07
|
| 356 |
+
-0.18
|
| 357 |
+
-0.24
|
| 358 |
+
-0.11
|
| 359 |
+
-0.06
|
| 360 |
+
-0.11
|
| 361 |
+
-0.04
|
| 362 |
+
0.04
|
| 363 |
+
0
|
| 364 |
+
-0.05
|
| 365 |
+
-0.06
|
| 366 |
+
-0.1
|
| 367 |
+
-0.04
|
| 368 |
+
-0.05
|
| 369 |
+
-0.02
|
| 370 |
+
0.09
|
| 371 |
+
0.06
|
| 372 |
+
0.04
|
| 373 |
+
0.18
|
| 374 |
+
0.03
|
| 375 |
+
0.02
|
| 376 |
+
0.1
|
| 377 |
+
0.17
|
| 378 |
+
0.11
|
| 379 |
+
0
|
| 380 |
+
-0.12
|
| 381 |
+
-0.06
|
| 382 |
+
0.17
|
| 383 |
+
0.24
|
| 384 |
+
0.11
|
| 385 |
+
0.19
|
| 386 |
+
-0.05
|
| 387 |
+
0.18
|
| 388 |
+
0.07
|
| 389 |
+
0.14
|
| 390 |
+
-0.09
|
| 391 |
+
-0.09
|
| 392 |
+
0.06
|
| 393 |
+
0.19
|
| 394 |
+
0.86
|
| 395 |
+
0.59
|
| 396 |
+
0.07
|
| 397 |
+
0.36
|
| 398 |
+
1.15
|
| 399 |
+
0.88
|
| 400 |
+
-0.26
|
| 401 |
+
-1.02
|
| 402 |
+
-0.46
|
| 403 |
+
-0.06
|
| 404 |
+
0.5
|
| 405 |
+
0.55
|
| 406 |
+
0.53
|
| 407 |
+
0.41
|
| 408 |
+
0.5
|
| 409 |
+
-0.11
|
| 410 |
+
0.34
|
| 411 |
+
-0.03
|
| 412 |
+
0.22
|
| 413 |
+
0.39
|
| 414 |
+
-0.15
|
| 415 |
+
0.37
|
| 416 |
+
0.17
|
| 417 |
+
0.58
|
| 418 |
+
0.19
|
| 419 |
+
-0.72
|
| 420 |
+
0.16
|
| 421 |
+
0.55
|
| 422 |
+
0.08
|
| 423 |
+
-0.36
|
| 424 |
+
-0.04
|
| 425 |
+
-0.14
|
| 426 |
+
0.28
|
| 427 |
+
-0.12
|
| 428 |
+
-0.48
|
| 429 |
+
-0.69
|
| 430 |
+
-0.9
|
| 431 |
+
-0.43
|
| 432 |
+
-0.16
|
| 433 |
+
-0.2
|
| 434 |
+
0.01
|
| 435 |
+
-0.34
|
| 436 |
+
-0.32
|
| 437 |
+
-0.2
|
| 438 |
+
0.28
|
| 439 |
+
0.02
|
| 440 |
+
0.25
|
| 441 |
+
-0.09
|
| 442 |
+
-0.09
|
| 443 |
+
0.15
|
| 444 |
+
0.14
|
| 445 |
+
-0.1
|
| 446 |
+
-0.06
|
| 447 |
+
0.4
|
| 448 |
+
0.32
|
| 449 |
+
0.43
|
| 450 |
+
0.31
|
| 451 |
+
0.1
|
| 452 |
+
-0.52
|
| 453 |
+
-0.28
|
| 454 |
+
-0.41
|
| 455 |
+
-0.46
|
| 456 |
+
-0.08
|
| 457 |
+
-0.14
|
| 458 |
+
-0.03
|
| 459 |
+
0.46
|
| 460 |
+
-0.18
|
| 461 |
+
-0.36
|
| 462 |
+
-0.75
|
| 463 |
+
0.03
|
| 464 |
+
0.07
|
| 465 |
+
-0.02
|
| 466 |
+
-0.12
|
| 467 |
+
-0.37
|
| 468 |
+
-0.41
|
shared/package-files/9b/9b1676a9f2beda4d06310328bd464e716ce1fd334045af3425b820b172c51c83/blob
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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Index
|
| 8 |
+
import pandas._testing as tm
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class TestIndexRendering:
|
| 12 |
+
def test_repr_is_valid_construction_code(self):
|
| 13 |
+
# for the case of Index, where the repr is traditional rather than
|
| 14 |
+
# stylized
|
| 15 |
+
idx = Index(["a", "b"])
|
| 16 |
+
res = eval(repr(idx))
|
| 17 |
+
tm.assert_index_equal(res, idx)
|
| 18 |
+
|
| 19 |
+
@pytest.mark.xfail(using_string_dtype(), reason="repr different")
|
| 20 |
+
@pytest.mark.parametrize(
|
| 21 |
+
"index,expected",
|
| 22 |
+
[
|
| 23 |
+
# ASCII
|
| 24 |
+
# short
|
| 25 |
+
(
|
| 26 |
+
Index(["a", "bb", "ccc"]),
|
| 27 |
+
"""Index(['a', 'bb', 'ccc'], dtype='object')""",
|
| 28 |
+
),
|
| 29 |
+
# multiple lines
|
| 30 |
+
(
|
| 31 |
+
Index(["a", "bb", "ccc"] * 10),
|
| 32 |
+
"Index(['a', 'bb', 'ccc', 'a', 'bb', 'ccc', 'a', "
|
| 33 |
+
"'bb', 'ccc', 'a', 'bb', 'ccc',\n"
|
| 34 |
+
" 'a', 'bb', 'ccc', 'a', 'bb', 'ccc', 'a', "
|
| 35 |
+
"'bb', 'ccc', 'a', 'bb', 'ccc',\n"
|
| 36 |
+
" 'a', 'bb', 'ccc', 'a', 'bb', 'ccc'],\n"
|
| 37 |
+
" dtype='object')",
|
| 38 |
+
),
|
| 39 |
+
# truncated
|
| 40 |
+
(
|
| 41 |
+
Index(["a", "bb", "ccc"] * 100),
|
| 42 |
+
"Index(['a', 'bb', 'ccc', 'a', 'bb', 'ccc', 'a', 'bb', 'ccc', 'a',\n"
|
| 43 |
+
" ...\n"
|
| 44 |
+
" 'ccc', 'a', 'bb', 'ccc', 'a', 'bb', 'ccc', 'a', 'bb', 'ccc'],\n"
|
| 45 |
+
" dtype='object', length=300)",
|
| 46 |
+
),
|
| 47 |
+
# Non-ASCII
|
| 48 |
+
# short
|
| 49 |
+
(
|
| 50 |
+
Index(["あ", "いい", "ううう"]),
|
| 51 |
+
"""Index(['あ', 'いい', 'ううう'], dtype='object')""",
|
| 52 |
+
),
|
| 53 |
+
# multiple lines
|
| 54 |
+
(
|
| 55 |
+
Index(["あ", "いい", "ううう"] * 10),
|
| 56 |
+
(
|
| 57 |
+
"Index(['あ', 'いい', 'ううう', 'あ', 'いい', 'ううう', "
|
| 58 |
+
"'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう',\n"
|
| 59 |
+
" 'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう', "
|
| 60 |
+
"'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう',\n"
|
| 61 |
+
" 'あ', 'いい', 'ううう', 'あ', 'いい', "
|
| 62 |
+
"'ううう'],\n"
|
| 63 |
+
" dtype='object')"
|
| 64 |
+
),
|
| 65 |
+
),
|
| 66 |
+
# truncated
|
| 67 |
+
(
|
| 68 |
+
Index(["あ", "いい", "ううう"] * 100),
|
| 69 |
+
(
|
| 70 |
+
"Index(['あ', 'いい', 'ううう', 'あ', 'いい', 'ううう', "
|
| 71 |
+
"'あ', 'いい', 'ううう', 'あ',\n"
|
| 72 |
+
" ...\n"
|
| 73 |
+
" 'ううう', 'あ', 'いい', 'ううう', 'あ', 'いい', "
|
| 74 |
+
"'ううう', 'あ', 'いい', 'ううう'],\n"
|
| 75 |
+
" dtype='object', length=300)"
|
| 76 |
+
),
|
| 77 |
+
),
|
| 78 |
+
],
|
| 79 |
+
)
|
| 80 |
+
def test_string_index_repr(self, index, expected):
|
| 81 |
+
result = repr(index)
|
| 82 |
+
assert result == expected
|
| 83 |
+
|
| 84 |
+
@pytest.mark.xfail(using_string_dtype(), reason="repr different")
|
| 85 |
+
@pytest.mark.parametrize(
|
| 86 |
+
"index,expected",
|
| 87 |
+
[
|
| 88 |
+
# short
|
| 89 |
+
(
|
| 90 |
+
Index(["あ", "いい", "ううう"]),
|
| 91 |
+
("Index(['あ', 'いい', 'ううう'], dtype='object')"),
|
| 92 |
+
),
|
| 93 |
+
# multiple lines
|
| 94 |
+
(
|
| 95 |
+
Index(["あ", "いい", "ううう"] * 10),
|
| 96 |
+
(
|
| 97 |
+
"Index(['あ', 'いい', 'ううう', 'あ', 'いい', "
|
| 98 |
+
"'ううう', 'あ', 'いい', 'ううう',\n"
|
| 99 |
+
" 'あ', 'いい', 'ううう', 'あ', 'いい', "
|
| 100 |
+
"'ううう', 'あ', 'いい', 'ううう',\n"
|
| 101 |
+
" 'あ', 'いい', 'ううう', 'あ', 'いい', "
|
| 102 |
+
"'ううう', 'あ', 'いい', 'ううう',\n"
|
| 103 |
+
" 'あ', 'いい', 'ううう'],\n"
|
| 104 |
+
" dtype='object')"
|
| 105 |
+
""
|
| 106 |
+
),
|
| 107 |
+
),
|
| 108 |
+
# truncated
|
| 109 |
+
(
|
| 110 |
+
Index(["あ", "いい", "ううう"] * 100),
|
| 111 |
+
(
|
| 112 |
+
"Index(['あ', 'いい', 'ううう', 'あ', 'いい', "
|
| 113 |
+
"'ううう', 'あ', 'いい', 'ううう',\n"
|
| 114 |
+
" 'あ',\n"
|
| 115 |
+
" ...\n"
|
| 116 |
+
" 'ううう', 'あ', 'いい', 'ううう', 'あ', "
|
| 117 |
+
"'いい', 'ううう', 'あ', 'いい',\n"
|
| 118 |
+
" 'ううう'],\n"
|
| 119 |
+
" dtype='object', length=300)"
|
| 120 |
+
),
|
| 121 |
+
),
|
| 122 |
+
],
|
| 123 |
+
)
|
| 124 |
+
def test_string_index_repr_with_unicode_option(self, index, expected):
|
| 125 |
+
# Enable Unicode option -----------------------------------------
|
| 126 |
+
with cf.option_context("display.unicode.east_asian_width", True):
|
| 127 |
+
result = repr(index)
|
| 128 |
+
assert result == expected
|
| 129 |
+
|
| 130 |
+
def test_repr_summary(self):
|
| 131 |
+
with cf.option_context("display.max_seq_items", 10):
|
| 132 |
+
result = repr(Index(np.arange(1000)))
|
| 133 |
+
assert len(result) < 200
|
| 134 |
+
assert "..." in result
|
| 135 |
+
|
| 136 |
+
def test_summary_bug(self):
|
| 137 |
+
# GH#3869
|
| 138 |
+
ind = Index(["{other}%s", "~:{range}:0"], name="A")
|
| 139 |
+
result = ind._summary()
|
| 140 |
+
# shouldn't be formatted accidentally.
|
| 141 |
+
assert "~:{range}:0" in result
|
| 142 |
+
assert "{other}%s" in result
|
| 143 |
+
|
| 144 |
+
def test_index_repr_bool_nan(self):
|
| 145 |
+
# GH32146
|
| 146 |
+
arr = Index([True, False, np.nan], dtype=object)
|
| 147 |
+
msg = "Index.format is deprecated"
|
| 148 |
+
with tm.assert_produces_warning(FutureWarning, match=msg):
|
| 149 |
+
exp1 = arr.format()
|
| 150 |
+
out1 = ["True", "False", "NaN"]
|
| 151 |
+
assert out1 == exp1
|
| 152 |
+
|
| 153 |
+
exp2 = repr(arr)
|
| 154 |
+
out2 = "Index([True, False, nan], dtype='object')"
|
| 155 |
+
assert out2 == exp2
|
| 156 |
+
|
| 157 |
+
def test_format_different_scalar_lengths(self):
|
| 158 |
+
# GH#35439
|
| 159 |
+
idx = Index(["aaaaaaaaa", "b"])
|
| 160 |
+
expected = ["aaaaaaaaa", "b"]
|
| 161 |
+
msg = r"Index\.format is deprecated"
|
| 162 |
+
with tm.assert_produces_warning(FutureWarning, match=msg):
|
| 163 |
+
assert idx.format() == expected
|
shared/package-files/9b/9b16c7223d8223a77cbb4db2ee2fcc0dc2008526d6d3256a2e2fb3f2a95820fe/blob
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9b16c7223d8223a77cbb4db2ee2fcc0dc2008526d6d3256a2e2fb3f2a95820fe
|
| 3 |
+
size 341496
|
shared/package-files/9b/9b17a60c7c785a7977fa093caca7705eb5730377a032a677f0500e979e459679/blob
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ### Convenience Functions to be moved to kerneltools ####
|
| 2 |
+
import numpy as np
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def forrt(X, m=None):
|
| 6 |
+
"""
|
| 7 |
+
RFFT with order like Munro (1976) FORTT routine
|
| 8 |
+
|
| 9 |
+
Parameters
|
| 10 |
+
----------
|
| 11 |
+
X : ndarray
|
| 12 |
+
The array to transform.
|
| 13 |
+
m : int, optional
|
| 14 |
+
The length used for the FFT. If None, ``len(X)`` is used.
|
| 15 |
+
|
| 16 |
+
Returns
|
| 17 |
+
-------
|
| 18 |
+
ndarray
|
| 19 |
+
The real and imaginary parts of the RFFT, concatenated in the
|
| 20 |
+
Munro (1976) FORTT order.
|
| 21 |
+
"""
|
| 22 |
+
if m is None:
|
| 23 |
+
m = len(X)
|
| 24 |
+
y = np.fft.rfft(X, m) / m
|
| 25 |
+
return np.r_[y.real, y[1:-1].imag]
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def revrt(X, m=None):
|
| 29 |
+
"""
|
| 30 |
+
Inverse of forrt, equivalent to Munro (1976) REVRT routine
|
| 31 |
+
|
| 32 |
+
Parameters
|
| 33 |
+
----------
|
| 34 |
+
X : ndarray
|
| 35 |
+
The array, in the Munro (1976) FORTT order, to invert.
|
| 36 |
+
m : int, optional
|
| 37 |
+
The length used for the inverse FFT. If None, ``len(X)`` is used.
|
| 38 |
+
|
| 39 |
+
Returns
|
| 40 |
+
-------
|
| 41 |
+
ndarray
|
| 42 |
+
The inverse real FFT of `X`.
|
| 43 |
+
"""
|
| 44 |
+
if m is None:
|
| 45 |
+
m = len(X)
|
| 46 |
+
i = int(m // 2 + 1)
|
| 47 |
+
y = X[:i] + np.r_[0, X[i:], 0] * 1j
|
| 48 |
+
return np.fft.irfft(y) * m
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def silverman_transform(bw, M, RANGE):
|
| 52 |
+
"""
|
| 53 |
+
FFT of Gaussian kernel following to Silverman AS 176
|
| 54 |
+
|
| 55 |
+
Parameters
|
| 56 |
+
----------
|
| 57 |
+
bw : float
|
| 58 |
+
The bandwidth used in the Gaussian kernel.
|
| 59 |
+
M : int
|
| 60 |
+
The number of grid points.
|
| 61 |
+
RANGE : float
|
| 62 |
+
The range of the grid over which the kernel is evaluated.
|
| 63 |
+
|
| 64 |
+
Returns
|
| 65 |
+
-------
|
| 66 |
+
ndarray
|
| 67 |
+
The FFT of the Gaussian kernel evaluated at the grid points.
|
| 68 |
+
|
| 69 |
+
Notes
|
| 70 |
+
-----
|
| 71 |
+
Underflow is intentional as a dampener.
|
| 72 |
+
"""
|
| 73 |
+
J = np.arange(M / 2 + 1)
|
| 74 |
+
FAC1 = 2 * (np.pi * bw / RANGE) ** 2
|
| 75 |
+
JFAC = J**2 * FAC1
|
| 76 |
+
BC = 1 - 1.0 / 3 * (J * 1.0 / M * np.pi) ** 2
|
| 77 |
+
FAC = np.exp(-JFAC) / BC
|
| 78 |
+
kern_est = np.r_[FAC, FAC[1:-1]]
|
| 79 |
+
return kern_est
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
def counts(x, v):
|
| 83 |
+
"""
|
| 84 |
+
Counts the number of elements of x that fall within the grid points v
|
| 85 |
+
|
| 86 |
+
Parameters
|
| 87 |
+
----------
|
| 88 |
+
x : array_like
|
| 89 |
+
The data whose elements are counted.
|
| 90 |
+
v : array_like
|
| 91 |
+
The grid points (bin edges) used to bin `x`.
|
| 92 |
+
|
| 93 |
+
Returns
|
| 94 |
+
-------
|
| 95 |
+
ndarray
|
| 96 |
+
The number of elements of `x` falling in each bin defined by `v`.
|
| 97 |
+
|
| 98 |
+
Notes
|
| 99 |
+
-----
|
| 100 |
+
Using np.digitize and np.bincount
|
| 101 |
+
"""
|
| 102 |
+
idx = np.digitize(x, v)
|
| 103 |
+
return np.bincount(idx, minlength=len(v))
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
def kdesum(x, axis=0):
|
| 107 |
+
"""
|
| 108 |
+
Computes the sum of pairwise differences of x along the given axis
|
| 109 |
+
|
| 110 |
+
Parameters
|
| 111 |
+
----------
|
| 112 |
+
x : array_like
|
| 113 |
+
The data for which pairwise differences are summed.
|
| 114 |
+
axis : int, optional
|
| 115 |
+
The axis along which the differences ``x[i] - x`` are summed.
|
| 116 |
+
|
| 117 |
+
Returns
|
| 118 |
+
-------
|
| 119 |
+
ndarray
|
| 120 |
+
The array of summed pairwise differences, one entry per element
|
| 121 |
+
of `x`.
|
| 122 |
+
"""
|
| 123 |
+
return np.asarray([np.sum(x[i] - x, axis) for i in range(len(x))])
|
shared/package-files/9b/9b18078f5451cc903075e2ffd8a901d0db1e90d593b42adae53ee8664882709f/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/addr_ops.h>
|
| 21 |
+
|
| 22 |
+
namespace at {
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
// aten::addr(Tensor self, Tensor vec1, Tensor vec2, *, Scalar beta=1, Scalar alpha=1) -> Tensor
|
| 26 |
+
inline at::Tensor addr(const at::Tensor & self, const at::Tensor & vec1, const at::Tensor & vec2, const at::Scalar & beta=1, const at::Scalar & alpha=1) {
|
| 27 |
+
return at::_ops::addr::call(self, vec1, vec2, beta, alpha);
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
// aten::addr.out(Tensor self, Tensor vec1, Tensor vec2, *, Scalar beta=1, Scalar alpha=1, Tensor(a!) out) -> Tensor(a!)
|
| 31 |
+
inline at::Tensor & addr_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & vec1, const at::Tensor & vec2, const at::Scalar & beta=1, const at::Scalar & alpha=1) {
|
| 32 |
+
return at::_ops::addr_out::call(self, vec1, vec2, beta, alpha, out);
|
| 33 |
+
}
|
| 34 |
+
// aten::addr.out(Tensor self, Tensor vec1, Tensor vec2, *, Scalar beta=1, Scalar alpha=1, Tensor(a!) out) -> Tensor(a!)
|
| 35 |
+
inline at::Tensor & addr_outf(const at::Tensor & self, const at::Tensor & vec1, const at::Tensor & vec2, const at::Scalar & beta, const at::Scalar & alpha, at::Tensor & out) {
|
| 36 |
+
return at::_ops::addr_out::call(self, vec1, vec2, beta, alpha, out);
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
}
|
shared/package-files/9b/9b185eeba218c0a82e52dc46741cc08f676740e184182013738b2589c1fe99cb/blob
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9b185eeba218c0a82e52dc46741cc08f676740e184182013738b2589c1fe99cb
|
| 3 |
+
size 105276
|
shared/package-files/9b/9b191f143dab35f83c9e7d69a7fe35dd2d2e09d617c9d3d605ccfd8a5806900d/blob
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy.distutils.fcompiler
|
| 2 |
+
from numpy.testing import assert_
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
intel_32bit_version_strings = [
|
| 6 |
+
("Intel(R) Fortran Intel(R) 32-bit Compiler Professional for applications"
|
| 7 |
+
"running on Intel(R) 32, Version 11.1", '11.1'),
|
| 8 |
+
]
|
| 9 |
+
|
| 10 |
+
intel_64bit_version_strings = [
|
| 11 |
+
("Intel(R) Fortran IA-64 Compiler Professional for applications"
|
| 12 |
+
"running on IA-64, Version 11.0", '11.0'),
|
| 13 |
+
("Intel(R) Fortran Intel(R) 64 Compiler Professional for applications"
|
| 14 |
+
"running on Intel(R) 64, Version 11.1", '11.1')
|
| 15 |
+
]
|
| 16 |
+
|
| 17 |
+
class TestIntelFCompilerVersions:
|
| 18 |
+
def test_32bit_version(self):
|
| 19 |
+
fc = numpy.distutils.fcompiler.new_fcompiler(compiler='intel')
|
| 20 |
+
for vs, version in intel_32bit_version_strings:
|
| 21 |
+
v = fc.version_match(vs)
|
| 22 |
+
assert_(v == version)
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
class TestIntelEM64TFCompilerVersions:
|
| 26 |
+
def test_64bit_version(self):
|
| 27 |
+
fc = numpy.distutils.fcompiler.new_fcompiler(compiler='intelem')
|
| 28 |
+
for vs, version in intel_64bit_version_strings:
|
| 29 |
+
v = fc.version_match(vs)
|
| 30 |
+
assert_(v == version)
|
shared/package-files/9b/9b19609c87d0a3fecb06f22824bc0f37d67a64ad4847019250d0ff2509d160d0/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 |
+
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
namespace native {
|
| 19 |
+
TORCH_API void _foreach_sigmoid_out(at::TensorList self, at::TensorList out);
|
| 20 |
+
TORCH_API ::std::vector<at::Tensor> foreach_tensor_sigmoid_slow(at::TensorList self);
|
| 21 |
+
TORCH_API void foreach_tensor_sigmoid_slow_(at::TensorList self);
|
| 22 |
+
TORCH_API ::std::vector<at::Tensor> foreach_tensor_sigmoid_cuda(at::TensorList self);
|
| 23 |
+
TORCH_API void foreach_tensor_sigmoid_cuda_(at::TensorList self);
|
| 24 |
+
} // namespace native
|
| 25 |
+
} // namespace at
|
shared/package-files/9b/9b19d299da335885dc0cb64dcc28a6f809d3c9e82d9c09c43b9058eb4dc332c1/ring_fragments.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Bounded two-ring-bond extension to the unchanged single-cut chemistry."""
|
| 2 |
+
from itertools import combinations
|
| 3 |
+
import numpy as np
|
| 4 |
+
from rdkit import Chem
|
| 5 |
+
from graph_fragments import fragment_formulae as single_cut,INDEX,ELEMENTS,LOSSES
|
| 6 |
+
MAX_RING_BONDS=32
|
| 7 |
+
|
| 8 |
+
def fragment_formulae(smiles):
|
| 9 |
+
base=single_cut(smiles)
|
| 10 |
+
if base is None:return None
|
| 11 |
+
mol=Chem.MolFromSmiles(str(smiles));atoms=list(mol.GetAtoms())
|
| 12 |
+
bonds=[(b.GetBeginAtomIdx(),b.GetEndAtomIdx()) for b in mol.GetBonds() if b.IsInRing()]
|
| 13 |
+
result=dict(base);result['ring_bonds']=len(bonds);result['ring_cut_pairs']=0
|
| 14 |
+
result['ring_budget_skipped']=len(bonds)>MAX_RING_BONDS
|
| 15 |
+
if len(bonds)>MAX_RING_BONDS:return result
|
| 16 |
+
vectors=np.zeros((len(atoms),len(ELEMENTS)),np.int64)
|
| 17 |
+
for i,a in enumerate(atoms):
|
| 18 |
+
vectors[i,INDEX[a.GetAtomicNum()]]=1;vectors[i,INDEX[1]]=a.GetTotalNumHs()
|
| 19 |
+
whole=vectors.sum(0);adjacency=[set(n.GetIdx() for n in a.GetNeighbors()) for a in atoms]
|
| 20 |
+
direct=set(base['direct']);count=0
|
| 21 |
+
for (a,b),(c,d) in combinations(bonds,2):
|
| 22 |
+
removed={(a,b),(b,a),(c,d),(d,c)};component={a};todo=[a]
|
| 23 |
+
while todo:
|
| 24 |
+
j=todo.pop()
|
| 25 |
+
for k in adjacency[j]:
|
| 26 |
+
if (j,k) in removed or k in component:continue
|
| 27 |
+
component.add(k);todo.append(k)
|
| 28 |
+
if len(component)==len(atoms):continue
|
| 29 |
+
left=vectors[sorted(component)].sum(0)
|
| 30 |
+
for side in (left,whole-left):
|
| 31 |
+
for shift in (-1,0,1):
|
| 32 |
+
value=side.copy();value[INDEX[1]]+=shift
|
| 33 |
+
if value[INDEX[1]]>=0:direct.add(tuple(value.tolist()))
|
| 34 |
+
count+=1
|
| 35 |
+
extended=set(direct)
|
| 36 |
+
for formula in direct:
|
| 37 |
+
for loss in LOSSES:
|
| 38 |
+
value=tuple(a-b for a,b in zip(formula,loss))
|
| 39 |
+
if min(value)>=0 and sum(value)>0:extended.add(value)
|
| 40 |
+
result.update(direct=sorted(direct),losses=sorted(extended),ring_cut_pairs=count)
|
| 41 |
+
assert set(base['direct']).issubset(direct)
|
| 42 |
+
return result
|
shared/package-files/9b/9b218384eec238b9a6a2e721b23454e7b950a579c96a1cea69f7d79b26b8afa7/blob
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any, Optional
|
| 2 |
+
|
| 3 |
+
from django.db.models.base import Model
|
| 4 |
+
|
| 5 |
+
NOT_PROVIDED: Any
|
| 6 |
+
|
| 7 |
+
class FieldCacheMixin:
|
| 8 |
+
def get_cache_name(self) -> str: ...
|
| 9 |
+
def get_cached_value(self, instance: Model, default: Any = ...) -> Optional[Model]: ...
|
| 10 |
+
def is_cached(self, instance: Model) -> bool: ...
|
| 11 |
+
def set_cached_value(self, instance: Model, value: Optional[Model]) -> None: ...
|
| 12 |
+
def delete_cached_value(self, instance: Model) -> None: ...
|
shared/package-files/9b/9b23374ef43c10d49db0b72110877569dbd906b56d2c6747ef951c3c3152e868/blob
ADDED
|
@@ -0,0 +1,522 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
/*
|
| 3 |
+
AVX implementation of sin, cos, sincos, exp and log
|
| 4 |
+
|
| 5 |
+
Based on "sse_mathfun.h", by Julien Pommier
|
| 6 |
+
http://gruntthepeon.free.fr/ssemath/
|
| 7 |
+
|
| 8 |
+
Copyright (C) 2012 Giovanni Garberoglio
|
| 9 |
+
Interdisciplinary Laboratory for Computational Science (LISC)
|
| 10 |
+
Fondazione Bruno Kessler and University of Trento
|
| 11 |
+
via Sommarive, 18
|
| 12 |
+
I-38123 Trento (Italy)
|
| 13 |
+
|
| 14 |
+
This software is provided 'as-is', without any express or implied
|
| 15 |
+
warranty. In no event will the authors be held liable for any damages
|
| 16 |
+
arising from the use of this software.
|
| 17 |
+
|
| 18 |
+
Permission is granted to anyone to use this software for any purpose,
|
| 19 |
+
including commercial applications, and to alter it and redistribute it
|
| 20 |
+
freely, subject to the following restrictions:
|
| 21 |
+
|
| 22 |
+
1. The origin of this software must not be misrepresented; you must not
|
| 23 |
+
claim that you wrote the original software. If you use this software
|
| 24 |
+
in a product, an acknowledgment in the product documentation would be
|
| 25 |
+
appreciated but is not required.
|
| 26 |
+
2. Altered source versions must be plainly marked as such, and must not be
|
| 27 |
+
misrepresented as being the original software.
|
| 28 |
+
3. This notice may not be removed or altered from any source distribution.
|
| 29 |
+
|
| 30 |
+
(this is the zlib license)
|
| 31 |
+
*/
|
| 32 |
+
|
| 33 |
+
#include <ATen/native/cpu/Intrinsics.h>
|
| 34 |
+
|
| 35 |
+
/* The original source of this file has been modified. */
|
| 36 |
+
#if defined(CPU_CAPABILITY_AVX2)
|
| 37 |
+
|
| 38 |
+
#if defined(__GNUC__)
|
| 39 |
+
# define ALIGN32_BEG __attribute__((aligned(32)))
|
| 40 |
+
#elif defined(_WIN32)
|
| 41 |
+
# define ALIGN32_BEG __declspec(align(32))
|
| 42 |
+
#endif
|
| 43 |
+
|
| 44 |
+
typedef __m256 v8sf; // vector of 8 float (avx2)
|
| 45 |
+
typedef __m256i v8si; // vector of 8 int (avx2)
|
| 46 |
+
|
| 47 |
+
/* declare some AVX constants -- why can't I figure a better way to do that? */
|
| 48 |
+
#define _PS256_CONST(Name, Val) \
|
| 49 |
+
static const ALIGN32_BEG float _ps256_##Name[8] = { Val, Val, Val, Val, Val, Val, Val, Val }
|
| 50 |
+
#define _PI32_CONST256(Name, Val) \
|
| 51 |
+
static const ALIGN32_BEG int _pi32_256_##Name[8] = { Val, Val, Val, Val, Val, Val, Val, Val }
|
| 52 |
+
#define _PS256_CONST_TYPE(Name, Type, Val) \
|
| 53 |
+
static const ALIGN32_BEG Type _ps256_##Name[8] = { Val, Val, Val, Val, Val, Val, Val, Val }
|
| 54 |
+
|
| 55 |
+
_PS256_CONST(1 , 1.0f);
|
| 56 |
+
_PS256_CONST(0p5, 0.5f);
|
| 57 |
+
/* the smallest non denormalized float number */
|
| 58 |
+
_PS256_CONST_TYPE(min_norm_pos, int, 0x00800000);
|
| 59 |
+
_PS256_CONST_TYPE(mant_mask, int, 0x7f800000);
|
| 60 |
+
_PS256_CONST_TYPE(inv_mant_mask, int, ~0x7f800000);
|
| 61 |
+
|
| 62 |
+
_PS256_CONST_TYPE(sign_mask, int, (int)0x80000000);
|
| 63 |
+
_PS256_CONST_TYPE(inv_sign_mask, int, ~0x80000000);
|
| 64 |
+
|
| 65 |
+
_PI32_CONST256(0, 0);
|
| 66 |
+
_PI32_CONST256(1, 1);
|
| 67 |
+
_PI32_CONST256(inv1, ~1);
|
| 68 |
+
_PI32_CONST256(2, 2);
|
| 69 |
+
_PI32_CONST256(4, 4);
|
| 70 |
+
_PI32_CONST256(0x7f, 0x7f);
|
| 71 |
+
|
| 72 |
+
_PS256_CONST(cephes_SQRTHF, 0.707106781186547524);
|
| 73 |
+
_PS256_CONST(cephes_log_p0, 7.0376836292E-2);
|
| 74 |
+
_PS256_CONST(cephes_log_p1, - 1.1514610310E-1);
|
| 75 |
+
_PS256_CONST(cephes_log_p2, 1.1676998740E-1);
|
| 76 |
+
_PS256_CONST(cephes_log_p3, - 1.2420140846E-1);
|
| 77 |
+
_PS256_CONST(cephes_log_p4, + 1.4249322787E-1);
|
| 78 |
+
_PS256_CONST(cephes_log_p5, - 1.6668057665E-1);
|
| 79 |
+
_PS256_CONST(cephes_log_p6, + 2.0000714765E-1);
|
| 80 |
+
_PS256_CONST(cephes_log_p7, - 2.4999993993E-1);
|
| 81 |
+
_PS256_CONST(cephes_log_p8, + 3.3333331174E-1);
|
| 82 |
+
_PS256_CONST(cephes_log_q1, -2.12194440e-4);
|
| 83 |
+
_PS256_CONST(cephes_log_q2, 0.693359375);
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
/* natural logarithm computed for 8 simultaneous float
|
| 87 |
+
return NaN for x <= 0
|
| 88 |
+
*/
|
| 89 |
+
inline v8sf log256_ps(v8sf x) {
|
| 90 |
+
v8si imm0;
|
| 91 |
+
v8sf one = *(v8sf*)_ps256_1;
|
| 92 |
+
|
| 93 |
+
//v8sf invalid_mask = _mm256_cmple_ps(x, _mm256_setzero_ps());
|
| 94 |
+
v8sf invalid_mask = _mm256_cmp_ps(x, _mm256_setzero_ps(), _CMP_LE_OS);
|
| 95 |
+
|
| 96 |
+
x = _mm256_max_ps(x, *(v8sf*)_ps256_min_norm_pos); /* cut off denormalized stuff */
|
| 97 |
+
|
| 98 |
+
// can be done with AVX2
|
| 99 |
+
imm0 = _mm256_srli_epi32(_mm256_castps_si256(x), 23);
|
| 100 |
+
|
| 101 |
+
/* keep only the fractional part */
|
| 102 |
+
x = _mm256_and_ps(x, *(v8sf*)_ps256_inv_mant_mask);
|
| 103 |
+
x = _mm256_or_ps(x, *(v8sf*)_ps256_0p5);
|
| 104 |
+
|
| 105 |
+
// this is again another AVX2 instruction
|
| 106 |
+
imm0 = _mm256_sub_epi32(imm0, *(v8si*)_pi32_256_0x7f);
|
| 107 |
+
v8sf e = _mm256_cvtepi32_ps(imm0);
|
| 108 |
+
|
| 109 |
+
e = _mm256_add_ps(e, one);
|
| 110 |
+
|
| 111 |
+
/* part2:
|
| 112 |
+
if( x < SQRTHF ) {
|
| 113 |
+
e -= 1;
|
| 114 |
+
x = x + x - 1.0;
|
| 115 |
+
} else { x = x - 1.0; }
|
| 116 |
+
*/
|
| 117 |
+
//v8sf mask = _mm256_cmplt_ps(x, *(v8sf*)_ps256_cephes_SQRTHF);
|
| 118 |
+
v8sf mask = _mm256_cmp_ps(x, *(v8sf*)_ps256_cephes_SQRTHF, _CMP_LT_OS);
|
| 119 |
+
v8sf tmp = _mm256_and_ps(x, mask);
|
| 120 |
+
x = _mm256_sub_ps(x, one);
|
| 121 |
+
e = _mm256_sub_ps(e, _mm256_and_ps(one, mask));
|
| 122 |
+
x = _mm256_add_ps(x, tmp);
|
| 123 |
+
|
| 124 |
+
v8sf z = _mm256_mul_ps(x,x);
|
| 125 |
+
|
| 126 |
+
v8sf y = *(v8sf*)_ps256_cephes_log_p0;
|
| 127 |
+
y = _mm256_mul_ps(y, x);
|
| 128 |
+
y = _mm256_add_ps(y, *(v8sf*)_ps256_cephes_log_p1);
|
| 129 |
+
y = _mm256_mul_ps(y, x);
|
| 130 |
+
y = _mm256_add_ps(y, *(v8sf*)_ps256_cephes_log_p2);
|
| 131 |
+
y = _mm256_mul_ps(y, x);
|
| 132 |
+
y = _mm256_add_ps(y, *(v8sf*)_ps256_cephes_log_p3);
|
| 133 |
+
y = _mm256_mul_ps(y, x);
|
| 134 |
+
y = _mm256_add_ps(y, *(v8sf*)_ps256_cephes_log_p4);
|
| 135 |
+
y = _mm256_mul_ps(y, x);
|
| 136 |
+
y = _mm256_add_ps(y, *(v8sf*)_ps256_cephes_log_p5);
|
| 137 |
+
y = _mm256_mul_ps(y, x);
|
| 138 |
+
y = _mm256_add_ps(y, *(v8sf*)_ps256_cephes_log_p6);
|
| 139 |
+
y = _mm256_mul_ps(y, x);
|
| 140 |
+
y = _mm256_add_ps(y, *(v8sf*)_ps256_cephes_log_p7);
|
| 141 |
+
y = _mm256_mul_ps(y, x);
|
| 142 |
+
y = _mm256_add_ps(y, *(v8sf*)_ps256_cephes_log_p8);
|
| 143 |
+
y = _mm256_mul_ps(y, x);
|
| 144 |
+
|
| 145 |
+
y = _mm256_mul_ps(y, z);
|
| 146 |
+
|
| 147 |
+
tmp = _mm256_mul_ps(e, *(v8sf*)_ps256_cephes_log_q1);
|
| 148 |
+
y = _mm256_add_ps(y, tmp);
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
tmp = _mm256_mul_ps(z, *(v8sf*)_ps256_0p5);
|
| 152 |
+
y = _mm256_sub_ps(y, tmp);
|
| 153 |
+
|
| 154 |
+
tmp = _mm256_mul_ps(e, *(v8sf*)_ps256_cephes_log_q2);
|
| 155 |
+
x = _mm256_add_ps(x, y);
|
| 156 |
+
x = _mm256_add_ps(x, tmp);
|
| 157 |
+
x = _mm256_or_ps(x, invalid_mask); // negative arg will be NAN
|
| 158 |
+
return x;
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
_PS256_CONST(exp_hi, 88.3762626647949f);
|
| 162 |
+
_PS256_CONST(exp_lo, -88.3762626647949f);
|
| 163 |
+
|
| 164 |
+
_PS256_CONST(cephes_LOG2EF, 1.44269504088896341);
|
| 165 |
+
_PS256_CONST(cephes_exp_C1, 0.693359375);
|
| 166 |
+
_PS256_CONST(cephes_exp_C2, -2.12194440e-4);
|
| 167 |
+
|
| 168 |
+
_PS256_CONST(cephes_exp_p0, 1.9875691500E-4);
|
| 169 |
+
_PS256_CONST(cephes_exp_p1, 1.3981999507E-3);
|
| 170 |
+
_PS256_CONST(cephes_exp_p2, 8.3334519073E-3);
|
| 171 |
+
_PS256_CONST(cephes_exp_p3, 4.1665795894E-2);
|
| 172 |
+
_PS256_CONST(cephes_exp_p4, 1.6666665459E-1);
|
| 173 |
+
_PS256_CONST(cephes_exp_p5, 5.0000001201E-1);
|
| 174 |
+
|
| 175 |
+
inline v8sf exp256_ps(v8sf x) {
|
| 176 |
+
v8sf tmp = _mm256_setzero_ps(), fx;
|
| 177 |
+
v8si imm0;
|
| 178 |
+
v8sf one = *(v8sf*)_ps256_1;
|
| 179 |
+
|
| 180 |
+
x = _mm256_min_ps(x, *(v8sf*)_ps256_exp_hi);
|
| 181 |
+
x = _mm256_max_ps(x, *(v8sf*)_ps256_exp_lo);
|
| 182 |
+
|
| 183 |
+
/* express exp(x) as exp(g + n*log(2)) */
|
| 184 |
+
fx = _mm256_mul_ps(x, *(v8sf*)_ps256_cephes_LOG2EF);
|
| 185 |
+
fx = _mm256_add_ps(fx, *(v8sf*)_ps256_0p5);
|
| 186 |
+
|
| 187 |
+
/* how to perform a floorf with SSE: just below */
|
| 188 |
+
//imm0 = _mm256_cvttps_epi32(fx);
|
| 189 |
+
//tmp = _mm256_cvtepi32_ps(imm0);
|
| 190 |
+
|
| 191 |
+
tmp = _mm256_floor_ps(fx);
|
| 192 |
+
|
| 193 |
+
/* if greater, subtract 1 */
|
| 194 |
+
//v8sf mask = _mm256_cmpgt_ps(tmp, fx);
|
| 195 |
+
v8sf mask = _mm256_cmp_ps(tmp, fx, _CMP_GT_OS);
|
| 196 |
+
mask = _mm256_and_ps(mask, one);
|
| 197 |
+
fx = _mm256_sub_ps(tmp, mask);
|
| 198 |
+
|
| 199 |
+
tmp = _mm256_mul_ps(fx, *(v8sf*)_ps256_cephes_exp_C1);
|
| 200 |
+
v8sf z = _mm256_mul_ps(fx, *(v8sf*)_ps256_cephes_exp_C2);
|
| 201 |
+
x = _mm256_sub_ps(x, tmp);
|
| 202 |
+
x = _mm256_sub_ps(x, z);
|
| 203 |
+
|
| 204 |
+
z = _mm256_mul_ps(x,x);
|
| 205 |
+
|
| 206 |
+
v8sf y = *(v8sf*)_ps256_cephes_exp_p0;
|
| 207 |
+
y = _mm256_mul_ps(y, x);
|
| 208 |
+
y = _mm256_add_ps(y, *(v8sf*)_ps256_cephes_exp_p1);
|
| 209 |
+
y = _mm256_mul_ps(y, x);
|
| 210 |
+
y = _mm256_add_ps(y, *(v8sf*)_ps256_cephes_exp_p2);
|
| 211 |
+
y = _mm256_mul_ps(y, x);
|
| 212 |
+
y = _mm256_add_ps(y, *(v8sf*)_ps256_cephes_exp_p3);
|
| 213 |
+
y = _mm256_mul_ps(y, x);
|
| 214 |
+
y = _mm256_add_ps(y, *(v8sf*)_ps256_cephes_exp_p4);
|
| 215 |
+
y = _mm256_mul_ps(y, x);
|
| 216 |
+
y = _mm256_add_ps(y, *(v8sf*)_ps256_cephes_exp_p5);
|
| 217 |
+
y = _mm256_mul_ps(y, z);
|
| 218 |
+
y = _mm256_add_ps(y, x);
|
| 219 |
+
y = _mm256_add_ps(y, one);
|
| 220 |
+
|
| 221 |
+
/* build 2^n */
|
| 222 |
+
imm0 = _mm256_cvttps_epi32(fx);
|
| 223 |
+
// another two AVX2 instructions
|
| 224 |
+
imm0 = _mm256_add_epi32(imm0, *(v8si*)_pi32_256_0x7f);
|
| 225 |
+
imm0 = _mm256_slli_epi32(imm0, 23);
|
| 226 |
+
v8sf pow2n = _mm256_castsi256_ps(imm0);
|
| 227 |
+
y = _mm256_mul_ps(y, pow2n);
|
| 228 |
+
return y;
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
_PS256_CONST(minus_cephes_DP1, -0.78515625);
|
| 232 |
+
_PS256_CONST(minus_cephes_DP2, -2.4187564849853515625e-4);
|
| 233 |
+
_PS256_CONST(minus_cephes_DP3, -3.77489497744594108e-8);
|
| 234 |
+
_PS256_CONST(sincof_p0, -1.9515295891E-4);
|
| 235 |
+
_PS256_CONST(sincof_p1, 8.3321608736E-3);
|
| 236 |
+
_PS256_CONST(sincof_p2, -1.6666654611E-1);
|
| 237 |
+
_PS256_CONST(coscof_p0, 2.443315711809948E-005);
|
| 238 |
+
_PS256_CONST(coscof_p1, -1.388731625493765E-003);
|
| 239 |
+
_PS256_CONST(coscof_p2, 4.166664568298827E-002);
|
| 240 |
+
_PS256_CONST(cephes_FOPI, 1.27323954473516); // 4 / M_PI
|
| 241 |
+
|
| 242 |
+
|
| 243 |
+
/* evaluation of 8 sines at onces using AVX intrinsics
|
| 244 |
+
|
| 245 |
+
The code is the exact rewriting of the cephes sinf function.
|
| 246 |
+
Precision is excellent as long as x < 8192 (I did not bother to
|
| 247 |
+
take into account the special handling they have for greater values
|
| 248 |
+
-- it does not return garbage for arguments over 8192, though, but
|
| 249 |
+
the extra precision is missing).
|
| 250 |
+
|
| 251 |
+
Note that it is such that sinf((float)M_PI) = 8.74e-8, which is the
|
| 252 |
+
surprising but correct result.
|
| 253 |
+
|
| 254 |
+
*/
|
| 255 |
+
inline v8sf sin256_ps(v8sf x) { // any x
|
| 256 |
+
v8sf xmm1, xmm2 = _mm256_setzero_ps(), xmm3, sign_bit, y;
|
| 257 |
+
v8si imm0, imm2;
|
| 258 |
+
|
| 259 |
+
sign_bit = x;
|
| 260 |
+
/* take the absolute value */
|
| 261 |
+
x = _mm256_and_ps(x, *(v8sf*)_ps256_inv_sign_mask);
|
| 262 |
+
/* extract the sign bit (upper one) */
|
| 263 |
+
sign_bit = _mm256_and_ps(sign_bit, *(v8sf*)_ps256_sign_mask);
|
| 264 |
+
|
| 265 |
+
/* scale by 4/Pi */
|
| 266 |
+
y = _mm256_mul_ps(x, *(v8sf*)_ps256_cephes_FOPI);
|
| 267 |
+
|
| 268 |
+
/*
|
| 269 |
+
Here we start a series of integer operations, which are in the
|
| 270 |
+
realm of AVX2.
|
| 271 |
+
If we don't have AVX, let's perform them using SSE2 directives
|
| 272 |
+
*/
|
| 273 |
+
|
| 274 |
+
/* store the integer part of y in mm0 */
|
| 275 |
+
imm2 = _mm256_cvttps_epi32(y);
|
| 276 |
+
/* j=(j+1) & (~1) (see the cephes sources) */
|
| 277 |
+
// another two AVX2 instruction
|
| 278 |
+
imm2 = _mm256_add_epi32(imm2, *(v8si*)_pi32_256_1);
|
| 279 |
+
imm2 = _mm256_and_si256(imm2, *(v8si*)_pi32_256_inv1);
|
| 280 |
+
y = _mm256_cvtepi32_ps(imm2);
|
| 281 |
+
|
| 282 |
+
/* get the swap sign flag */
|
| 283 |
+
imm0 = _mm256_and_si256(imm2, *(v8si*)_pi32_256_4);
|
| 284 |
+
imm0 = _mm256_slli_epi32(imm0, 29);
|
| 285 |
+
/* get the polynom selection mask
|
| 286 |
+
there is one polynom for 0 <= x <= Pi/4
|
| 287 |
+
and another one for Pi/4<x<=Pi/2
|
| 288 |
+
|
| 289 |
+
Both branches will be computed.
|
| 290 |
+
*/
|
| 291 |
+
imm2 = _mm256_and_si256(imm2, *(v8si*)_pi32_256_2);
|
| 292 |
+
imm2 = _mm256_cmpeq_epi32(imm2,*(v8si*)_pi32_256_0);
|
| 293 |
+
|
| 294 |
+
v8sf swap_sign_bit = _mm256_castsi256_ps(imm0);
|
| 295 |
+
v8sf poly_mask = _mm256_castsi256_ps(imm2);
|
| 296 |
+
sign_bit = _mm256_xor_ps(sign_bit, swap_sign_bit);
|
| 297 |
+
|
| 298 |
+
/* The magic pass: "Extended precision modular arithmetic"
|
| 299 |
+
x = ((x - y * DP1) - y * DP2) - y * DP3; */
|
| 300 |
+
xmm1 = *(v8sf*)_ps256_minus_cephes_DP1;
|
| 301 |
+
xmm2 = *(v8sf*)_ps256_minus_cephes_DP2;
|
| 302 |
+
xmm3 = *(v8sf*)_ps256_minus_cephes_DP3;
|
| 303 |
+
xmm1 = _mm256_mul_ps(y, xmm1);
|
| 304 |
+
xmm2 = _mm256_mul_ps(y, xmm2);
|
| 305 |
+
xmm3 = _mm256_mul_ps(y, xmm3);
|
| 306 |
+
x = _mm256_add_ps(x, xmm1);
|
| 307 |
+
x = _mm256_add_ps(x, xmm2);
|
| 308 |
+
x = _mm256_add_ps(x, xmm3);
|
| 309 |
+
|
| 310 |
+
/* Evaluate the first polynom (0 <= x <= Pi/4) */
|
| 311 |
+
y = *(v8sf*)_ps256_coscof_p0;
|
| 312 |
+
v8sf z = _mm256_mul_ps(x,x);
|
| 313 |
+
|
| 314 |
+
y = _mm256_mul_ps(y, z);
|
| 315 |
+
y = _mm256_add_ps(y, *(v8sf*)_ps256_coscof_p1);
|
| 316 |
+
y = _mm256_mul_ps(y, z);
|
| 317 |
+
y = _mm256_add_ps(y, *(v8sf*)_ps256_coscof_p2);
|
| 318 |
+
y = _mm256_mul_ps(y, z);
|
| 319 |
+
y = _mm256_mul_ps(y, z);
|
| 320 |
+
v8sf tmp = _mm256_mul_ps(z, *(v8sf*)_ps256_0p5);
|
| 321 |
+
y = _mm256_sub_ps(y, tmp);
|
| 322 |
+
y = _mm256_add_ps(y, *(v8sf*)_ps256_1);
|
| 323 |
+
|
| 324 |
+
/* Evaluate the second polynom (Pi/4 <= x <= 0) */
|
| 325 |
+
|
| 326 |
+
v8sf y2 = *(v8sf*)_ps256_sincof_p0;
|
| 327 |
+
y2 = _mm256_mul_ps(y2, z);
|
| 328 |
+
y2 = _mm256_add_ps(y2, *(v8sf*)_ps256_sincof_p1);
|
| 329 |
+
y2 = _mm256_mul_ps(y2, z);
|
| 330 |
+
y2 = _mm256_add_ps(y2, *(v8sf*)_ps256_sincof_p2);
|
| 331 |
+
y2 = _mm256_mul_ps(y2, z);
|
| 332 |
+
y2 = _mm256_mul_ps(y2, x);
|
| 333 |
+
y2 = _mm256_add_ps(y2, x);
|
| 334 |
+
|
| 335 |
+
/* select the correct result from the two polynoms */
|
| 336 |
+
xmm3 = poly_mask;
|
| 337 |
+
y2 = _mm256_and_ps(xmm3, y2); //, xmm3);
|
| 338 |
+
y = _mm256_andnot_ps(xmm3, y);
|
| 339 |
+
y = _mm256_add_ps(y,y2);
|
| 340 |
+
/* update the sign */
|
| 341 |
+
y = _mm256_xor_ps(y, sign_bit);
|
| 342 |
+
|
| 343 |
+
return y;
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
/* almost the same as sin_ps */
|
| 347 |
+
inline v8sf cos256_ps(v8sf x) { // any x
|
| 348 |
+
v8sf xmm1, xmm2 = _mm256_setzero_ps(), xmm3, y;
|
| 349 |
+
v8si imm0, imm2;
|
| 350 |
+
|
| 351 |
+
/* take the absolute value */
|
| 352 |
+
x = _mm256_and_ps(x, *(v8sf*)_ps256_inv_sign_mask);
|
| 353 |
+
|
| 354 |
+
/* scale by 4/Pi */
|
| 355 |
+
y = _mm256_mul_ps(x, *(v8sf*)_ps256_cephes_FOPI);
|
| 356 |
+
|
| 357 |
+
/* store the integer part of y in mm0 */
|
| 358 |
+
imm2 = _mm256_cvttps_epi32(y);
|
| 359 |
+
/* j=(j+1) & (~1) (see the cephes sources) */
|
| 360 |
+
imm2 = _mm256_add_epi32(imm2, *(v8si*)_pi32_256_1);
|
| 361 |
+
imm2 = _mm256_and_si256(imm2, *(v8si*)_pi32_256_inv1);
|
| 362 |
+
y = _mm256_cvtepi32_ps(imm2);
|
| 363 |
+
imm2 = _mm256_sub_epi32(imm2, *(v8si*)_pi32_256_2);
|
| 364 |
+
|
| 365 |
+
/* get the swap sign flag */
|
| 366 |
+
imm0 = _mm256_andnot_si256(imm2, *(v8si*)_pi32_256_4);
|
| 367 |
+
imm0 = _mm256_slli_epi32(imm0, 29);
|
| 368 |
+
/* get the polynom selection mask */
|
| 369 |
+
imm2 = _mm256_and_si256(imm2, *(v8si*)_pi32_256_2);
|
| 370 |
+
imm2 = _mm256_cmpeq_epi32(imm2, *(v8si*)_pi32_256_0);
|
| 371 |
+
|
| 372 |
+
v8sf sign_bit = _mm256_castsi256_ps(imm0);
|
| 373 |
+
v8sf poly_mask = _mm256_castsi256_ps(imm2);
|
| 374 |
+
|
| 375 |
+
/* The magic pass: "Extended precision modular arithmetic"
|
| 376 |
+
x = ((x - y * DP1) - y * DP2) - y * DP3; */
|
| 377 |
+
xmm1 = *(v8sf*)_ps256_minus_cephes_DP1;
|
| 378 |
+
xmm2 = *(v8sf*)_ps256_minus_cephes_DP2;
|
| 379 |
+
xmm3 = *(v8sf*)_ps256_minus_cephes_DP3;
|
| 380 |
+
xmm1 = _mm256_mul_ps(y, xmm1);
|
| 381 |
+
xmm2 = _mm256_mul_ps(y, xmm2);
|
| 382 |
+
xmm3 = _mm256_mul_ps(y, xmm3);
|
| 383 |
+
x = _mm256_add_ps(x, xmm1);
|
| 384 |
+
x = _mm256_add_ps(x, xmm2);
|
| 385 |
+
x = _mm256_add_ps(x, xmm3);
|
| 386 |
+
|
| 387 |
+
/* Evaluate the first polynom (0 <= x <= Pi/4) */
|
| 388 |
+
y = *(v8sf*)_ps256_coscof_p0;
|
| 389 |
+
v8sf z = _mm256_mul_ps(x,x);
|
| 390 |
+
|
| 391 |
+
y = _mm256_mul_ps(y, z);
|
| 392 |
+
y = _mm256_add_ps(y, *(v8sf*)_ps256_coscof_p1);
|
| 393 |
+
y = _mm256_mul_ps(y, z);
|
| 394 |
+
y = _mm256_add_ps(y, *(v8sf*)_ps256_coscof_p2);
|
| 395 |
+
y = _mm256_mul_ps(y, z);
|
| 396 |
+
y = _mm256_mul_ps(y, z);
|
| 397 |
+
v8sf tmp = _mm256_mul_ps(z, *(v8sf*)_ps256_0p5);
|
| 398 |
+
y = _mm256_sub_ps(y, tmp);
|
| 399 |
+
y = _mm256_add_ps(y, *(v8sf*)_ps256_1);
|
| 400 |
+
|
| 401 |
+
/* Evaluate the second polynom (Pi/4 <= x <= 0) */
|
| 402 |
+
|
| 403 |
+
v8sf y2 = *(v8sf*)_ps256_sincof_p0;
|
| 404 |
+
y2 = _mm256_mul_ps(y2, z);
|
| 405 |
+
y2 = _mm256_add_ps(y2, *(v8sf*)_ps256_sincof_p1);
|
| 406 |
+
y2 = _mm256_mul_ps(y2, z);
|
| 407 |
+
y2 = _mm256_add_ps(y2, *(v8sf*)_ps256_sincof_p2);
|
| 408 |
+
y2 = _mm256_mul_ps(y2, z);
|
| 409 |
+
y2 = _mm256_mul_ps(y2, x);
|
| 410 |
+
y2 = _mm256_add_ps(y2, x);
|
| 411 |
+
|
| 412 |
+
/* select the correct result from the two polynoms */
|
| 413 |
+
xmm3 = poly_mask;
|
| 414 |
+
y2 = _mm256_and_ps(xmm3, y2); //, xmm3);
|
| 415 |
+
y = _mm256_andnot_ps(xmm3, y);
|
| 416 |
+
y = _mm256_add_ps(y,y2);
|
| 417 |
+
/* update the sign */
|
| 418 |
+
y = _mm256_xor_ps(y, sign_bit);
|
| 419 |
+
|
| 420 |
+
return y;
|
| 421 |
+
}
|
| 422 |
+
|
| 423 |
+
/* since sin256_ps and cos256_ps are almost identical, sincos256_ps could replace both of them..
|
| 424 |
+
it is almost as fast, and gives you a free cosine with your sine */
|
| 425 |
+
inline void sincos256_ps(v8sf x, v8sf *s, v8sf *c) {
|
| 426 |
+
|
| 427 |
+
v8sf xmm1, xmm2, xmm3 = _mm256_setzero_ps(), sign_bit_sin, y;
|
| 428 |
+
v8si imm0, imm2, imm4;
|
| 429 |
+
|
| 430 |
+
sign_bit_sin = x;
|
| 431 |
+
/* take the absolute value */
|
| 432 |
+
x = _mm256_and_ps(x, *(v8sf*)_ps256_inv_sign_mask);
|
| 433 |
+
/* extract the sign bit (upper one) */
|
| 434 |
+
sign_bit_sin = _mm256_and_ps(sign_bit_sin, *(v8sf*)_ps256_sign_mask);
|
| 435 |
+
|
| 436 |
+
/* scale by 4/Pi */
|
| 437 |
+
y = _mm256_mul_ps(x, *(v8sf*)_ps256_cephes_FOPI);
|
| 438 |
+
|
| 439 |
+
/* store the integer part of y in imm2 */
|
| 440 |
+
imm2 = _mm256_cvttps_epi32(y);
|
| 441 |
+
|
| 442 |
+
/* j=(j+1) & (~1) (see the cephes sources) */
|
| 443 |
+
imm2 = _mm256_add_epi32(imm2, *(v8si*)_pi32_256_1);
|
| 444 |
+
imm2 = _mm256_and_si256(imm2, *(v8si*)_pi32_256_inv1);
|
| 445 |
+
|
| 446 |
+
y = _mm256_cvtepi32_ps(imm2);
|
| 447 |
+
imm4 = imm2;
|
| 448 |
+
|
| 449 |
+
/* get the swap sign flag for the sine */
|
| 450 |
+
imm0 = _mm256_and_si256(imm2, *(v8si*)_pi32_256_4);
|
| 451 |
+
imm0 = _mm256_slli_epi32(imm0, 29);
|
| 452 |
+
//v8sf swap_sign_bit_sin = _mm256_castsi256_ps(imm0);
|
| 453 |
+
|
| 454 |
+
/* get the polynom selection mask for the sine*/
|
| 455 |
+
imm2 = _mm256_and_si256(imm2, *(v8si*)_pi32_256_2);
|
| 456 |
+
imm2 = _mm256_cmpeq_epi32(imm2, *(v8si*)_pi32_256_0);
|
| 457 |
+
//v8sf poly_mask = _mm256_castsi256_ps(imm2);
|
| 458 |
+
|
| 459 |
+
v8sf swap_sign_bit_sin = _mm256_castsi256_ps(imm0);
|
| 460 |
+
v8sf poly_mask = _mm256_castsi256_ps(imm2);
|
| 461 |
+
|
| 462 |
+
/* The magic pass: "Extended precision modular arithmetic"
|
| 463 |
+
x = ((x - y * DP1) - y * DP2) - y * DP3; */
|
| 464 |
+
xmm1 = *(v8sf*)_ps256_minus_cephes_DP1;
|
| 465 |
+
xmm2 = *(v8sf*)_ps256_minus_cephes_DP2;
|
| 466 |
+
xmm3 = *(v8sf*)_ps256_minus_cephes_DP3;
|
| 467 |
+
xmm1 = _mm256_mul_ps(y, xmm1);
|
| 468 |
+
xmm2 = _mm256_mul_ps(y, xmm2);
|
| 469 |
+
xmm3 = _mm256_mul_ps(y, xmm3);
|
| 470 |
+
x = _mm256_add_ps(x, xmm1);
|
| 471 |
+
x = _mm256_add_ps(x, xmm2);
|
| 472 |
+
x = _mm256_add_ps(x, xmm3);
|
| 473 |
+
|
| 474 |
+
imm4 = _mm256_sub_epi32(imm4, *(v8si*)_pi32_256_2);
|
| 475 |
+
imm4 = _mm256_andnot_si256(imm4, *(v8si*)_pi32_256_4);
|
| 476 |
+
imm4 = _mm256_slli_epi32(imm4, 29);
|
| 477 |
+
|
| 478 |
+
v8sf sign_bit_cos = _mm256_castsi256_ps(imm4);
|
| 479 |
+
|
| 480 |
+
sign_bit_sin = _mm256_xor_ps(sign_bit_sin, swap_sign_bit_sin);
|
| 481 |
+
|
| 482 |
+
/* Evaluate the first polynom (0 <= x <= Pi/4) */
|
| 483 |
+
v8sf z = _mm256_mul_ps(x,x);
|
| 484 |
+
y = *(v8sf*)_ps256_coscof_p0;
|
| 485 |
+
|
| 486 |
+
y = _mm256_mul_ps(y, z);
|
| 487 |
+
y = _mm256_add_ps(y, *(v8sf*)_ps256_coscof_p1);
|
| 488 |
+
y = _mm256_mul_ps(y, z);
|
| 489 |
+
y = _mm256_add_ps(y, *(v8sf*)_ps256_coscof_p2);
|
| 490 |
+
y = _mm256_mul_ps(y, z);
|
| 491 |
+
y = _mm256_mul_ps(y, z);
|
| 492 |
+
v8sf tmp = _mm256_mul_ps(z, *(v8sf*)_ps256_0p5);
|
| 493 |
+
y = _mm256_sub_ps(y, tmp);
|
| 494 |
+
y = _mm256_add_ps(y, *(v8sf*)_ps256_1);
|
| 495 |
+
|
| 496 |
+
/* Evaluate the second polynom (Pi/4 <= x <= 0) */
|
| 497 |
+
|
| 498 |
+
v8sf y2 = *(v8sf*)_ps256_sincof_p0;
|
| 499 |
+
y2 = _mm256_mul_ps(y2, z);
|
| 500 |
+
y2 = _mm256_add_ps(y2, *(v8sf*)_ps256_sincof_p1);
|
| 501 |
+
y2 = _mm256_mul_ps(y2, z);
|
| 502 |
+
y2 = _mm256_add_ps(y2, *(v8sf*)_ps256_sincof_p2);
|
| 503 |
+
y2 = _mm256_mul_ps(y2, z);
|
| 504 |
+
y2 = _mm256_mul_ps(y2, x);
|
| 505 |
+
y2 = _mm256_add_ps(y2, x);
|
| 506 |
+
|
| 507 |
+
/* select the correct result from the two polynoms */
|
| 508 |
+
xmm3 = poly_mask;
|
| 509 |
+
v8sf ysin2 = _mm256_and_ps(xmm3, y2);
|
| 510 |
+
v8sf ysin1 = _mm256_andnot_ps(xmm3, y);
|
| 511 |
+
y2 = _mm256_sub_ps(y2,ysin2);
|
| 512 |
+
y = _mm256_sub_ps(y, ysin1);
|
| 513 |
+
|
| 514 |
+
xmm1 = _mm256_add_ps(ysin1,ysin2);
|
| 515 |
+
xmm2 = _mm256_add_ps(y,y2);
|
| 516 |
+
|
| 517 |
+
/* update the sign */
|
| 518 |
+
*s = _mm256_xor_ps(xmm1, sign_bit_sin);
|
| 519 |
+
*c = _mm256_xor_ps(xmm2, sign_bit_cos);
|
| 520 |
+
}
|
| 521 |
+
|
| 522 |
+
#endif // CPU_CAPABILITY_AVX2
|
shared/package-files/9b/9b27bd125063a5d81de94b64d9628603c25d7ad3736eb823440180d76271bf83/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 quantized_gru_cell(const at::Tensor & input, const at::Tensor & hx, const at::Tensor & w_ih, const at::Tensor & w_hh, const at::Tensor & b_ih, const at::Tensor & b_hh, const at::Tensor & packed_ih, const at::Tensor & packed_hh, const at::Tensor & col_offsets_ih, const at::Tensor & col_offsets_hh, const at::Scalar & scale_ih, const at::Scalar & scale_hh, const at::Scalar & zero_point_ih, const at::Scalar & zero_point_hh);
|
| 21 |
+
|
| 22 |
+
} // namespace compositeimplicitautograd
|
| 23 |
+
} // namespace at
|
shared/package-files/9b/9b2824a306502b0a6f1290bd19fd1fcd2869bb52c21a5c33a1bc9480da5752dd/blob
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import abc
|
| 4 |
+
from functools import lru_cache
|
| 5 |
+
from typing import TYPE_CHECKING, Any, ClassVar, Final, Protocol, TypeVar, cast, overload
|
| 6 |
+
|
| 7 |
+
import polars as pl
|
| 8 |
+
|
| 9 |
+
from narwhals._duration import Interval
|
| 10 |
+
from narwhals._utils import (
|
| 11 |
+
Implementation,
|
| 12 |
+
Version,
|
| 13 |
+
_DeferredIterable,
|
| 14 |
+
_StoresCompliant,
|
| 15 |
+
_StoresNative,
|
| 16 |
+
deep_getattr,
|
| 17 |
+
isinstance_or_issubclass,
|
| 18 |
+
)
|
| 19 |
+
from narwhals.exceptions import (
|
| 20 |
+
ColumnNotFoundError,
|
| 21 |
+
ComputeError,
|
| 22 |
+
DuplicateError,
|
| 23 |
+
InvalidOperationError,
|
| 24 |
+
NarwhalsError,
|
| 25 |
+
ShapeError,
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
if TYPE_CHECKING:
|
| 29 |
+
from collections.abc import Callable, Iterable, Iterator, Mapping
|
| 30 |
+
|
| 31 |
+
from typing_extensions import TypeIs
|
| 32 |
+
|
| 33 |
+
from narwhals._compliant.typing import Accessor
|
| 34 |
+
from narwhals._polars.dataframe import Method
|
| 35 |
+
from narwhals._polars.expr import PolarsExpr
|
| 36 |
+
from narwhals._polars.series import PolarsSeries
|
| 37 |
+
from narwhals.dtypes import DType
|
| 38 |
+
from narwhals.typing import IntoDType
|
| 39 |
+
|
| 40 |
+
T = TypeVar("T")
|
| 41 |
+
NativeT = TypeVar(
|
| 42 |
+
"NativeT", bound="pl.DataFrame | pl.LazyFrame | pl.Series | pl.Expr"
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
NativeT_co = TypeVar("NativeT_co", "pl.Series", "pl.Expr", covariant=True)
|
| 46 |
+
CompliantT_co = TypeVar("CompliantT_co", "PolarsSeries", "PolarsExpr", covariant=True)
|
| 47 |
+
CompliantT = TypeVar("CompliantT", "PolarsSeries", "PolarsExpr")
|
| 48 |
+
|
| 49 |
+
BACKEND_VERSION = Implementation.POLARS._backend_version()
|
| 50 |
+
"""Static backend version for `polars`."""
|
| 51 |
+
|
| 52 |
+
SERIES_ACCEPTS_PD_INDEX: Final[bool] = BACKEND_VERSION >= (0, 20, 7)
|
| 53 |
+
"""`pl.Series(values: pd.Index)` fixed in https://github.com/pola-rs/polars/pull/14087"""
|
| 54 |
+
|
| 55 |
+
RESPECT_JOIN_NULL_SEMI_ANTI: Final[bool] = BACKEND_VERSION >= (0, 20, 22)
|
| 56 |
+
"""Polars < 0.20.22 treats `null == null` as a match in semi/anti joins.
|
| 57 |
+
|
| 58 |
+
Dropping rows with null keys on the right removes these spurious matches,
|
| 59 |
+
which is always valid since narwhals treats nulls as non-matching.
|
| 60 |
+
|
| 61 |
+
Fixed in https://github.com/pola-rs/polars/pull/15696
|
| 62 |
+
"""
|
| 63 |
+
|
| 64 |
+
SERIES_RESPECTS_DTYPE: Final[bool] = BACKEND_VERSION >= (0, 20, 26)
|
| 65 |
+
"""`pl.Series(dtype=...)` fixed in https://github.com/pola-rs/polars/pull/15962
|
| 66 |
+
|
| 67 |
+
Includes `SERIES_ACCEPTS_PD_INDEX`.
|
| 68 |
+
"""
|
| 69 |
+
|
| 70 |
+
HAS_INT_128: Final[bool] = BACKEND_VERSION >= (1, 18, 0)
|
| 71 |
+
"""https://github.com/pola-rs/polars/pull/20232"""
|
| 72 |
+
|
| 73 |
+
FROM_DICTS_ACCEPTS_MAPPINGS: Final[bool] = BACKEND_VERSION >= (1, 30, 0)
|
| 74 |
+
"""`pl.from_dicts(data: Iterable[Mapping[str, Any]])` since https://github.com/pola-rs/polars/pull/22638"""
|
| 75 |
+
|
| 76 |
+
HAS_UINT_128: Final[bool] = BACKEND_VERSION >= (1, 34, 0)
|
| 77 |
+
"""https://github.com/pola-rs/polars/pull/24346"""
|
| 78 |
+
|
| 79 |
+
HAS_FLOAT_16: Final[bool] = BACKEND_VERSION >= (1, 36, 0)
|
| 80 |
+
"""https://github.com/pola-rs/polars/pull/25185"""
|
| 81 |
+
|
| 82 |
+
BINARY_ADD_UPCASTS_DECIMAL_TO_FLOAT: Final[bool] = BACKEND_VERSION >= (1, 34, 0)
|
| 83 |
+
"""Polars >= 1.34 upcasts `Decimal + float` to `Float64` (matching `int`/`Float32` promotion).
|
| 84 |
+
|
| 85 |
+
https://github.com/pola-rs/polars/pull/24594
|
| 86 |
+
"""
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
@overload
|
| 90 |
+
def extract_native(obj: _StoresNative[NativeT]) -> NativeT: ...
|
| 91 |
+
@overload
|
| 92 |
+
def extract_native(obj: T) -> T: ...
|
| 93 |
+
def extract_native(obj: _StoresNative[NativeT] | T) -> NativeT | T:
|
| 94 |
+
return obj.native if _is_compliant_polars(obj) else cast("T", obj)
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
def _is_compliant_polars(
|
| 98 |
+
obj: _StoresNative[NativeT] | Any,
|
| 99 |
+
) -> TypeIs[_StoresNative[NativeT]]:
|
| 100 |
+
from narwhals._polars.dataframe import PolarsDataFrame, PolarsLazyFrame
|
| 101 |
+
from narwhals._polars.expr import PolarsExpr
|
| 102 |
+
from narwhals._polars.series import PolarsSeries
|
| 103 |
+
|
| 104 |
+
return isinstance(obj, (PolarsDataFrame, PolarsLazyFrame, PolarsSeries, PolarsExpr))
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
def extract_args_kwargs(
|
| 108 |
+
args: Iterable[Any], kwds: Mapping[str, Any], /
|
| 109 |
+
) -> tuple[Iterator[Any], dict[str, Any]]:
|
| 110 |
+
it_args = (extract_native(arg) for arg in args)
|
| 111 |
+
return it_args, {k: extract_native(v) for k, v in kwds.items()}
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
@lru_cache(maxsize=128)
|
| 115 |
+
def native_to_narwhals_dtype( # noqa: C901, PLR0912
|
| 116 |
+
dtype: pl.DataType, version: Version
|
| 117 |
+
) -> DType:
|
| 118 |
+
dtypes = version.dtypes
|
| 119 |
+
if dtype == pl.Float64:
|
| 120 |
+
return dtypes.Float64()
|
| 121 |
+
if dtype == pl.Float32:
|
| 122 |
+
return dtypes.Float32()
|
| 123 |
+
if HAS_FLOAT_16 and dtype == pl.Float16:
|
| 124 |
+
return dtypes.Float16()
|
| 125 |
+
if HAS_INT_128 and dtype == pl.Int128:
|
| 126 |
+
return dtypes.Int128()
|
| 127 |
+
if dtype == pl.Int64:
|
| 128 |
+
return dtypes.Int64()
|
| 129 |
+
if dtype == pl.Int32:
|
| 130 |
+
return dtypes.Int32()
|
| 131 |
+
if dtype == pl.Int16:
|
| 132 |
+
return dtypes.Int16()
|
| 133 |
+
if dtype == pl.Int8:
|
| 134 |
+
return dtypes.Int8()
|
| 135 |
+
if HAS_UINT_128 and dtype == pl.UInt128:
|
| 136 |
+
return dtypes.UInt128()
|
| 137 |
+
if dtype == pl.UInt64:
|
| 138 |
+
return dtypes.UInt64()
|
| 139 |
+
if dtype == pl.UInt32:
|
| 140 |
+
return dtypes.UInt32()
|
| 141 |
+
if dtype == pl.UInt16:
|
| 142 |
+
return dtypes.UInt16()
|
| 143 |
+
if dtype == pl.UInt8:
|
| 144 |
+
return dtypes.UInt8()
|
| 145 |
+
if dtype == pl.String:
|
| 146 |
+
return dtypes.String()
|
| 147 |
+
if dtype == pl.Boolean:
|
| 148 |
+
return dtypes.Boolean()
|
| 149 |
+
if dtype == pl.Object:
|
| 150 |
+
return dtypes.Object()
|
| 151 |
+
if isinstance(dtype, pl.Categorical):
|
| 152 |
+
return dtypes.Categorical()
|
| 153 |
+
if isinstance(dtype, pl.Enum):
|
| 154 |
+
if version is Version.V1:
|
| 155 |
+
return dtypes.Enum() # type: ignore[call-arg]
|
| 156 |
+
categories = _DeferredIterable(dtype.categories.to_list)
|
| 157 |
+
return dtypes.Enum(categories)
|
| 158 |
+
if dtype == pl.Date:
|
| 159 |
+
return dtypes.Date()
|
| 160 |
+
if isinstance(dtype, pl.Datetime):
|
| 161 |
+
return dtypes.Datetime(dtype.time_unit, dtype.time_zone)
|
| 162 |
+
if isinstance(dtype, pl.Duration):
|
| 163 |
+
return dtypes.Duration(dtype.time_unit)
|
| 164 |
+
if isinstance(dtype, pl.Struct):
|
| 165 |
+
fields = [
|
| 166 |
+
dtypes.Field(name, native_to_narwhals_dtype(tp, version))
|
| 167 |
+
for name, tp in dtype
|
| 168 |
+
]
|
| 169 |
+
return dtypes.Struct(fields)
|
| 170 |
+
if isinstance(dtype, pl.List):
|
| 171 |
+
return dtypes.List(native_to_narwhals_dtype(dtype.inner, version))
|
| 172 |
+
if isinstance(dtype, pl.Array):
|
| 173 |
+
outer_shape = dtype.width if BACKEND_VERSION < (0, 20, 30) else dtype.size # type: ignore[attr-defined]
|
| 174 |
+
return dtypes.Array(native_to_narwhals_dtype(dtype.inner, version), outer_shape)
|
| 175 |
+
if isinstance(dtype, pl.Decimal):
|
| 176 |
+
return dtypes.Decimal(dtype.precision, dtype.scale)
|
| 177 |
+
if dtype == pl.Time:
|
| 178 |
+
return dtypes.Time()
|
| 179 |
+
if dtype == pl.Binary:
|
| 180 |
+
return dtypes.Binary()
|
| 181 |
+
return dtypes.Unknown()
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
dtypes = Version.MAIN.dtypes
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
def _version_dependent_dtypes() -> dict[type[DType], pl.DataType]:
|
| 188 |
+
if not HAS_INT_128: # pragma: no cover
|
| 189 |
+
return {}
|
| 190 |
+
nw_to_pl: dict[type[DType], pl.DataType] = {dtypes.Int128: pl.Int128()}
|
| 191 |
+
nw_to_pl = nw_to_pl | {dtypes.UInt128: pl.UInt128()} if HAS_UINT_128 else nw_to_pl
|
| 192 |
+
return nw_to_pl | {dtypes.Float16: pl.Float16()} if HAS_FLOAT_16 else nw_to_pl
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
NW_TO_PL_DTYPES: Mapping[type[DType], pl.DataType] = {
|
| 196 |
+
dtypes.Float64: pl.Float64(),
|
| 197 |
+
dtypes.Float32: pl.Float32(),
|
| 198 |
+
dtypes.Binary: pl.Binary(),
|
| 199 |
+
dtypes.String: pl.String(),
|
| 200 |
+
dtypes.Boolean: pl.Boolean(),
|
| 201 |
+
dtypes.Categorical: pl.Categorical(),
|
| 202 |
+
dtypes.Date: pl.Date(),
|
| 203 |
+
dtypes.Time: pl.Time(),
|
| 204 |
+
dtypes.Int8: pl.Int8(),
|
| 205 |
+
dtypes.Int16: pl.Int16(),
|
| 206 |
+
dtypes.Int32: pl.Int32(),
|
| 207 |
+
dtypes.Int64: pl.Int64(),
|
| 208 |
+
dtypes.UInt8: pl.UInt8(),
|
| 209 |
+
dtypes.UInt16: pl.UInt16(),
|
| 210 |
+
dtypes.UInt32: pl.UInt32(),
|
| 211 |
+
dtypes.UInt64: pl.UInt64(),
|
| 212 |
+
dtypes.Object: pl.Object(),
|
| 213 |
+
dtypes.Unknown: pl.Unknown(),
|
| 214 |
+
**_version_dependent_dtypes(),
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
def narwhals_to_native_dtype( # noqa: C901
|
| 219 |
+
dtype: IntoDType, version: Version
|
| 220 |
+
) -> pl.DataType:
|
| 221 |
+
dtypes = version.dtypes
|
| 222 |
+
base_type = dtype.base_type()
|
| 223 |
+
if pl_type := NW_TO_PL_DTYPES.get(base_type):
|
| 224 |
+
return pl_type
|
| 225 |
+
if isinstance_or_issubclass(dtype, dtypes.Enum):
|
| 226 |
+
if version is Version.V1:
|
| 227 |
+
msg = "Converting to Enum is not supported in narwhals.stable.v1"
|
| 228 |
+
raise NotImplementedError(msg)
|
| 229 |
+
if isinstance(dtype, dtypes.Enum):
|
| 230 |
+
return pl.Enum(dtype.categories)
|
| 231 |
+
msg = "Can not cast / initialize Enum without categories present"
|
| 232 |
+
raise ValueError(msg)
|
| 233 |
+
if isinstance_or_issubclass(dtype, dtypes.Datetime):
|
| 234 |
+
return pl.Datetime(dtype.time_unit, dtype.time_zone) # type: ignore[arg-type]
|
| 235 |
+
if isinstance_or_issubclass(dtype, dtypes.Duration):
|
| 236 |
+
return pl.Duration(dtype.time_unit) # type: ignore[arg-type]
|
| 237 |
+
if isinstance_or_issubclass(dtype, dtypes.List):
|
| 238 |
+
return pl.List(narwhals_to_native_dtype(dtype.inner, version))
|
| 239 |
+
if isinstance_or_issubclass(dtype, dtypes.Struct):
|
| 240 |
+
fields = [
|
| 241 |
+
pl.Field(field.name, narwhals_to_native_dtype(field.dtype, version))
|
| 242 |
+
for field in dtype.fields
|
| 243 |
+
]
|
| 244 |
+
return pl.Struct(fields)
|
| 245 |
+
if isinstance_or_issubclass(dtype, dtypes.Array): # pragma: no cover
|
| 246 |
+
size = dtype.size
|
| 247 |
+
kwargs = {"width": size} if BACKEND_VERSION < (0, 20, 30) else {"shape": size}
|
| 248 |
+
return pl.Array(narwhals_to_native_dtype(dtype.inner, version), **kwargs)
|
| 249 |
+
if isinstance_or_issubclass(dtype, dtypes.Decimal):
|
| 250 |
+
return pl.Decimal(dtype.precision, dtype.scale)
|
| 251 |
+
return pl.Unknown() # pragma: no cover
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
def _is_polars_exception(exception: Exception) -> bool:
|
| 255 |
+
if BACKEND_VERSION >= (1,):
|
| 256 |
+
# Old versions of Polars didn't have PolarsError.
|
| 257 |
+
return isinstance(exception, pl.exceptions.PolarsError)
|
| 258 |
+
# Last attempt, for old Polars versions.
|
| 259 |
+
return "polars.exceptions" in str(type(exception)) # pragma: no cover
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
def _is_cudf_exception(exception: Exception) -> bool:
|
| 263 |
+
# These exceptions are raised when running polars on GPUs via cuDF
|
| 264 |
+
return str(exception).startswith("CUDF failure")
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
def catch_polars_exception(exception: Exception) -> NarwhalsError | Exception:
|
| 268 |
+
if isinstance(exception, pl.exceptions.ColumnNotFoundError):
|
| 269 |
+
return ColumnNotFoundError(str(exception))
|
| 270 |
+
if isinstance(exception, pl.exceptions.ShapeError):
|
| 271 |
+
return ShapeError(str(exception))
|
| 272 |
+
if isinstance(exception, pl.exceptions.InvalidOperationError):
|
| 273 |
+
return InvalidOperationError(str(exception))
|
| 274 |
+
if isinstance(exception, pl.exceptions.DuplicateError):
|
| 275 |
+
return DuplicateError(str(exception))
|
| 276 |
+
if isinstance(exception, pl.exceptions.ComputeError):
|
| 277 |
+
return ComputeError(str(exception))
|
| 278 |
+
if _is_polars_exception(exception) or _is_cudf_exception(exception):
|
| 279 |
+
return NarwhalsError(str(exception)) # pragma: no cover
|
| 280 |
+
# Just return exception as-is.
|
| 281 |
+
return exception
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
class PolarsAnyNamespace(
|
| 285 |
+
_StoresCompliant[CompliantT_co],
|
| 286 |
+
_StoresNative[NativeT_co],
|
| 287 |
+
Protocol[CompliantT_co, NativeT_co],
|
| 288 |
+
):
|
| 289 |
+
_accessor: ClassVar[Accessor]
|
| 290 |
+
|
| 291 |
+
def __getattr__(self, attr: str) -> Callable[..., CompliantT_co]:
|
| 292 |
+
def func(*args: Any, **kwargs: Any) -> CompliantT_co:
|
| 293 |
+
pos, kwds = extract_args_kwargs(args, kwargs)
|
| 294 |
+
method = deep_getattr(self.native, self._accessor, attr)
|
| 295 |
+
return self.compliant._with_native(method(*pos, **kwds))
|
| 296 |
+
|
| 297 |
+
return func
|
| 298 |
+
|
| 299 |
+
|
| 300 |
+
class PolarsDateTimeNamespace(PolarsAnyNamespace[CompliantT, NativeT_co]):
|
| 301 |
+
_accessor: ClassVar[Accessor] = "dt"
|
| 302 |
+
|
| 303 |
+
def truncate(self, every: str) -> CompliantT:
|
| 304 |
+
# Ensure consistent error message is raised.
|
| 305 |
+
Interval.parse(every)
|
| 306 |
+
return self.__getattr__("truncate")(every)
|
| 307 |
+
|
| 308 |
+
def offset_by(self, by: str) -> CompliantT:
|
| 309 |
+
# Ensure consistent error message is raised.
|
| 310 |
+
Interval.parse_no_constraints(by)
|
| 311 |
+
return self.__getattr__("offset_by")(by)
|
| 312 |
+
|
| 313 |
+
to_string: Method[CompliantT]
|
| 314 |
+
replace_time_zone: Method[CompliantT]
|
| 315 |
+
convert_time_zone: Method[CompliantT]
|
| 316 |
+
timestamp: Method[CompliantT]
|
| 317 |
+
date: Method[CompliantT]
|
| 318 |
+
year: Method[CompliantT]
|
| 319 |
+
month: Method[CompliantT]
|
| 320 |
+
day: Method[CompliantT]
|
| 321 |
+
hour: Method[CompliantT]
|
| 322 |
+
minute: Method[CompliantT]
|
| 323 |
+
second: Method[CompliantT]
|
| 324 |
+
millisecond: Method[CompliantT]
|
| 325 |
+
microsecond: Method[CompliantT]
|
| 326 |
+
nanosecond: Method[CompliantT]
|
| 327 |
+
ordinal_day: Method[CompliantT]
|
| 328 |
+
weekday: Method[CompliantT]
|
| 329 |
+
total_minutes: Method[CompliantT]
|
| 330 |
+
total_seconds: Method[CompliantT]
|
| 331 |
+
total_milliseconds: Method[CompliantT]
|
| 332 |
+
total_microseconds: Method[CompliantT]
|
| 333 |
+
total_nanoseconds: Method[CompliantT]
|
| 334 |
+
|
| 335 |
+
|
| 336 |
+
class PolarsStringNamespace(PolarsAnyNamespace[CompliantT, NativeT_co]):
|
| 337 |
+
_accessor: ClassVar[Accessor] = "str"
|
| 338 |
+
|
| 339 |
+
# NOTE: Use `abstractmethod` if we have defs to implement, but also `Method` usage
|
| 340 |
+
@abc.abstractmethod
|
| 341 |
+
def to_titlecase(self) -> CompliantT: ...
|
| 342 |
+
|
| 343 |
+
@abc.abstractmethod
|
| 344 |
+
def zfill(self, width: int) -> CompliantT: ...
|
| 345 |
+
|
| 346 |
+
@abc.abstractmethod
|
| 347 |
+
def slice(self, offset: int, length: int | None) -> CompliantT: ...
|
| 348 |
+
|
| 349 |
+
len_chars: Method[CompliantT]
|
| 350 |
+
replace: Method[CompliantT]
|
| 351 |
+
replace_all: Method[CompliantT]
|
| 352 |
+
strip_chars: Method[CompliantT]
|
| 353 |
+
strip_chars_start: Method[CompliantT]
|
| 354 |
+
strip_chars_end: Method[CompliantT]
|
| 355 |
+
starts_with: Method[CompliantT]
|
| 356 |
+
ends_with: Method[CompliantT]
|
| 357 |
+
contains: Method[CompliantT]
|
| 358 |
+
split: Method[CompliantT]
|
| 359 |
+
to_date: Method[CompliantT]
|
| 360 |
+
to_datetime: Method[CompliantT]
|
| 361 |
+
to_time: Method[CompliantT]
|
| 362 |
+
to_lowercase: Method[CompliantT]
|
| 363 |
+
to_uppercase: Method[CompliantT]
|
| 364 |
+
pad_start: Method[CompliantT]
|
| 365 |
+
pad_end: Method[CompliantT]
|
| 366 |
+
|
| 367 |
+
|
| 368 |
+
def native_get_categories(native: pl.Series) -> pl.Series:
|
| 369 |
+
# NOTE: Polars deprecated `cat.get_categories` in v1.44 and removed it
|
| 370 |
+
# in v2.0, so we use the workaround they suggest.
|
| 371 |
+
# See https://github.com/narwhals-dev/narwhals/issues/3895.
|
| 372 |
+
#
|
| 373 |
+
# For `Enum`, the declared categories are already unique, ordered, and
|
| 374 |
+
# null-free, so we can return `dtype.categories` directly.
|
| 375 |
+
dtype = native.dtype
|
| 376 |
+
if isinstance(dtype, pl.Enum):
|
| 377 |
+
return dtype.categories
|
| 378 |
+
return native.unique(maintain_order=True).drop_nulls().cast(pl.String)
|
| 379 |
+
|
| 380 |
+
|
| 381 |
+
class PolarsCatNamespace(PolarsAnyNamespace[CompliantT, NativeT_co]):
|
| 382 |
+
_accessor: ClassVar[Accessor] = "cat"
|
| 383 |
+
|
| 384 |
+
@abc.abstractmethod
|
| 385 |
+
def get_categories(self) -> CompliantT: ...
|
| 386 |
+
|
| 387 |
+
|
| 388 |
+
class PolarsListNamespace(PolarsAnyNamespace[CompliantT, NativeT_co]):
|
| 389 |
+
_accessor: ClassVar[Accessor] = "list"
|
| 390 |
+
|
| 391 |
+
@abc.abstractmethod
|
| 392 |
+
def len(self) -> CompliantT: ...
|
| 393 |
+
|
| 394 |
+
get: Method[CompliantT]
|
| 395 |
+
|
| 396 |
+
unique: Method[CompliantT]
|
| 397 |
+
|
| 398 |
+
max: Method[CompliantT]
|
| 399 |
+
|
| 400 |
+
mean: Method[CompliantT]
|
| 401 |
+
|
| 402 |
+
median: Method[CompliantT]
|
| 403 |
+
|
| 404 |
+
min: Method[CompliantT]
|
| 405 |
+
|
| 406 |
+
sort: Method[CompliantT]
|
| 407 |
+
|
| 408 |
+
sum: Method[CompliantT]
|
| 409 |
+
|
| 410 |
+
|
| 411 |
+
class PolarsStructNamespace(PolarsAnyNamespace[CompliantT, NativeT_co]):
|
| 412 |
+
_accessor: ClassVar[Accessor] = "struct"
|
| 413 |
+
field: Method[CompliantT]
|
shared/package-files/9b/9b29fc93ae95aef6672fa47a556e880cf4df3baf15c636c9f14a7922e4a314be/blob
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <cstdint>
|
| 21 |
+
|
| 22 |
+
#include "arrow/util/bit_util.h"
|
| 23 |
+
#include "arrow/util/bitmap_reader.h"
|
| 24 |
+
|
| 25 |
+
namespace arrow {
|
| 26 |
+
namespace internal {
|
| 27 |
+
|
| 28 |
+
// A function that visits each bit in a bitmap and calls a visitor function with a
|
| 29 |
+
// boolean representation of that bit. This is intended to be analogous to
|
| 30 |
+
// GenerateBits.
|
| 31 |
+
template <class Visitor>
|
| 32 |
+
void VisitBits(const uint8_t* bitmap, int64_t start_offset, int64_t length,
|
| 33 |
+
Visitor&& visit) {
|
| 34 |
+
BitmapReader reader(bitmap, start_offset, length);
|
| 35 |
+
for (int64_t index = 0; index < length; ++index) {
|
| 36 |
+
visit(reader.IsSet());
|
| 37 |
+
reader.Next();
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
// Like VisitBits(), but unrolls its main loop for better performance.
|
| 42 |
+
template <class Visitor>
|
| 43 |
+
void VisitBitsUnrolled(const uint8_t* bitmap, int64_t start_offset, int64_t length,
|
| 44 |
+
Visitor&& visit) {
|
| 45 |
+
if (length == 0) {
|
| 46 |
+
return;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
// Start by visiting any bits preceding the first full byte.
|
| 50 |
+
int64_t num_bits_before_full_bytes =
|
| 51 |
+
bit_util::RoundUpToMultipleOf8(start_offset) - start_offset;
|
| 52 |
+
// Truncate num_bits_before_full_bytes if it is greater than length.
|
| 53 |
+
if (num_bits_before_full_bytes > length) {
|
| 54 |
+
num_bits_before_full_bytes = length;
|
| 55 |
+
}
|
| 56 |
+
// Use the non loop-unrolled VisitBits since we don't want to add branches
|
| 57 |
+
VisitBits<Visitor>(bitmap, start_offset, num_bits_before_full_bytes, visit);
|
| 58 |
+
|
| 59 |
+
// Shift the start pointer to the first full byte and compute the
|
| 60 |
+
// number of full bytes to be read.
|
| 61 |
+
const uint8_t* first_full_byte = bitmap + bit_util::CeilDiv(start_offset, 8);
|
| 62 |
+
const int64_t num_full_bytes = (length - num_bits_before_full_bytes) / 8;
|
| 63 |
+
|
| 64 |
+
// Iterate over each full byte of the input bitmap and call the visitor in
|
| 65 |
+
// a loop-unrolled manner.
|
| 66 |
+
for (int64_t byte_index = 0; byte_index < num_full_bytes; ++byte_index) {
|
| 67 |
+
// Get the current bit-packed byte value from the bitmap.
|
| 68 |
+
const uint8_t byte = *(first_full_byte + byte_index);
|
| 69 |
+
|
| 70 |
+
// Execute the visitor function on each bit of the current byte.
|
| 71 |
+
visit(bit_util::GetBitFromByte(byte, 0));
|
| 72 |
+
visit(bit_util::GetBitFromByte(byte, 1));
|
| 73 |
+
visit(bit_util::GetBitFromByte(byte, 2));
|
| 74 |
+
visit(bit_util::GetBitFromByte(byte, 3));
|
| 75 |
+
visit(bit_util::GetBitFromByte(byte, 4));
|
| 76 |
+
visit(bit_util::GetBitFromByte(byte, 5));
|
| 77 |
+
visit(bit_util::GetBitFromByte(byte, 6));
|
| 78 |
+
visit(bit_util::GetBitFromByte(byte, 7));
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
// Write any leftover bits in the last byte.
|
| 82 |
+
const int64_t num_bits_after_full_bytes = (length - num_bits_before_full_bytes) % 8;
|
| 83 |
+
VisitBits<Visitor>(first_full_byte + num_full_bytes, 0, num_bits_after_full_bytes,
|
| 84 |
+
visit);
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
} // namespace internal
|
| 88 |
+
} // namespace arrow
|
shared/package-files/9b/9b2c1a62c96e69385c72c6f7d5499d217c1773c48436f016e83412ea582aace6/blob
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <functional>
|
| 4 |
+
#include <memory>
|
| 5 |
+
|
| 6 |
+
#include <c10/core/Device.h>
|
| 7 |
+
#include <c10/util/strong_type.h>
|
| 8 |
+
#include <torch/csrc/Export.h>
|
| 9 |
+
|
| 10 |
+
struct CUevent_st;
|
| 11 |
+
|
| 12 |
+
namespace torch {
|
| 13 |
+
namespace profiler {
|
| 14 |
+
namespace impl {
|
| 15 |
+
|
| 16 |
+
// ----------------------------------------------------------------------------
|
| 17 |
+
// -- Annotation --------------------------------------------------------------
|
| 18 |
+
// ----------------------------------------------------------------------------
|
| 19 |
+
using ProfilerEventStub = std::shared_ptr<CUevent_st>;
|
| 20 |
+
using ProfilerVoidEventStub = std::shared_ptr<void>;
|
| 21 |
+
|
| 22 |
+
struct TORCH_API ProfilerStubs {
|
| 23 |
+
virtual void record(
|
| 24 |
+
c10::DeviceIndex* device,
|
| 25 |
+
ProfilerVoidEventStub* event,
|
| 26 |
+
int64_t* cpu_ns) const = 0;
|
| 27 |
+
virtual float elapsed(
|
| 28 |
+
const ProfilerVoidEventStub* event,
|
| 29 |
+
const ProfilerVoidEventStub* event2) const = 0;
|
| 30 |
+
virtual void mark(const char* name) const = 0;
|
| 31 |
+
virtual void rangePush(const char* name) const = 0;
|
| 32 |
+
virtual void rangePop() const = 0;
|
| 33 |
+
virtual bool enabled() const {
|
| 34 |
+
return false;
|
| 35 |
+
}
|
| 36 |
+
virtual void onEachDevice(std::function<void(int)> op) const = 0;
|
| 37 |
+
virtual void synchronize() const = 0;
|
| 38 |
+
virtual ~ProfilerStubs();
|
| 39 |
+
};
|
| 40 |
+
|
| 41 |
+
TORCH_API void registerCUDAMethods(ProfilerStubs* stubs);
|
| 42 |
+
TORCH_API const ProfilerStubs* cudaStubs();
|
| 43 |
+
TORCH_API void registerITTMethods(ProfilerStubs* stubs);
|
| 44 |
+
TORCH_API const ProfilerStubs* ittStubs();
|
| 45 |
+
TORCH_API void registerPrivateUse1Methods(ProfilerStubs* stubs);
|
| 46 |
+
TORCH_API const ProfilerStubs* privateuse1Stubs();
|
| 47 |
+
|
| 48 |
+
using vulkan_id_t = strong::type<
|
| 49 |
+
int64_t,
|
| 50 |
+
struct _VulkanID,
|
| 51 |
+
strong::regular,
|
| 52 |
+
strong::convertible_to<int64_t>,
|
| 53 |
+
strong::hashable>;
|
| 54 |
+
|
| 55 |
+
} // namespace impl
|
| 56 |
+
} // namespace profiler
|
| 57 |
+
} // namespace torch
|
shared/package-files/9b/9b2e55e0f1d3df31cb2b442f6a712a427eb98c9e7f9cd572eae97fd301d14f5f/blob
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
""" Functions related to graph covers."""
|
| 2 |
+
|
| 3 |
+
from functools import partial
|
| 4 |
+
from itertools import chain
|
| 5 |
+
|
| 6 |
+
import networkx as nx
|
| 7 |
+
from networkx.utils import arbitrary_element, not_implemented_for
|
| 8 |
+
|
| 9 |
+
__all__ = ["min_edge_cover", "is_edge_cover"]
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
@not_implemented_for("directed")
|
| 13 |
+
@not_implemented_for("multigraph")
|
| 14 |
+
def min_edge_cover(G, matching_algorithm=None):
|
| 15 |
+
"""Returns the min cardinality edge cover of the graph as a set of edges.
|
| 16 |
+
|
| 17 |
+
A smallest edge cover can be found in polynomial time by finding
|
| 18 |
+
a maximum matching and extending it greedily so that all nodes
|
| 19 |
+
are covered. This function follows that process. A maximum matching
|
| 20 |
+
algorithm can be specified for the first step of the algorithm.
|
| 21 |
+
The resulting set may return a set with one 2-tuple for each edge,
|
| 22 |
+
(the usual case) or with both 2-tuples `(u, v)` and `(v, u)` for
|
| 23 |
+
each edge. The latter is only done when a bipartite matching algorithm
|
| 24 |
+
is specified as `matching_algorithm`.
|
| 25 |
+
|
| 26 |
+
Parameters
|
| 27 |
+
----------
|
| 28 |
+
G : NetworkX graph
|
| 29 |
+
An undirected graph.
|
| 30 |
+
|
| 31 |
+
matching_algorithm : function
|
| 32 |
+
A function that returns a maximum cardinality matching for `G`.
|
| 33 |
+
The function must take one input, the graph `G`, and return
|
| 34 |
+
either a set of edges (with only one direction for the pair of nodes)
|
| 35 |
+
or a dictionary mapping each node to its mate. If not specified,
|
| 36 |
+
:func:`~networkx.algorithms.matching.max_weight_matching` is used.
|
| 37 |
+
Common bipartite matching functions include
|
| 38 |
+
:func:`~networkx.algorithms.bipartite.matching.hopcroft_karp_matching`
|
| 39 |
+
or
|
| 40 |
+
:func:`~networkx.algorithms.bipartite.matching.eppstein_matching`.
|
| 41 |
+
|
| 42 |
+
Returns
|
| 43 |
+
-------
|
| 44 |
+
min_cover : set
|
| 45 |
+
|
| 46 |
+
A set of the edges in a minimum edge cover in the form of tuples.
|
| 47 |
+
It contains only one of the equivalent 2-tuples `(u, v)` and `(v, u)`
|
| 48 |
+
for each edge. If a bipartite method is used to compute the matching,
|
| 49 |
+
the returned set contains both the 2-tuples `(u, v)` and `(v, u)`
|
| 50 |
+
for each edge of a minimum edge cover.
|
| 51 |
+
|
| 52 |
+
Examples
|
| 53 |
+
--------
|
| 54 |
+
>>> G = nx.Graph([(0, 1), (0, 2), (0, 3), (1, 2), (1, 3)])
|
| 55 |
+
>>> sorted(nx.min_edge_cover(G))
|
| 56 |
+
[(2, 1), (3, 0)]
|
| 57 |
+
|
| 58 |
+
Notes
|
| 59 |
+
-----
|
| 60 |
+
An edge cover of a graph is a set of edges such that every node of
|
| 61 |
+
the graph is incident to at least one edge of the set.
|
| 62 |
+
The minimum edge cover is an edge covering of smallest cardinality.
|
| 63 |
+
|
| 64 |
+
Due to its implementation, the worst-case running time of this algorithm
|
| 65 |
+
is bounded by the worst-case running time of the function
|
| 66 |
+
``matching_algorithm``.
|
| 67 |
+
|
| 68 |
+
Minimum edge cover for `G` can also be found using the `min_edge_covering`
|
| 69 |
+
function in :mod:`networkx.algorithms.bipartite.covering` which is
|
| 70 |
+
simply this function with a default matching algorithm of
|
| 71 |
+
:func:`~networkx.algorithms.bipartite.matching.hopcraft_karp_matching`
|
| 72 |
+
"""
|
| 73 |
+
if len(G) == 0:
|
| 74 |
+
return set()
|
| 75 |
+
if nx.number_of_isolates(G) > 0:
|
| 76 |
+
# ``min_cover`` does not exist as there is an isolated node
|
| 77 |
+
raise nx.NetworkXException(
|
| 78 |
+
"Graph has a node with no edge incident on it, " "so no edge cover exists."
|
| 79 |
+
)
|
| 80 |
+
if matching_algorithm is None:
|
| 81 |
+
matching_algorithm = partial(nx.max_weight_matching, maxcardinality=True)
|
| 82 |
+
maximum_matching = matching_algorithm(G)
|
| 83 |
+
# ``min_cover`` is superset of ``maximum_matching``
|
| 84 |
+
try:
|
| 85 |
+
# bipartite matching algs return dict so convert if needed
|
| 86 |
+
min_cover = set(maximum_matching.items())
|
| 87 |
+
bipartite_cover = True
|
| 88 |
+
except AttributeError:
|
| 89 |
+
min_cover = maximum_matching
|
| 90 |
+
bipartite_cover = False
|
| 91 |
+
# iterate for uncovered nodes
|
| 92 |
+
uncovered_nodes = set(G) - {v for u, v in min_cover} - {u for u, v in min_cover}
|
| 93 |
+
for v in uncovered_nodes:
|
| 94 |
+
# Since `v` is uncovered, each edge incident to `v` will join it
|
| 95 |
+
# with a covered node (otherwise, if there were an edge joining
|
| 96 |
+
# uncovered nodes `u` and `v`, the maximum matching algorithm
|
| 97 |
+
# would have found it), so we can choose an arbitrary edge
|
| 98 |
+
# incident to `v`. (This applies only in a simple graph, not a
|
| 99 |
+
# multigraph.)
|
| 100 |
+
u = arbitrary_element(G[v])
|
| 101 |
+
min_cover.add((u, v))
|
| 102 |
+
if bipartite_cover:
|
| 103 |
+
min_cover.add((v, u))
|
| 104 |
+
return min_cover
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
@not_implemented_for("directed")
|
| 108 |
+
def is_edge_cover(G, cover):
|
| 109 |
+
"""Decides whether a set of edges is a valid edge cover of the graph.
|
| 110 |
+
|
| 111 |
+
Given a set of edges, whether it is an edge covering can
|
| 112 |
+
be decided if we just check whether all nodes of the graph
|
| 113 |
+
has an edge from the set, incident on it.
|
| 114 |
+
|
| 115 |
+
Parameters
|
| 116 |
+
----------
|
| 117 |
+
G : NetworkX graph
|
| 118 |
+
An undirected bipartite graph.
|
| 119 |
+
|
| 120 |
+
cover : set
|
| 121 |
+
Set of edges to be checked.
|
| 122 |
+
|
| 123 |
+
Returns
|
| 124 |
+
-------
|
| 125 |
+
bool
|
| 126 |
+
Whether the set of edges is a valid edge cover of the graph.
|
| 127 |
+
|
| 128 |
+
Examples
|
| 129 |
+
--------
|
| 130 |
+
>>> G = nx.Graph([(0, 1), (0, 2), (0, 3), (1, 2), (1, 3)])
|
| 131 |
+
>>> cover = {(2, 1), (3, 0)}
|
| 132 |
+
>>> nx.is_edge_cover(G, cover)
|
| 133 |
+
True
|
| 134 |
+
|
| 135 |
+
Notes
|
| 136 |
+
-----
|
| 137 |
+
An edge cover of a graph is a set of edges such that every node of
|
| 138 |
+
the graph is incident to at least one edge of the set.
|
| 139 |
+
"""
|
| 140 |
+
return set(G) <= set(chain.from_iterable(cover))
|
shared/package-files/9b/9b2f91be34024fbcf645f6ef92460e5f944ca6a16268b79478ab904b2934d357/blob
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# created by tools/loadICU.tcl -- do not edit
|
| 2 |
+
namespace eval ::tcl::clock {
|
| 3 |
+
::msgcat::mcset el DAYS_OF_WEEK_ABBREV [list \
|
| 4 |
+
"\u039a\u03c5\u03c1"\
|
| 5 |
+
"\u0394\u03b5\u03c5"\
|
| 6 |
+
"\u03a4\u03c1\u03b9"\
|
| 7 |
+
"\u03a4\u03b5\u03c4"\
|
| 8 |
+
"\u03a0\u03b5\u03bc"\
|
| 9 |
+
"\u03a0\u03b1\u03c1"\
|
| 10 |
+
"\u03a3\u03b1\u03b2"]
|
| 11 |
+
::msgcat::mcset el DAYS_OF_WEEK_FULL [list \
|
| 12 |
+
"\u039a\u03c5\u03c1\u03b9\u03b1\u03ba\u03ae"\
|
| 13 |
+
"\u0394\u03b5\u03c5\u03c4\u03ad\u03c1\u03b1"\
|
| 14 |
+
"\u03a4\u03c1\u03af\u03c4\u03b7"\
|
| 15 |
+
"\u03a4\u03b5\u03c4\u03ac\u03c1\u03c4\u03b7"\
|
| 16 |
+
"\u03a0\u03ad\u03bc\u03c0\u03c4\u03b7"\
|
| 17 |
+
"\u03a0\u03b1\u03c1\u03b1\u03c3\u03ba\u03b5\u03c5\u03ae"\
|
| 18 |
+
"\u03a3\u03ac\u03b2\u03b2\u03b1\u03c4\u03bf"]
|
| 19 |
+
::msgcat::mcset el MONTHS_ABBREV [list \
|
| 20 |
+
"\u0399\u03b1\u03bd"\
|
| 21 |
+
"\u03a6\u03b5\u03b2"\
|
| 22 |
+
"\u039c\u03b1\u03c1"\
|
| 23 |
+
"\u0391\u03c0\u03c1"\
|
| 24 |
+
"\u039c\u03b1\u03ca"\
|
| 25 |
+
"\u0399\u03bf\u03c5\u03bd"\
|
| 26 |
+
"\u0399\u03bf\u03c5\u03bb"\
|
| 27 |
+
"\u0391\u03c5\u03b3"\
|
| 28 |
+
"\u03a3\u03b5\u03c0"\
|
| 29 |
+
"\u039f\u03ba\u03c4"\
|
| 30 |
+
"\u039d\u03bf\u03b5"\
|
| 31 |
+
"\u0394\u03b5\u03ba"\
|
| 32 |
+
""]
|
| 33 |
+
::msgcat::mcset el MONTHS_FULL [list \
|
| 34 |
+
"\u0399\u03b1\u03bd\u03bf\u03c5\u03ac\u03c1\u03b9\u03bf\u03c2"\
|
| 35 |
+
"\u03a6\u03b5\u03b2\u03c1\u03bf\u03c5\u03ac\u03c1\u03b9\u03bf\u03c2"\
|
| 36 |
+
"\u039c\u03ac\u03c1\u03c4\u03b9\u03bf\u03c2"\
|
| 37 |
+
"\u0391\u03c0\u03c1\u03af\u03bb\u03b9\u03bf\u03c2"\
|
| 38 |
+
"\u039c\u03ac\u03ca\u03bf\u03c2"\
|
| 39 |
+
"\u0399\u03bf\u03cd\u03bd\u03b9\u03bf\u03c2"\
|
| 40 |
+
"\u0399\u03bf\u03cd\u03bb\u03b9\u03bf\u03c2"\
|
| 41 |
+
"\u0391\u03cd\u03b3\u03bf\u03c5\u03c3\u03c4\u03bf\u03c2"\
|
| 42 |
+
"\u03a3\u03b5\u03c0\u03c4\u03ad\u03bc\u03b2\u03c1\u03b9\u03bf\u03c2"\
|
| 43 |
+
"\u039f\u03ba\u03c4\u03ce\u03b2\u03c1\u03b9\u03bf\u03c2"\
|
| 44 |
+
"\u039d\u03bf\u03ad\u03bc\u03b2\u03c1\u03b9\u03bf\u03c2"\
|
| 45 |
+
"\u0394\u03b5\u03ba\u03ad\u03bc\u03b2\u03c1\u03b9\u03bf\u03c2"\
|
| 46 |
+
""]
|
| 47 |
+
::msgcat::mcset el AM "\u03c0\u03bc"
|
| 48 |
+
::msgcat::mcset el PM "\u03bc\u03bc"
|
| 49 |
+
::msgcat::mcset el DATE_FORMAT "%e/%m/%Y"
|
| 50 |
+
::msgcat::mcset el TIME_FORMAT_12 "%l:%M:%S %P"
|
| 51 |
+
::msgcat::mcset el DATE_TIME_FORMAT "%e/%m/%Y %l:%M:%S %P %z"
|
| 52 |
+
}
|
shared/package-files/9b/9b2ff15cb3d217ce7ef0b06547f16743aef6d5363072c505bff85d03e769596e/blob
ADDED
|
@@ -0,0 +1,360 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.1
|
| 2 |
+
Name: pyOpenSSL
|
| 3 |
+
Version: 24.0.0
|
| 4 |
+
Summary: Python wrapper module around the OpenSSL library
|
| 5 |
+
Home-page: https://pyopenssl.org/
|
| 6 |
+
Author: The pyOpenSSL developers
|
| 7 |
+
Author-email: cryptography-dev@python.org
|
| 8 |
+
License: Apache License, Version 2.0
|
| 9 |
+
Project-URL: Source, https://github.com/pyca/pyopenssl
|
| 10 |
+
Classifier: Development Status :: 6 - Mature
|
| 11 |
+
Classifier: Intended Audience :: Developers
|
| 12 |
+
Classifier: License :: OSI Approved :: Apache Software License
|
| 13 |
+
Classifier: Operating System :: MacOS :: MacOS X
|
| 14 |
+
Classifier: Operating System :: Microsoft :: Windows
|
| 15 |
+
Classifier: Operating System :: POSIX
|
| 16 |
+
Classifier: Programming Language :: Python :: 3
|
| 17 |
+
Classifier: Programming Language :: Python :: 3.7
|
| 18 |
+
Classifier: Programming Language :: Python :: 3.8
|
| 19 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 20 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 21 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 22 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 23 |
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
| 24 |
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
| 25 |
+
Classifier: Topic :: Security :: Cryptography
|
| 26 |
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
| 27 |
+
Classifier: Topic :: System :: Networking
|
| 28 |
+
Requires-Python: >=3.7
|
| 29 |
+
License-File: LICENSE
|
| 30 |
+
Requires-Dist: cryptography <43,>=41.0.5
|
| 31 |
+
Provides-Extra: docs
|
| 32 |
+
Requires-Dist: sphinx !=5.2.0,!=5.2.0.post0,!=7.2.5 ; extra == 'docs'
|
| 33 |
+
Requires-Dist: sphinx-rtd-theme ; extra == 'docs'
|
| 34 |
+
Provides-Extra: test
|
| 35 |
+
Requires-Dist: flaky ; extra == 'test'
|
| 36 |
+
Requires-Dist: pretend ; extra == 'test'
|
| 37 |
+
Requires-Dist: pytest >=3.0.1 ; extra == 'test'
|
| 38 |
+
|
| 39 |
+
========================================================
|
| 40 |
+
pyOpenSSL -- A Python wrapper around the OpenSSL library
|
| 41 |
+
========================================================
|
| 42 |
+
|
| 43 |
+
.. image:: https://readthedocs.org/projects/pyopenssl/badge/?version=stable
|
| 44 |
+
:target: https://pyopenssl.org/en/stable/
|
| 45 |
+
:alt: Stable Docs
|
| 46 |
+
|
| 47 |
+
.. image:: https://github.com/pyca/pyopenssl/workflows/CI/badge.svg?branch=main
|
| 48 |
+
:target: https://github.com/pyca/pyopenssl/actions?query=workflow%3ACI+branch%3Amain
|
| 49 |
+
|
| 50 |
+
.. image:: https://codecov.io/github/pyca/pyopenssl/branch/main/graph/badge.svg
|
| 51 |
+
:target: https://codecov.io/github/pyca/pyopenssl
|
| 52 |
+
:alt: Test coverage
|
| 53 |
+
|
| 54 |
+
**Note:** The Python Cryptographic Authority **strongly suggests** the use of `pyca/cryptography`_
|
| 55 |
+
where possible. If you are using pyOpenSSL for anything other than making a TLS connection
|
| 56 |
+
**you should move to cryptography and drop your pyOpenSSL dependency**.
|
| 57 |
+
|
| 58 |
+
High-level wrapper around a subset of the OpenSSL library. Includes
|
| 59 |
+
|
| 60 |
+
* ``SSL.Connection`` objects, wrapping the methods of Python's portable sockets
|
| 61 |
+
* Callbacks written in Python
|
| 62 |
+
* Extensive error-handling mechanism, mirroring OpenSSL's error codes
|
| 63 |
+
|
| 64 |
+
... and much more.
|
| 65 |
+
|
| 66 |
+
You can find more information in the documentation_.
|
| 67 |
+
Development takes place on GitHub_.
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
Discussion
|
| 71 |
+
==========
|
| 72 |
+
|
| 73 |
+
If you run into bugs, you can file them in our `issue tracker`_.
|
| 74 |
+
|
| 75 |
+
We maintain a cryptography-dev_ mailing list for both user and development discussions.
|
| 76 |
+
|
| 77 |
+
You can also join ``#pyca`` on ``irc.libera.chat`` to ask questions or get involved.
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
.. _documentation: https://pyopenssl.org/
|
| 81 |
+
.. _`issue tracker`: https://github.com/pyca/pyopenssl/issues
|
| 82 |
+
.. _cryptography-dev: https://mail.python.org/mailman/listinfo/cryptography-dev
|
| 83 |
+
.. _GitHub: https://github.com/pyca/pyopenssl
|
| 84 |
+
.. _`pyca/cryptography`: https://github.com/pyca/cryptography
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
Release Information
|
| 88 |
+
===================
|
| 89 |
+
|
| 90 |
+
24.0.0 (2024-01-22)
|
| 91 |
+
-------------------
|
| 92 |
+
|
| 93 |
+
Backward-incompatible changes:
|
| 94 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 95 |
+
|
| 96 |
+
Deprecations:
|
| 97 |
+
^^^^^^^^^^^^^
|
| 98 |
+
|
| 99 |
+
Changes:
|
| 100 |
+
^^^^^^^^
|
| 101 |
+
|
| 102 |
+
- Added ``OpenSSL.SSL.Connection.get_selected_srtp_profile`` to determine which SRTP profile was negotiated.
|
| 103 |
+
`#1279 <https://github.com/pyca/pyopenssl/pull/1279>`_.
|
| 104 |
+
|
| 105 |
+
23.3.0 (2023-10-25)
|
| 106 |
+
-------------------
|
| 107 |
+
|
| 108 |
+
Backward-incompatible changes:
|
| 109 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 110 |
+
|
| 111 |
+
- Dropped support for Python 3.6.
|
| 112 |
+
- The minimum ``cryptography`` version is now 41.0.5.
|
| 113 |
+
- Removed ``OpenSSL.crypto.loads_pkcs7`` and ``OpenSSL.crypto.loads_pkcs12`` which had been deprecated for 3 years.
|
| 114 |
+
- Added ``OpenSSL.SSL.OP_LEGACY_SERVER_CONNECT`` to allow legacy insecure renegotiation between OpenSSL and unpatched servers.
|
| 115 |
+
`#1234 <https://github.com/pyca/pyopenssl/pull/1234>`_.
|
| 116 |
+
|
| 117 |
+
Deprecations:
|
| 118 |
+
^^^^^^^^^^^^^
|
| 119 |
+
|
| 120 |
+
- Deprecated ``OpenSSL.crypto.PKCS12`` (which was intended to have been deprecated at the same time as ``OpenSSL.crypto.load_pkcs12``).
|
| 121 |
+
- Deprecated ``OpenSSL.crypto.NetscapeSPKI``.
|
| 122 |
+
- Deprecated ``OpenSSL.crypto.CRL``
|
| 123 |
+
- Deprecated ``OpenSSL.crypto.Revoked``
|
| 124 |
+
- Deprecated ``OpenSSL.crypto.load_crl`` and ``OpenSSL.crypto.dump_crl``
|
| 125 |
+
- Deprecated ``OpenSSL.crypto.sign`` and ``OpenSSL.crypto.verify``
|
| 126 |
+
- Deprecated ``OpenSSL.crypto.X509Extension``
|
| 127 |
+
|
| 128 |
+
Changes:
|
| 129 |
+
^^^^^^^^
|
| 130 |
+
|
| 131 |
+
- Changed ``OpenSSL.crypto.X509Store.add_crl`` to also accept
|
| 132 |
+
``cryptography``'s ``x509.CertificateRevocationList`` arguments in addition
|
| 133 |
+
to the now deprecated ``OpenSSL.crypto.CRL`` arguments.
|
| 134 |
+
- Fixed ``test_set_default_verify_paths`` test so that it is skipped if no
|
| 135 |
+
network connection is available.
|
| 136 |
+
|
| 137 |
+
23.2.0 (2023-05-30)
|
| 138 |
+
-------------------
|
| 139 |
+
|
| 140 |
+
Backward-incompatible changes:
|
| 141 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 142 |
+
|
| 143 |
+
- Removed ``X509StoreFlags.NOTIFY_POLICY``.
|
| 144 |
+
`#1213 <https://github.com/pyca/pyopenssl/pull/1213>`_.
|
| 145 |
+
|
| 146 |
+
Deprecations:
|
| 147 |
+
^^^^^^^^^^^^^
|
| 148 |
+
|
| 149 |
+
Changes:
|
| 150 |
+
^^^^^^^^
|
| 151 |
+
|
| 152 |
+
- ``cryptography`` maximum version has been increased to 41.0.x.
|
| 153 |
+
- Invalid versions are now rejected in ``OpenSSL.crypto.X509Req.set_version``.
|
| 154 |
+
- Added ``X509VerificationCodes`` to ``OpenSSL.SSL``.
|
| 155 |
+
`#1202 <https://github.com/pyca/pyopenssl/pull/1202>`_.
|
| 156 |
+
|
| 157 |
+
23.1.1 (2023-03-28)
|
| 158 |
+
-------------------
|
| 159 |
+
|
| 160 |
+
Backward-incompatible changes:
|
| 161 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 162 |
+
|
| 163 |
+
Deprecations:
|
| 164 |
+
^^^^^^^^^^^^^
|
| 165 |
+
|
| 166 |
+
Changes:
|
| 167 |
+
^^^^^^^^
|
| 168 |
+
|
| 169 |
+
- Worked around an issue in OpenSSL 3.1.0 which caused `X509Extension.get_short_name` to raise an exception when no short name was known to OpenSSL.
|
| 170 |
+
`#1204 <https://github.com/pyca/pyopenssl/pull/1204>`_.
|
| 171 |
+
|
| 172 |
+
23.1.0 (2023-03-24)
|
| 173 |
+
-------------------
|
| 174 |
+
|
| 175 |
+
Backward-incompatible changes:
|
| 176 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 177 |
+
|
| 178 |
+
Deprecations:
|
| 179 |
+
^^^^^^^^^^^^^
|
| 180 |
+
|
| 181 |
+
Changes:
|
| 182 |
+
^^^^^^^^
|
| 183 |
+
|
| 184 |
+
- ``cryptography`` maximum version has been increased to 40.0.x.
|
| 185 |
+
- Add ``OpenSSL.SSL.Connection.DTLSv1_get_timeout`` and ``OpenSSL.SSL.Connection.DTLSv1_handle_timeout``
|
| 186 |
+
to support DTLS timeouts `#1180 <https://github.com/pyca/pyopenssl/pull/1180>`_.
|
| 187 |
+
|
| 188 |
+
23.0.0 (2023-01-01)
|
| 189 |
+
-------------------
|
| 190 |
+
|
| 191 |
+
Backward-incompatible changes:
|
| 192 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 193 |
+
|
| 194 |
+
Deprecations:
|
| 195 |
+
^^^^^^^^^^^^^
|
| 196 |
+
|
| 197 |
+
Changes:
|
| 198 |
+
^^^^^^^^
|
| 199 |
+
|
| 200 |
+
- Add ``OpenSSL.SSL.X509StoreFlags.PARTIAL_CHAIN`` constant to allow for users
|
| 201 |
+
to perform certificate verification on partial certificate chains.
|
| 202 |
+
`#1166 <https://github.com/pyca/pyopenssl/pull/1166>`_
|
| 203 |
+
- ``cryptography`` maximum version has been increased to 39.0.x.
|
| 204 |
+
|
| 205 |
+
22.1.0 (2022-09-25)
|
| 206 |
+
-------------------
|
| 207 |
+
|
| 208 |
+
Backward-incompatible changes:
|
| 209 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 210 |
+
|
| 211 |
+
- Remove support for SSLv2 and SSLv3.
|
| 212 |
+
- The minimum ``cryptography`` version is now 38.0.x (and we now pin releases
|
| 213 |
+
against ``cryptography`` major versions to prevent future breakage)
|
| 214 |
+
- The ``OpenSSL.crypto.X509StoreContextError`` exception has been refactored,
|
| 215 |
+
changing its internal attributes.
|
| 216 |
+
`#1133 <https://github.com/pyca/pyopenssl/pull/1133>`_
|
| 217 |
+
|
| 218 |
+
Deprecations:
|
| 219 |
+
^^^^^^^^^^^^^
|
| 220 |
+
|
| 221 |
+
- ``OpenSSL.SSL.SSLeay_version`` is deprecated in favor of
|
| 222 |
+
``OpenSSL.SSL.OpenSSL_version``. The constants ``OpenSSL.SSL.SSLEAY_*`` are
|
| 223 |
+
deprecated in favor of ``OpenSSL.SSL.OPENSSL_*``.
|
| 224 |
+
|
| 225 |
+
Changes:
|
| 226 |
+
^^^^^^^^
|
| 227 |
+
|
| 228 |
+
- Add ``OpenSSL.SSL.Connection.set_verify`` and ``OpenSSL.SSL.Connection.get_verify_mode``
|
| 229 |
+
to override the context object's verification flags.
|
| 230 |
+
`#1073 <https://github.com/pyca/pyopenssl/pull/1073>`_
|
| 231 |
+
- Add ``OpenSSL.SSL.Connection.use_certificate`` and ``OpenSSL.SSL.Connection.use_privatekey``
|
| 232 |
+
to set a certificate per connection (and not just per context) `#1121 <https://github.com/pyca/pyopenssl/pull/1121>`_.
|
| 233 |
+
|
| 234 |
+
22.0.0 (2022-01-29)
|
| 235 |
+
-------------------
|
| 236 |
+
|
| 237 |
+
Backward-incompatible changes:
|
| 238 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 239 |
+
|
| 240 |
+
- Drop support for Python 2.7.
|
| 241 |
+
`#1047 <https://github.com/pyca/pyopenssl/pull/1047>`_
|
| 242 |
+
- The minimum ``cryptography`` version is now 35.0.
|
| 243 |
+
|
| 244 |
+
Deprecations:
|
| 245 |
+
^^^^^^^^^^^^^
|
| 246 |
+
|
| 247 |
+
Changes:
|
| 248 |
+
^^^^^^^^
|
| 249 |
+
|
| 250 |
+
- Expose wrappers for some `DTLS
|
| 251 |
+
<https://en.wikipedia.org/wiki/Datagram_Transport_Layer_Security>`_
|
| 252 |
+
primitives. `#1026 <https://github.com/pyca/pyopenssl/pull/1026>`_
|
| 253 |
+
|
| 254 |
+
21.0.0 (2021-09-28)
|
| 255 |
+
-------------------
|
| 256 |
+
|
| 257 |
+
Backward-incompatible changes:
|
| 258 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 259 |
+
|
| 260 |
+
- The minimum ``cryptography`` version is now 3.3.
|
| 261 |
+
- Drop support for Python 3.5
|
| 262 |
+
|
| 263 |
+
Deprecations:
|
| 264 |
+
^^^^^^^^^^^^^
|
| 265 |
+
|
| 266 |
+
Changes:
|
| 267 |
+
^^^^^^^^
|
| 268 |
+
|
| 269 |
+
- Raise an error when an invalid ALPN value is set.
|
| 270 |
+
`#993 <https://github.com/pyca/pyopenssl/pull/993>`_
|
| 271 |
+
- Added ``OpenSSL.SSL.Context.set_min_proto_version`` and ``OpenSSL.SSL.Context.set_max_proto_version``
|
| 272 |
+
to set the minimum and maximum supported TLS version `#985 <https://github.com/pyca/pyopenssl/pull/985>`_.
|
| 273 |
+
- Updated ``to_cryptography`` and ``from_cryptography`` methods to support an upcoming release of ``cryptography`` without raising deprecation warnings.
|
| 274 |
+
`#1030 <https://github.com/pyca/pyopenssl/pull/1030>`_
|
| 275 |
+
|
| 276 |
+
20.0.1 (2020-12-15)
|
| 277 |
+
-------------------
|
| 278 |
+
|
| 279 |
+
Backward-incompatible changes:
|
| 280 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 281 |
+
|
| 282 |
+
Deprecations:
|
| 283 |
+
^^^^^^^^^^^^^
|
| 284 |
+
|
| 285 |
+
Changes:
|
| 286 |
+
^^^^^^^^
|
| 287 |
+
|
| 288 |
+
- Fixed compatibility with OpenSSL 1.1.0.
|
| 289 |
+
|
| 290 |
+
20.0.0 (2020-11-27)
|
| 291 |
+
-------------------
|
| 292 |
+
|
| 293 |
+
|
| 294 |
+
Backward-incompatible changes:
|
| 295 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 296 |
+
|
| 297 |
+
- The minimum ``cryptography`` version is now 3.2.
|
| 298 |
+
- Remove deprecated ``OpenSSL.tsafe`` module.
|
| 299 |
+
- Removed deprecated ``OpenSSL.SSL.Context.set_npn_advertise_callback``, ``OpenSSL.SSL.Context.set_npn_select_callback``, and ``OpenSSL.SSL.Connection.get_next_proto_negotiated``.
|
| 300 |
+
- Drop support for Python 3.4
|
| 301 |
+
- Drop support for OpenSSL 1.0.1 and 1.0.2
|
| 302 |
+
|
| 303 |
+
Deprecations:
|
| 304 |
+
^^^^^^^^^^^^^
|
| 305 |
+
|
| 306 |
+
- Deprecated ``OpenSSL.crypto.loads_pkcs7`` and ``OpenSSL.crypto.loads_pkcs12``.
|
| 307 |
+
|
| 308 |
+
Changes:
|
| 309 |
+
^^^^^^^^
|
| 310 |
+
|
| 311 |
+
- Added a new optional ``chain`` parameter to ``OpenSSL.crypto.X509StoreContext()``
|
| 312 |
+
where additional untrusted certificates can be specified to help chain building.
|
| 313 |
+
`#948 <https://github.com/pyca/pyopenssl/pull/948>`_
|
| 314 |
+
- Added ``OpenSSL.crypto.X509Store.load_locations`` to set trusted
|
| 315 |
+
certificate file bundles and/or directories for verification.
|
| 316 |
+
`#943 <https://github.com/pyca/pyopenssl/pull/943>`_
|
| 317 |
+
- Added ``Context.set_keylog_callback`` to log key material.
|
| 318 |
+
`#910 <https://github.com/pyca/pyopenssl/pull/910>`_
|
| 319 |
+
- Added ``OpenSSL.SSL.Connection.get_verified_chain`` to retrieve the
|
| 320 |
+
verified certificate chain of the peer.
|
| 321 |
+
`#894 <https://github.com/pyca/pyopenssl/pull/894>`_.
|
| 322 |
+
- Make verification callback optional in ``Context.set_verify``.
|
| 323 |
+
If omitted, OpenSSL's default verification is used.
|
| 324 |
+
`#933 <https://github.com/pyca/pyopenssl/pull/933>`_
|
| 325 |
+
- Fixed a bug that could truncate or cause a zero-length key error due to a
|
| 326 |
+
null byte in private key passphrase in ``OpenSSL.crypto.load_privatekey``
|
| 327 |
+
and ``OpenSSL.crypto.dump_privatekey``.
|
| 328 |
+
`#947 <https://github.com/pyca/pyopenssl/pull/947>`_
|
| 329 |
+
|
| 330 |
+
19.1.0 (2019-11-18)
|
| 331 |
+
-------------------
|
| 332 |
+
|
| 333 |
+
|
| 334 |
+
Backward-incompatible changes:
|
| 335 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 336 |
+
|
| 337 |
+
- Removed deprecated ``ContextType``, ``ConnectionType``, ``PKeyType``, ``X509NameType``, ``X509ReqType``, ``X509Type``, ``X509StoreType``, ``CRLType``, ``PKCS7Type``, ``PKCS12Type``, and ``NetscapeSPKIType`` aliases.
|
| 338 |
+
Use the classes without the ``Type`` suffix instead.
|
| 339 |
+
`#814 <https://github.com/pyca/pyopenssl/pull/814>`_
|
| 340 |
+
- The minimum ``cryptography`` version is now 2.8 due to issues on macOS with a transitive dependency.
|
| 341 |
+
`#875 <https://github.com/pyca/pyopenssl/pull/875>`_
|
| 342 |
+
|
| 343 |
+
Deprecations:
|
| 344 |
+
^^^^^^^^^^^^^
|
| 345 |
+
|
| 346 |
+
- Deprecated ``OpenSSL.SSL.Context.set_npn_advertise_callback``, ``OpenSSL.SSL.Context.set_npn_select_callback``, and ``OpenSSL.SSL.Connection.get_next_proto_negotiated``.
|
| 347 |
+
ALPN should be used instead.
|
| 348 |
+
`#820 <https://github.com/pyca/pyopenssl/pull/820>`_
|
| 349 |
+
|
| 350 |
+
|
| 351 |
+
Changes:
|
| 352 |
+
^^^^^^^^
|
| 353 |
+
|
| 354 |
+
- Support ``bytearray`` in ``SSL.Connection.send()`` by using cffi's from_buffer.
|
| 355 |
+
`#852 <https://github.com/pyca/pyopenssl/pull/852>`_
|
| 356 |
+
- The ``OpenSSL.SSL.Context.set_alpn_select_callback`` can return a new ``NO_OVERLAPPING_PROTOCOLS`` sentinel value
|
| 357 |
+
to allow a TLS handshake to complete without an application protocol.
|
| 358 |
+
|
| 359 |
+
`Full changelog <https://pyopenssl.org/en/stable/changelog.html>`_.
|
| 360 |
+
|
shared/package-files/9b/9b34108030dba74e01d372b226ba2cb0ba7c62aef6449ce3a7edc0adf8db307f/blob
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
try:
|
| 2 |
+
from ctypes import c_float, c_int, c_double
|
| 3 |
+
except ImportError:
|
| 4 |
+
pass
|
| 5 |
+
|
| 6 |
+
import pyglet.gl as pgl
|
| 7 |
+
from sympy.core import S
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def get_model_matrix(array_type=c_float, glGetMethod=pgl.glGetFloatv):
|
| 11 |
+
"""
|
| 12 |
+
Returns the current modelview matrix.
|
| 13 |
+
"""
|
| 14 |
+
m = (array_type*16)()
|
| 15 |
+
glGetMethod(pgl.GL_MODELVIEW_MATRIX, m)
|
| 16 |
+
return m
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def get_projection_matrix(array_type=c_float, glGetMethod=pgl.glGetFloatv):
|
| 20 |
+
"""
|
| 21 |
+
Returns the current modelview matrix.
|
| 22 |
+
"""
|
| 23 |
+
m = (array_type*16)()
|
| 24 |
+
glGetMethod(pgl.GL_PROJECTION_MATRIX, m)
|
| 25 |
+
return m
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def get_viewport():
|
| 29 |
+
"""
|
| 30 |
+
Returns the current viewport.
|
| 31 |
+
"""
|
| 32 |
+
m = (c_int*4)()
|
| 33 |
+
pgl.glGetIntegerv(pgl.GL_VIEWPORT, m)
|
| 34 |
+
return m
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def get_direction_vectors():
|
| 38 |
+
m = get_model_matrix()
|
| 39 |
+
return ((m[0], m[4], m[8]),
|
| 40 |
+
(m[1], m[5], m[9]),
|
| 41 |
+
(m[2], m[6], m[10]))
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def get_view_direction_vectors():
|
| 45 |
+
m = get_model_matrix()
|
| 46 |
+
return ((m[0], m[1], m[2]),
|
| 47 |
+
(m[4], m[5], m[6]),
|
| 48 |
+
(m[8], m[9], m[10]))
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def get_basis_vectors():
|
| 52 |
+
return ((1, 0, 0), (0, 1, 0), (0, 0, 1))
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def screen_to_model(x, y, z):
|
| 56 |
+
m = get_model_matrix(c_double, pgl.glGetDoublev)
|
| 57 |
+
p = get_projection_matrix(c_double, pgl.glGetDoublev)
|
| 58 |
+
w = get_viewport()
|
| 59 |
+
mx, my, mz = c_double(), c_double(), c_double()
|
| 60 |
+
pgl.gluUnProject(x, y, z, m, p, w, mx, my, mz)
|
| 61 |
+
return float(mx.value), float(my.value), float(mz.value)
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def model_to_screen(x, y, z):
|
| 65 |
+
m = get_model_matrix(c_double, pgl.glGetDoublev)
|
| 66 |
+
p = get_projection_matrix(c_double, pgl.glGetDoublev)
|
| 67 |
+
w = get_viewport()
|
| 68 |
+
mx, my, mz = c_double(), c_double(), c_double()
|
| 69 |
+
pgl.gluProject(x, y, z, m, p, w, mx, my, mz)
|
| 70 |
+
return float(mx.value), float(my.value), float(mz.value)
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
def vec_subs(a, b):
|
| 74 |
+
return tuple(a[i] - b[i] for i in range(len(a)))
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
def billboard_matrix():
|
| 78 |
+
"""
|
| 79 |
+
Removes rotational components of
|
| 80 |
+
current matrix so that primitives
|
| 81 |
+
are always drawn facing the viewer.
|
| 82 |
+
|
| 83 |
+
|1|0|0|x|
|
| 84 |
+
|0|1|0|x|
|
| 85 |
+
|0|0|1|x| (x means left unchanged)
|
| 86 |
+
|x|x|x|x|
|
| 87 |
+
"""
|
| 88 |
+
m = get_model_matrix()
|
| 89 |
+
# XXX: for i in range(11): m[i] = i ?
|
| 90 |
+
m[0] = 1
|
| 91 |
+
m[1] = 0
|
| 92 |
+
m[2] = 0
|
| 93 |
+
m[4] = 0
|
| 94 |
+
m[5] = 1
|
| 95 |
+
m[6] = 0
|
| 96 |
+
m[8] = 0
|
| 97 |
+
m[9] = 0
|
| 98 |
+
m[10] = 1
|
| 99 |
+
pgl.glLoadMatrixf(m)
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
def create_bounds():
|
| 103 |
+
return [[S.Infinity, S.NegativeInfinity, 0],
|
| 104 |
+
[S.Infinity, S.NegativeInfinity, 0],
|
| 105 |
+
[S.Infinity, S.NegativeInfinity, 0]]
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def update_bounds(b, v):
|
| 109 |
+
if v is None:
|
| 110 |
+
return
|
| 111 |
+
for axis in range(3):
|
| 112 |
+
b[axis][0] = min([b[axis][0], v[axis]])
|
| 113 |
+
b[axis][1] = max([b[axis][1], v[axis]])
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
def interpolate(a_min, a_max, a_ratio):
|
| 117 |
+
return a_min + a_ratio * (a_max - a_min)
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
def rinterpolate(a_min, a_max, a_value):
|
| 121 |
+
a_range = a_max - a_min
|
| 122 |
+
if a_max == a_min:
|
| 123 |
+
a_range = 1.0
|
| 124 |
+
return (a_value - a_min) / float(a_range)
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
def interpolate_color(color1, color2, ratio):
|
| 128 |
+
return tuple(interpolate(color1[i], color2[i], ratio) for i in range(3))
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
def scale_value(v, v_min, v_len):
|
| 132 |
+
return (v - v_min) / v_len
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
def scale_value_list(flist):
|
| 136 |
+
v_min, v_max = min(flist), max(flist)
|
| 137 |
+
v_len = v_max - v_min
|
| 138 |
+
return [scale_value(f, v_min, v_len) for f in flist]
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
def strided_range(r_min, r_max, stride, max_steps=50):
|
| 142 |
+
o_min, o_max = r_min, r_max
|
| 143 |
+
if abs(r_min - r_max) < 0.001:
|
| 144 |
+
return []
|
| 145 |
+
try:
|
| 146 |
+
range(int(r_min - r_max))
|
| 147 |
+
except (TypeError, OverflowError):
|
| 148 |
+
return []
|
| 149 |
+
if r_min > r_max:
|
| 150 |
+
raise ValueError("r_min cannot be greater than r_max")
|
| 151 |
+
r_min_s = (r_min % stride)
|
| 152 |
+
r_max_s = stride - (r_max % stride)
|
| 153 |
+
if abs(r_max_s - stride) < 0.001:
|
| 154 |
+
r_max_s = 0.0
|
| 155 |
+
r_min -= r_min_s
|
| 156 |
+
r_max += r_max_s
|
| 157 |
+
r_steps = int((r_max - r_min)/stride)
|
| 158 |
+
if max_steps and r_steps > max_steps:
|
| 159 |
+
return strided_range(o_min, o_max, stride*2)
|
| 160 |
+
return [r_min] + [r_min + e*stride for e in range(1, r_steps + 1)] + [r_max]
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
def parse_option_string(s):
|
| 164 |
+
if not isinstance(s, str):
|
| 165 |
+
return None
|
| 166 |
+
options = {}
|
| 167 |
+
for token in s.split(';'):
|
| 168 |
+
pieces = token.split('=')
|
| 169 |
+
if len(pieces) == 1:
|
| 170 |
+
option, value = pieces[0], ""
|
| 171 |
+
elif len(pieces) == 2:
|
| 172 |
+
option, value = pieces
|
| 173 |
+
else:
|
| 174 |
+
raise ValueError("Plot option string '%s' is malformed." % (s))
|
| 175 |
+
options[option.strip()] = value.strip()
|
| 176 |
+
return options
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
def dot_product(v1, v2):
|
| 180 |
+
return sum(v1[i]*v2[i] for i in range(3))
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
def vec_sub(v1, v2):
|
| 184 |
+
return tuple(v1[i] - v2[i] for i in range(3))
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
def vec_mag(v):
|
| 188 |
+
return sum(v[i]**2 for i in range(3))**(0.5)
|
shared/package-files/9b/9b3bb70cade8184ee8eca3239aa7e6762ad6be906e15e8ea42ed5629b8abdafa/blob
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Translated from Cython into C++ by SciPy developers in 2024.
|
| 2 |
+
* Original header with Copyright information appears below.
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
/* Implementation of sin/cos/sinh/cosh integrals for complex arguments
|
| 6 |
+
*
|
| 7 |
+
* Sources
|
| 8 |
+
* [1] Fredrik Johansson and others. mpmath: a Python library for
|
| 9 |
+
* arbitrary-precision floating-point arithmetic (version 0.19),
|
| 10 |
+
* December 2013. http://mpmath.org/.
|
| 11 |
+
* [2] NIST, "Digital Library of Mathematical Functions",
|
| 12 |
+
* https://dlmf.nist.gov/
|
| 13 |
+
*/
|
| 14 |
+
|
| 15 |
+
#pragma once
|
| 16 |
+
|
| 17 |
+
#include "config.h"
|
| 18 |
+
#include "error.h"
|
| 19 |
+
|
| 20 |
+
#include "expint.h"
|
| 21 |
+
#include "cephes/const.h"
|
| 22 |
+
#include "cephes/sici.h"
|
| 23 |
+
#include "cephes/shichi.h"
|
| 24 |
+
|
| 25 |
+
namespace xsf {
|
| 26 |
+
namespace detail {
|
| 27 |
+
|
| 28 |
+
XSF_HOST_DEVICE inline void sici_power_series(int sgn, std::complex<double> z,
|
| 29 |
+
std::complex<double> *s, std::complex<double> *c) {
|
| 30 |
+
/* DLMF 6.6.5 and 6.6.6. If sgn = -1 computes si/ci, and if sgn = 1
|
| 31 |
+
* computes shi/chi.
|
| 32 |
+
*/
|
| 33 |
+
std::complex<double> fac = z;
|
| 34 |
+
*s = fac;
|
| 35 |
+
*c = 0;
|
| 36 |
+
std::complex<double> term1, term2;
|
| 37 |
+
for (int n = 1; n < 100; n++) {
|
| 38 |
+
fac *= static_cast<double>(sgn)*z/(2.0*n);
|
| 39 |
+
term2 = fac/(2.0*n);
|
| 40 |
+
*c += term2;
|
| 41 |
+
fac *= z/(2.0*n + 1.0);
|
| 42 |
+
term1 = fac/(2.0*n + 1.0);
|
| 43 |
+
*s += term1;
|
| 44 |
+
constexpr double tol = std::numeric_limits<double>::epsilon();
|
| 45 |
+
if (std::abs(term1) < tol*std::abs(*s) && std::abs(term2) < tol*std::abs(*c)) {
|
| 46 |
+
break;
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
XSF_HOST_DEVICE inline int sici(std::complex<double> z,
|
| 55 |
+
std::complex<double> *si, std::complex<double> *ci) {
|
| 56 |
+
/* Compute sin/cos integrals at complex arguments. The algorithm
|
| 57 |
+
* largely follows that of [1].
|
| 58 |
+
*/
|
| 59 |
+
|
| 60 |
+
constexpr double EULER = xsf::cephes::detail::SCIPY_EULER;
|
| 61 |
+
|
| 62 |
+
if (z == std::numeric_limits<double>::infinity()) {
|
| 63 |
+
*si = M_PI_2;
|
| 64 |
+
*ci = 0;
|
| 65 |
+
return 0;
|
| 66 |
+
}
|
| 67 |
+
if (z == -std::numeric_limits<double>::infinity()) {
|
| 68 |
+
*si = -M_PI_2;
|
| 69 |
+
*ci = {0.0, M_PI};
|
| 70 |
+
return 0;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
if (std::abs(z) < 0.8) {
|
| 74 |
+
// Use the series to avoid cancellation in si
|
| 75 |
+
detail::sici_power_series(-1, z, si, ci);
|
| 76 |
+
|
| 77 |
+
if (z == 0.0) {
|
| 78 |
+
set_error("sici", SF_ERROR_DOMAIN, NULL);
|
| 79 |
+
*ci = {-std::numeric_limits<double>::infinity(), std::numeric_limits<double>::quiet_NaN()};
|
| 80 |
+
} else {
|
| 81 |
+
*ci += EULER + std::log(z);
|
| 82 |
+
}
|
| 83 |
+
return 0;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
// DLMF 6.5.5/6.5.6 plus DLMF 6.4.4/6.4.6/6.4.7
|
| 87 |
+
std::complex<double> jz = std::complex<double>(0.0, 1.0) * z;
|
| 88 |
+
std::complex<double> term1 = expi(jz);
|
| 89 |
+
std::complex<double> term2 = expi(-jz);
|
| 90 |
+
*si = std::complex<double>(0.0, -0.5)*(term1 - term2);
|
| 91 |
+
*ci = 0.5*(term1 + term2);
|
| 92 |
+
if (z.real() == 0) {
|
| 93 |
+
if (z.imag() > 0) {
|
| 94 |
+
*ci += std::complex<double>(0.0, M_PI_2);
|
| 95 |
+
} else if (z.imag() < 0) {
|
| 96 |
+
*ci -= std::complex<double>(0.0, M_PI_2);
|
| 97 |
+
}
|
| 98 |
+
} else if (z.real() > 0) {
|
| 99 |
+
*si -= M_PI_2;
|
| 100 |
+
} else {
|
| 101 |
+
*si += M_PI_2;
|
| 102 |
+
if (z.imag() >= 0) {
|
| 103 |
+
*ci += std::complex<double>(0.0, M_PI);
|
| 104 |
+
} else {
|
| 105 |
+
*ci -= std::complex<double>(0.0, M_PI);
|
| 106 |
+
}
|
| 107 |
+
}
|
| 108 |
+
return 0;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
XSF_HOST_DEVICE inline int sici(std::complex<float> z,
|
| 112 |
+
std::complex<float> *si_f, std::complex<float> *ci_f) {
|
| 113 |
+
std::complex<double> si;
|
| 114 |
+
std::complex<double> ci;
|
| 115 |
+
int res = sici(z, &si, &ci);
|
| 116 |
+
*si_f = si;
|
| 117 |
+
*ci_f = ci;
|
| 118 |
+
return res;
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
XSF_HOST_DEVICE inline int shichi(std::complex<double> z,
|
| 122 |
+
std::complex<double> *shi, std::complex<double> *chi) {
|
| 123 |
+
/* Compute sinh/cosh integrals at complex arguments. The algorithm
|
| 124 |
+
* largely follows that of [1].
|
| 125 |
+
*/
|
| 126 |
+
constexpr double EULER = xsf::cephes::detail::SCIPY_EULER;
|
| 127 |
+
if (z == std::numeric_limits<double>::infinity()) {
|
| 128 |
+
*shi = std::numeric_limits<double>::infinity();
|
| 129 |
+
*chi = std::numeric_limits<double>::infinity();
|
| 130 |
+
return 0;
|
| 131 |
+
}
|
| 132 |
+
if (z == -std::numeric_limits<double>::infinity()) {
|
| 133 |
+
*shi = -std::numeric_limits<double>::infinity();
|
| 134 |
+
*chi = std::numeric_limits<double>::infinity();
|
| 135 |
+
return 0;
|
| 136 |
+
}
|
| 137 |
+
if (std::abs(z) < 0.8) {
|
| 138 |
+
// Use the series to avoid cancellation in shi
|
| 139 |
+
detail::sici_power_series(1, z, shi, chi);
|
| 140 |
+
if (z == 0.0) {
|
| 141 |
+
set_error("shichi", SF_ERROR_DOMAIN, NULL);
|
| 142 |
+
*chi = {-std::numeric_limits<double>::infinity(), std::numeric_limits<double>::quiet_NaN()};
|
| 143 |
+
} else {
|
| 144 |
+
*chi += EULER + std::log(z);
|
| 145 |
+
}
|
| 146 |
+
return 0;
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
std::complex<double> term1 = expi(z);
|
| 150 |
+
std::complex<double> term2 = expi(-z);
|
| 151 |
+
*shi = 0.5*(term1 - term2);
|
| 152 |
+
*chi = 0.5*(term1 + term2);
|
| 153 |
+
if (z.imag() > 0) {
|
| 154 |
+
*shi -= std::complex<double>(0.0, 0.5*M_PI);
|
| 155 |
+
*chi += std::complex<double>(0.0, 0.5*M_PI);
|
| 156 |
+
} else if (z.imag() < 0) {
|
| 157 |
+
*shi += std::complex<double>(0.0, 0.5*M_PI);
|
| 158 |
+
*chi -= std::complex<double>(0.0, 0.5*M_PI);
|
| 159 |
+
} else if (z.real() < 0) {
|
| 160 |
+
*chi += std::complex<double>(0.0, M_PI);
|
| 161 |
+
}
|
| 162 |
+
return 0;
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
XSF_HOST_DEVICE inline int shichi(std::complex<float> z,
|
| 166 |
+
std::complex<float> *shi_f, std::complex<float> *chi_f) {
|
| 167 |
+
std::complex<double> shi;
|
| 168 |
+
std::complex<double> chi;
|
| 169 |
+
int res = shichi(z, &shi, &chi);
|
| 170 |
+
*shi_f = shi;
|
| 171 |
+
*chi_f = chi;
|
| 172 |
+
return res;
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
XSF_HOST_DEVICE inline int sici(double x, double *si, double *ci) {
|
| 176 |
+
return cephes::sici(x, si, ci);
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
XSF_HOST_DEVICE inline int shichi(double x, double *shi, double *chi) {
|
| 180 |
+
return cephes::shichi(x, shi, chi);
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
XSF_HOST_DEVICE inline int sici(float x, float *si_f, float *ci_f) {
|
| 184 |
+
double si;
|
| 185 |
+
double ci;
|
| 186 |
+
int res = cephes::sici(x, &si, &ci);
|
| 187 |
+
*si_f = si;
|
| 188 |
+
*ci_f = ci;
|
| 189 |
+
return res;
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
XSF_HOST_DEVICE inline int shichi(float x, float *shi_f, float *chi_f) {
|
| 193 |
+
double shi;
|
| 194 |
+
double chi;
|
| 195 |
+
int res = cephes::shichi(x, &shi, &chi);
|
| 196 |
+
*shi_f = shi;
|
| 197 |
+
*chi_f = chi;
|
| 198 |
+
return res;
|
| 199 |
+
}
|
| 200 |
+
}
|
shared/package-files/9b/9b3e92596047cab99a939229b56d656a7862d617eacf9291d7fa6f6c95f80e36/blob
ADDED
|
@@ -0,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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections import defaultdict
|
| 2 |
+
|
| 3 |
+
import numpy as np
|
| 4 |
+
|
| 5 |
+
import statsmodels.base.model as base
|
| 6 |
+
import statsmodels.base.wrapper as wrap
|
| 7 |
+
from statsmodels.formula.formulatools import advance_eval_env
|
| 8 |
+
from statsmodels.genmod import families
|
| 9 |
+
from statsmodels.genmod.families import links, varfuncs
|
| 10 |
+
from statsmodels.genmod.generalized_linear_model import GLM
|
| 11 |
+
import statsmodels.regression.linear_model as lm
|
| 12 |
+
from statsmodels.tools._decorators import cache_readonly
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
class QIFCovariance:
|
| 16 |
+
"""
|
| 17 |
+
A covariance model for quadratic inference function regression.
|
| 18 |
+
|
| 19 |
+
The mat method returns a basis matrix B such that the inverse
|
| 20 |
+
of the working covariance lies in the linear span of the
|
| 21 |
+
basis matrices.
|
| 22 |
+
|
| 23 |
+
Subclasses should set the number of basis matrices `num_terms`,
|
| 24 |
+
so that `mat(d, j)` for j=0, ..., num_terms-1 gives the basis
|
| 25 |
+
of dimension d.
|
| 26 |
+
"""
|
| 27 |
+
|
| 28 |
+
def mat(self, dim, term):
|
| 29 |
+
"""
|
| 30 |
+
Returns the term'th basis matrix, which is a dim x dim
|
| 31 |
+
matrix.
|
| 32 |
+
|
| 33 |
+
Parameters
|
| 34 |
+
----------
|
| 35 |
+
dim : int
|
| 36 |
+
The dimension of the basis matrix.
|
| 37 |
+
term : int
|
| 38 |
+
The index of the basis matrix to return, ranging from 0
|
| 39 |
+
to `num_terms` - 1.
|
| 40 |
+
|
| 41 |
+
Returns
|
| 42 |
+
-------
|
| 43 |
+
ndarray or None
|
| 44 |
+
The dim x dim basis matrix for `term`, or None if `term`
|
| 45 |
+
is greater than or equal to `num_terms`.
|
| 46 |
+
"""
|
| 47 |
+
raise NotImplementedError
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
class QIFIndependence(QIFCovariance):
|
| 51 |
+
"""
|
| 52 |
+
Independent working covariance for QIF regression. This covariance
|
| 53 |
+
model gives identical results to GEE with the independence working
|
| 54 |
+
covariance. When using QIFIndependence as the working covariance,
|
| 55 |
+
the QIF value will be zero, and cannot be used for chi^2 testing, or
|
| 56 |
+
for model selection using AIC, BIC, etc.
|
| 57 |
+
"""
|
| 58 |
+
|
| 59 |
+
def __init__(self):
|
| 60 |
+
self.num_terms = 1
|
| 61 |
+
|
| 62 |
+
def mat(self, dim, term):
|
| 63 |
+
if term == 0:
|
| 64 |
+
return np.eye(dim)
|
| 65 |
+
else:
|
| 66 |
+
return None
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
class QIFExchangeable(QIFCovariance):
|
| 70 |
+
"""
|
| 71 |
+
Exchangeable working covariance for QIF regression.
|
| 72 |
+
"""
|
| 73 |
+
|
| 74 |
+
def __init__(self):
|
| 75 |
+
self.num_terms = 2
|
| 76 |
+
|
| 77 |
+
def mat(self, dim, term):
|
| 78 |
+
if term == 0:
|
| 79 |
+
return np.eye(dim)
|
| 80 |
+
elif term == 1:
|
| 81 |
+
return np.ones((dim, dim))
|
| 82 |
+
else:
|
| 83 |
+
return None
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
class QIFAutoregressive(QIFCovariance):
|
| 87 |
+
"""
|
| 88 |
+
Autoregressive working covariance for QIF regression.
|
| 89 |
+
"""
|
| 90 |
+
|
| 91 |
+
def __init__(self):
|
| 92 |
+
self.num_terms = 3
|
| 93 |
+
|
| 94 |
+
def mat(self, dim, term):
|
| 95 |
+
|
| 96 |
+
if dim < 3:
|
| 97 |
+
msg = ("Groups must have size at least 3 for "
|
| 98 |
+
"autoregressive covariance.")
|
| 99 |
+
raise ValueError(msg)
|
| 100 |
+
|
| 101 |
+
if term == 0:
|
| 102 |
+
return np.eye(dim)
|
| 103 |
+
elif term == 1:
|
| 104 |
+
mat = np.zeros((dim, dim))
|
| 105 |
+
mat.flat[1::(dim+1)] = 1
|
| 106 |
+
mat += mat.T
|
| 107 |
+
return mat
|
| 108 |
+
elif term == 2:
|
| 109 |
+
mat = np.zeros((dim, dim))
|
| 110 |
+
mat[0, 0] = 1
|
| 111 |
+
mat[dim-1, dim-1] = 1
|
| 112 |
+
return mat
|
| 113 |
+
else:
|
| 114 |
+
return None
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
class QIF(base.Model):
|
| 118 |
+
"""
|
| 119 |
+
Fit a regression model using quadratic inference functions (QIF).
|
| 120 |
+
|
| 121 |
+
QIF is an alternative to GEE that can be more efficient, and that
|
| 122 |
+
offers different approaches for model selection and inference.
|
| 123 |
+
|
| 124 |
+
Parameters
|
| 125 |
+
----------
|
| 126 |
+
endog : array_like
|
| 127 |
+
The dependent variables of the regression.
|
| 128 |
+
exog : array_like
|
| 129 |
+
The independent variables of the regression.
|
| 130 |
+
groups : array_like
|
| 131 |
+
Labels indicating which group each observation belongs to.
|
| 132 |
+
Observations in different groups should be independent.
|
| 133 |
+
family : genmod family, optional
|
| 134 |
+
An instance of a GLM family. The default is Gaussian.
|
| 135 |
+
cov_struct : QIFCovariance instance, optional
|
| 136 |
+
An instance of a QIFCovariance. The default is
|
| 137 |
+
QIFIndependence.
|
| 138 |
+
missing : str, optional
|
| 139 |
+
Available options are 'none', 'drop', and 'raise'. If 'none', no nan
|
| 140 |
+
checking is done. If 'drop', any observations with nans are dropped.
|
| 141 |
+
If 'raise', an error is raised.
|
| 142 |
+
|
| 143 |
+
References
|
| 144 |
+
----------
|
| 145 |
+
A. Qu, B. Lindsay, B. Li (2000). Improving Generalized Estimating
|
| 146 |
+
Equations using Quadratic Inference Functions, Biometrika 87:4.
|
| 147 |
+
www.jstor.org/stable/2673612
|
| 148 |
+
"""
|
| 149 |
+
|
| 150 |
+
def __init__(self, endog, exog, groups, family=None,
|
| 151 |
+
cov_struct=None, missing="none", **kwargs):
|
| 152 |
+
|
| 153 |
+
# Handle the family argument
|
| 154 |
+
if family is None:
|
| 155 |
+
family = families.Gaussian()
|
| 156 |
+
elif not issubclass(family.__class__, families.Family):
|
| 157 |
+
raise ValueError("QIF: `family` must be a genmod "
|
| 158 |
+
"family instance")
|
| 159 |
+
self.family = family
|
| 160 |
+
|
| 161 |
+
self._fit_history = defaultdict(list)
|
| 162 |
+
|
| 163 |
+
# Handle the cov_struct argument
|
| 164 |
+
if cov_struct is None:
|
| 165 |
+
cov_struct = QIFIndependence()
|
| 166 |
+
elif not isinstance(cov_struct, QIFCovariance):
|
| 167 |
+
raise ValueError(
|
| 168 |
+
"QIF: `cov_struct` must be a QIFCovariance instance")
|
| 169 |
+
self.cov_struct = cov_struct
|
| 170 |
+
|
| 171 |
+
groups = np.asarray(groups)
|
| 172 |
+
|
| 173 |
+
super().__init__(endog, exog, groups=groups,
|
| 174 |
+
missing=missing, **kwargs)
|
| 175 |
+
|
| 176 |
+
self.group_names = list(set(groups))
|
| 177 |
+
self.nobs = len(self.endog)
|
| 178 |
+
|
| 179 |
+
groups_ix = defaultdict(list)
|
| 180 |
+
for i, g in enumerate(groups):
|
| 181 |
+
groups_ix[g].append(i)
|
| 182 |
+
self.groups_ix = [groups_ix[na] for na in self.group_names]
|
| 183 |
+
|
| 184 |
+
self._check_args(groups)
|
| 185 |
+
|
| 186 |
+
def _check_args(self, groups):
|
| 187 |
+
|
| 188 |
+
if len(groups) != len(self.endog):
|
| 189 |
+
msg = "QIF: groups and endog should have the same length"
|
| 190 |
+
raise ValueError(msg)
|
| 191 |
+
|
| 192 |
+
if len(self.endog) != self.exog.shape[0]:
|
| 193 |
+
msg = ("QIF: the length of endog should be equal to the "
|
| 194 |
+
"number of rows of exog.")
|
| 195 |
+
raise ValueError(msg)
|
| 196 |
+
|
| 197 |
+
def objective(self, params):
|
| 198 |
+
"""
|
| 199 |
+
Calculate the QIF objective function and its gradient.
|
| 200 |
+
|
| 201 |
+
Parameters
|
| 202 |
+
----------
|
| 203 |
+
params : array_like
|
| 204 |
+
The model parameters at which the objective function and
|
| 205 |
+
its gradient are evaluated.
|
| 206 |
+
|
| 207 |
+
Returns
|
| 208 |
+
-------
|
| 209 |
+
qif : float
|
| 210 |
+
The value of the QIF objective function.
|
| 211 |
+
grad : ndarray
|
| 212 |
+
The gradient vector of the QIF objective function.
|
| 213 |
+
cmat : ndarray
|
| 214 |
+
The estimated covariance matrix of the estimating
|
| 215 |
+
equations.
|
| 216 |
+
gn : ndarray
|
| 217 |
+
The moment vector, i.e., the average of the estimating
|
| 218 |
+
equations over the groups.
|
| 219 |
+
gn_deriv : ndarray
|
| 220 |
+
The gradients of each estimating equation with
|
| 221 |
+
respect to the parameter.
|
| 222 |
+
"""
|
| 223 |
+
|
| 224 |
+
endog = self.endog
|
| 225 |
+
exog = self.exog
|
| 226 |
+
lpr = np.dot(exog, params)
|
| 227 |
+
mean = self.family.link.inverse(lpr)
|
| 228 |
+
va = self.family.variance(mean)
|
| 229 |
+
|
| 230 |
+
# Mean derivative
|
| 231 |
+
idl = self.family.link.inverse_deriv(lpr)
|
| 232 |
+
idl2 = self.family.link.inverse_deriv2(lpr)
|
| 233 |
+
vd = self.family.variance.deriv(mean)
|
| 234 |
+
|
| 235 |
+
m = self.cov_struct.num_terms
|
| 236 |
+
p = exog.shape[1]
|
| 237 |
+
|
| 238 |
+
d = p * m
|
| 239 |
+
gn = np.zeros(d)
|
| 240 |
+
gi = np.zeros(d)
|
| 241 |
+
gi_deriv = np.zeros((d, p))
|
| 242 |
+
gn_deriv = np.zeros((d, p))
|
| 243 |
+
cn_deriv = [0] * p
|
| 244 |
+
cmat = np.zeros((d, d))
|
| 245 |
+
|
| 246 |
+
fastvar = self.family.variance is varfuncs.constant
|
| 247 |
+
fastlink = isinstance(
|
| 248 |
+
self.family.link,
|
| 249 |
+
# TODO: Remove links.identity after deprecation final
|
| 250 |
+
(links.Identity, links.identity)
|
| 251 |
+
)
|
| 252 |
+
|
| 253 |
+
for ix in self.groups_ix:
|
| 254 |
+
sd = np.sqrt(va[ix])
|
| 255 |
+
resid = endog[ix] - mean[ix]
|
| 256 |
+
sresid = resid / sd
|
| 257 |
+
deriv = exog[ix, :] * idl[ix, None]
|
| 258 |
+
|
| 259 |
+
jj = 0
|
| 260 |
+
for j in range(m):
|
| 261 |
+
# The derivative of each term in (5) of Qu et al.
|
| 262 |
+
# There are four terms involving beta in a product.
|
| 263 |
+
# Iterated application of the product rule gives
|
| 264 |
+
# the gradient as a sum of four terms.
|
| 265 |
+
c = self.cov_struct.mat(len(ix), j)
|
| 266 |
+
crs1 = np.dot(c, sresid) / sd
|
| 267 |
+
gi[jj:jj+p] = np.dot(deriv.T, crs1)
|
| 268 |
+
crs2 = np.dot(c, -deriv / sd[:, None]) / sd[:, None]
|
| 269 |
+
gi_deriv[jj:jj+p, :] = np.dot(deriv.T, crs2)
|
| 270 |
+
if not (fastlink and fastvar):
|
| 271 |
+
for k in range(p):
|
| 272 |
+
m1 = np.dot(exog[ix, :].T,
|
| 273 |
+
idl2[ix] * exog[ix, k] * crs1)
|
| 274 |
+
if not fastvar:
|
| 275 |
+
vx = -0.5 * vd[ix] * deriv[:, k] / va[ix]**1.5
|
| 276 |
+
m2 = np.dot(deriv.T, vx * np.dot(c, sresid))
|
| 277 |
+
m3 = np.dot(deriv.T, np.dot(c, vx * resid) / sd)
|
| 278 |
+
else:
|
| 279 |
+
m2, m3 = 0, 0
|
| 280 |
+
gi_deriv[jj:jj+p, k] += m1 + m2 + m3
|
| 281 |
+
jj += p
|
| 282 |
+
|
| 283 |
+
for j in range(p):
|
| 284 |
+
u = np.outer(gi, gi_deriv[:, j])
|
| 285 |
+
cn_deriv[j] += u + u.T
|
| 286 |
+
|
| 287 |
+
gn += gi
|
| 288 |
+
gn_deriv += gi_deriv
|
| 289 |
+
|
| 290 |
+
cmat += np.outer(gi, gi)
|
| 291 |
+
|
| 292 |
+
ngrp = len(self.groups_ix)
|
| 293 |
+
gn /= ngrp
|
| 294 |
+
gn_deriv /= ngrp
|
| 295 |
+
cmat /= ngrp**2
|
| 296 |
+
|
| 297 |
+
qif = np.dot(gn, np.linalg.solve(cmat, gn))
|
| 298 |
+
|
| 299 |
+
gcg = np.zeros(p)
|
| 300 |
+
for j in range(p):
|
| 301 |
+
cn_deriv[j] /= len(self.groups_ix)**2
|
| 302 |
+
u = np.linalg.solve(cmat, cn_deriv[j]).T
|
| 303 |
+
u = np.linalg.solve(cmat, u)
|
| 304 |
+
gcg[j] = np.dot(gn, np.dot(u, gn))
|
| 305 |
+
|
| 306 |
+
grad = 2 * np.dot(gn_deriv.T, np.linalg.solve(cmat, gn)) - gcg
|
| 307 |
+
|
| 308 |
+
return qif, grad, cmat, gn, gn_deriv
|
| 309 |
+
|
| 310 |
+
def estimate_scale(self, params):
|
| 311 |
+
"""
|
| 312 |
+
Estimate the dispersion/scale.
|
| 313 |
+
|
| 314 |
+
The scale parameter for binomial and Poisson families is
|
| 315 |
+
fixed at 1, otherwise it is estimated from the data.
|
| 316 |
+
|
| 317 |
+
Parameters
|
| 318 |
+
----------
|
| 319 |
+
params : array_like
|
| 320 |
+
The regression coefficients at which the scale is
|
| 321 |
+
estimated.
|
| 322 |
+
|
| 323 |
+
Returns
|
| 324 |
+
-------
|
| 325 |
+
float
|
| 326 |
+
The estimated scale parameter.
|
| 327 |
+
"""
|
| 328 |
+
|
| 329 |
+
if isinstance(self.family, (families.Binomial, families.Poisson)):
|
| 330 |
+
return 1.
|
| 331 |
+
|
| 332 |
+
if hasattr(self, "ddof_scale"):
|
| 333 |
+
ddof_scale = self.ddof_scale
|
| 334 |
+
else:
|
| 335 |
+
ddof_scale = self.exog[1]
|
| 336 |
+
|
| 337 |
+
lpr = np.dot(self.exog, params)
|
| 338 |
+
mean = self.family.link.inverse(lpr)
|
| 339 |
+
resid = self.endog - mean
|
| 340 |
+
scale = np.sum(resid**2) / (self.nobs - ddof_scale)
|
| 341 |
+
|
| 342 |
+
return scale
|
| 343 |
+
|
| 344 |
+
@classmethod
|
| 345 |
+
def from_formula(cls, formula, groups, data, subset=None,
|
| 346 |
+
*args, **kwargs):
|
| 347 |
+
"""
|
| 348 |
+
Create a QIF model instance from a formula and dataframe.
|
| 349 |
+
|
| 350 |
+
Parameters
|
| 351 |
+
----------
|
| 352 |
+
formula : str or generic Formula object
|
| 353 |
+
The formula specifying the model
|
| 354 |
+
groups : array_like or str
|
| 355 |
+
Array of grouping labels. If a string, this is the name
|
| 356 |
+
of a variable in `data` that contains the grouping labels.
|
| 357 |
+
data : array_like
|
| 358 |
+
The data for the model.
|
| 359 |
+
subset : array_like, optional
|
| 360 |
+
An array_like object of booleans, integers, or index
|
| 361 |
+
values that indicate the subset of the data to use when
|
| 362 |
+
fitting the model.
|
| 363 |
+
|
| 364 |
+
Returns
|
| 365 |
+
-------
|
| 366 |
+
model : QIF model instance
|
| 367 |
+
"""
|
| 368 |
+
|
| 369 |
+
if isinstance(groups, str):
|
| 370 |
+
groups = data[groups]
|
| 371 |
+
advance_eval_env(kwargs)
|
| 372 |
+
model = super().from_formula(
|
| 373 |
+
formula, data, *args, subset=subset, groups=groups, **kwargs
|
| 374 |
+
)
|
| 375 |
+
|
| 376 |
+
return model
|
| 377 |
+
|
| 378 |
+
def fit(self, maxiter=100, start_params=None, tol=1e-6, gtol=1e-4,
|
| 379 |
+
ddof_scale=None):
|
| 380 |
+
"""
|
| 381 |
+
Fit a GLM to correlated data using QIF.
|
| 382 |
+
|
| 383 |
+
Parameters
|
| 384 |
+
----------
|
| 385 |
+
maxiter : int, optional
|
| 386 |
+
Maximum number of iterations.
|
| 387 |
+
start_params : array_like, optional
|
| 388 |
+
Starting values
|
| 389 |
+
tol : float, optional
|
| 390 |
+
Convergence threshold for difference of successive
|
| 391 |
+
estimates.
|
| 392 |
+
gtol : float, optional
|
| 393 |
+
Convergence threshold for gradient.
|
| 394 |
+
ddof_scale : int, optional
|
| 395 |
+
Degrees of freedom for the scale parameter
|
| 396 |
+
|
| 397 |
+
Returns
|
| 398 |
+
-------
|
| 399 |
+
QIFResults object
|
| 400 |
+
"""
|
| 401 |
+
|
| 402 |
+
if ddof_scale is None:
|
| 403 |
+
self.ddof_scale = self.exog.shape[1]
|
| 404 |
+
else:
|
| 405 |
+
self.ddof_scale = ddof_scale
|
| 406 |
+
|
| 407 |
+
if start_params is None:
|
| 408 |
+
model = GLM(self.endog, self.exog, family=self.family)
|
| 409 |
+
result = model.fit()
|
| 410 |
+
params = result.params
|
| 411 |
+
else:
|
| 412 |
+
params = start_params
|
| 413 |
+
|
| 414 |
+
for _ in range(maxiter):
|
| 415 |
+
|
| 416 |
+
qif, grad, cmat, _, gn_deriv = self.objective(params)
|
| 417 |
+
|
| 418 |
+
gnorm = np.sqrt(np.sum(grad * grad))
|
| 419 |
+
self._fit_history["qif"].append(qif)
|
| 420 |
+
self._fit_history["gradnorm"].append(gnorm)
|
| 421 |
+
|
| 422 |
+
if gnorm < gtol:
|
| 423 |
+
break
|
| 424 |
+
|
| 425 |
+
cjac = 2 * np.dot(gn_deriv.T, np.linalg.solve(cmat, gn_deriv))
|
| 426 |
+
step = np.linalg.solve(cjac, grad)
|
| 427 |
+
|
| 428 |
+
snorm = np.sqrt(np.sum(step * step))
|
| 429 |
+
self._fit_history["stepnorm"].append(snorm)
|
| 430 |
+
if snorm < tol:
|
| 431 |
+
break
|
| 432 |
+
params -= step
|
| 433 |
+
|
| 434 |
+
vcov = np.dot(gn_deriv.T, np.linalg.solve(cmat, gn_deriv))
|
| 435 |
+
vcov = np.linalg.inv(vcov)
|
| 436 |
+
scale = self.estimate_scale(params)
|
| 437 |
+
|
| 438 |
+
rslt = QIFResults(self, params, vcov / scale, scale)
|
| 439 |
+
rslt.fit_history = self._fit_history
|
| 440 |
+
self._fit_history = defaultdict(list)
|
| 441 |
+
|
| 442 |
+
return QIFResultsWrapper(rslt)
|
| 443 |
+
|
| 444 |
+
|
| 445 |
+
class QIFResults(base.LikelihoodModelResults):
|
| 446 |
+
"""
|
| 447 |
+
Results class for QIF Regression
|
| 448 |
+
|
| 449 |
+
Attributes
|
| 450 |
+
----------
|
| 451 |
+
qif : float
|
| 452 |
+
The value of the QIF objective function at the estimated
|
| 453 |
+
parameters.
|
| 454 |
+
"""
|
| 455 |
+
def __init__(self, model, params, cov_params, scale,
|
| 456 |
+
use_t=False, **kwds):
|
| 457 |
+
|
| 458 |
+
super().__init__(
|
| 459 |
+
model, params, normalized_cov_params=cov_params,
|
| 460 |
+
scale=scale)
|
| 461 |
+
|
| 462 |
+
self.qif, _, _, _, _ = self.model.objective(params)
|
| 463 |
+
|
| 464 |
+
@cache_readonly
|
| 465 |
+
def aic(self):
|
| 466 |
+
"""
|
| 467 |
+
An AIC-like statistic for models fit using QIF.
|
| 468 |
+
"""
|
| 469 |
+
if isinstance(self.model.cov_struct, QIFIndependence):
|
| 470 |
+
msg = "AIC not available with QIFIndependence covariance"
|
| 471 |
+
raise ValueError(msg)
|
| 472 |
+
df = self.model.exog.shape[1]
|
| 473 |
+
return self.qif + 2*df
|
| 474 |
+
|
| 475 |
+
@cache_readonly
|
| 476 |
+
def bic(self):
|
| 477 |
+
"""
|
| 478 |
+
A BIC-like statistic for models fit using QIF.
|
| 479 |
+
"""
|
| 480 |
+
if isinstance(self.model.cov_struct, QIFIndependence):
|
| 481 |
+
msg = "BIC not available with QIFIndependence covariance"
|
| 482 |
+
raise ValueError(msg)
|
| 483 |
+
df = self.model.exog.shape[1]
|
| 484 |
+
return self.qif + np.log(self.model.nobs)*df
|
| 485 |
+
|
| 486 |
+
@cache_readonly
|
| 487 |
+
def fittedvalues(self):
|
| 488 |
+
"""
|
| 489 |
+
Returns the fitted values from the model.
|
| 490 |
+
"""
|
| 491 |
+
return self.model.family.link.inverse(
|
| 492 |
+
np.dot(self.model.exog, self.params))
|
| 493 |
+
|
| 494 |
+
def summary(self, yname=None, xname=None, title=None, alpha=.05):
|
| 495 |
+
"""
|
| 496 |
+
Summarize the QIF regression results
|
| 497 |
+
|
| 498 |
+
Parameters
|
| 499 |
+
----------
|
| 500 |
+
yname : str, optional
|
| 501 |
+
Default is `y`
|
| 502 |
+
xname : list of str, optional
|
| 503 |
+
Names for the exogenous variables, default is `var_#` where `#`
|
| 504 |
+
is the 0-based index of the regressor. Must match the number of
|
| 505 |
+
parameters in the model
|
| 506 |
+
title : str, optional
|
| 507 |
+
Title for the top table. If not None, then this replaces
|
| 508 |
+
the default title
|
| 509 |
+
alpha : float, optional
|
| 510 |
+
significance level for the confidence intervals
|
| 511 |
+
|
| 512 |
+
Returns
|
| 513 |
+
-------
|
| 514 |
+
smry : Summary instance
|
| 515 |
+
this holds the summary tables and text, which can be
|
| 516 |
+
printed or converted to various output formats.
|
| 517 |
+
|
| 518 |
+
See Also
|
| 519 |
+
--------
|
| 520 |
+
statsmodels.iolib.summary.Summary : class to hold summary results
|
| 521 |
+
"""
|
| 522 |
+
|
| 523 |
+
top_left = [("Dep. Variable:", None),
|
| 524 |
+
("Method:", ["QIF"]),
|
| 525 |
+
("Family:", [self.model.family.__class__.__name__]),
|
| 526 |
+
("Covariance structure:",
|
| 527 |
+
[self.model.cov_struct.__class__.__name__]),
|
| 528 |
+
("Date:", None),
|
| 529 |
+
("Time:", None),
|
| 530 |
+
]
|
| 531 |
+
|
| 532 |
+
NY = [len(y) for y in self.model.groups_ix]
|
| 533 |
+
|
| 534 |
+
top_right = [("No. Observations:", [sum(NY)]),
|
| 535 |
+
("No. clusters:", [len(NY)]),
|
| 536 |
+
("Min. cluster size:", [min(NY)]),
|
| 537 |
+
("Max. cluster size:", [max(NY)]),
|
| 538 |
+
("Mean cluster size:", [f"{np.mean(NY):.1f}"]),
|
| 539 |
+
("Scale:", [f"{self.scale:.3f}"]),
|
| 540 |
+
]
|
| 541 |
+
|
| 542 |
+
if title is None:
|
| 543 |
+
title = self.model.__class__.__name__ + " " +\
|
| 544 |
+
"Regression Results"
|
| 545 |
+
|
| 546 |
+
# Override the exog variable names if xname is provided as an
|
| 547 |
+
# argument.
|
| 548 |
+
if xname is None:
|
| 549 |
+
xname = self.model.exog_names
|
| 550 |
+
|
| 551 |
+
if yname is None:
|
| 552 |
+
yname = self.model.endog_names
|
| 553 |
+
|
| 554 |
+
# Create summary table instance
|
| 555 |
+
from statsmodels.iolib.summary import Summary
|
| 556 |
+
smry = Summary()
|
| 557 |
+
smry.add_table_2cols(self, gleft=top_left, gright=top_right,
|
| 558 |
+
yname=yname, xname=xname,
|
| 559 |
+
title=title)
|
| 560 |
+
smry.add_table_params(self, yname=yname, xname=xname,
|
| 561 |
+
alpha=alpha, use_t=False)
|
| 562 |
+
|
| 563 |
+
return smry
|
| 564 |
+
|
| 565 |
+
|
| 566 |
+
class QIFResultsWrapper(lm.RegressionResultsWrapper):
|
| 567 |
+
pass
|
| 568 |
+
|
| 569 |
+
|
| 570 |
+
wrap.populate_wrapper(QIFResultsWrapper, QIFResults)
|
shared/package-files/9b/9b45a809e914c434a5fedb1bcfe7f9bd9ee4471fd5d828bcafa59cd50b502507/blob
ADDED
|
@@ -0,0 +1,884 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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10/core/DeviceType.h>
|
| 5 |
+
#include <torch/csrc/autograd/autograd.h>
|
| 6 |
+
#include <torch/csrc/autograd/edge.h>
|
| 7 |
+
#include <torch/csrc/autograd/function.h>
|
| 8 |
+
#include <torch/csrc/autograd/generated/variable_factories.h>
|
| 9 |
+
#include <torch/csrc/autograd/variable.h>
|
| 10 |
+
#include <torch/csrc/jit/api/compilation_unit.h>
|
| 11 |
+
#include <torch/csrc/jit/api/module.h>
|
| 12 |
+
#include <torch/csrc/jit/frontend/error_report.h>
|
| 13 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 14 |
+
#include <torch/csrc/jit/mobile/register_ops_common_utils.h>
|
| 15 |
+
#include <torch/csrc/jit/runtime/custom_operator.h>
|
| 16 |
+
#include <torch/csrc/jit/runtime/graph_executor.h>
|
| 17 |
+
#include <torch/csrc/jit/runtime/jit_exception.h>
|
| 18 |
+
#include <torch/csrc/jit/runtime/logging.h>
|
| 19 |
+
#include <torch/csrc/jit/runtime/operator.h>
|
| 20 |
+
#include <torch/csrc/jit/runtime/print_handler.h>
|
| 21 |
+
#include <torch/csrc/jit/runtime/profiling_record.h>
|
| 22 |
+
#include <torch/csrc/jit/runtime/vararg_functions.h>
|
| 23 |
+
#include <torch/csrc/jit/serialization/pickle.h>
|
| 24 |
+
|
| 25 |
+
#include <ATen/ExpandUtils.h>
|
| 26 |
+
#include <ATen/Parallel.h>
|
| 27 |
+
#include <ATen/WrapDimUtils.h>
|
| 28 |
+
#include <ATen/core/Dict.h>
|
| 29 |
+
#include <ATen/core/Generator.h>
|
| 30 |
+
#include <ATen/core/ivalue.h>
|
| 31 |
+
#include <c10/core/Device.h>
|
| 32 |
+
#include <c10/core/thread_pool.h>
|
| 33 |
+
#include <c10/util/SmallVector.h>
|
| 34 |
+
#include <c10/util/irange.h>
|
| 35 |
+
#include <c10/util/string_utils.h>
|
| 36 |
+
|
| 37 |
+
namespace torch::jit {
|
| 38 |
+
constexpr inline c10::AliasAnalysisKind aliasAnalysisFromSchema() {
|
| 39 |
+
return c10::AliasAnalysisKind::FROM_SCHEMA;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
constexpr inline c10::AliasAnalysisKind aliasAnalysisConservative() {
|
| 43 |
+
return c10::AliasAnalysisKind::CONSERVATIVE;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
constexpr inline c10::AliasAnalysisKind aliasAnalysisSpecialCase() {
|
| 47 |
+
return c10::AliasAnalysisKind::INTERNAL_SPECIAL_CASE;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
template <class T>
|
| 51 |
+
c10::List<T> make_result_list(const TypePtr& elemType) {
|
| 52 |
+
return c10::List<T>();
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
template <>
|
| 56 |
+
c10::impl::GenericList make_result_list<IValue>(const TypePtr& elemType);
|
| 57 |
+
|
| 58 |
+
// As described in https://docs.python.org/3/library/functions.html#round
|
| 59 |
+
// When a number is exactly halfway between two integers, python builtin round
|
| 60 |
+
// function will round to even number. We use round(x/2)*2 to handle the
|
| 61 |
+
// special halfway case. For positive 'x', round(x/2)*2 =
|
| 62 |
+
// round((x_e + x_r)/2)*2 = x_e + round(x_r/2)*2, where x_e is an even integer,
|
| 63 |
+
// x_r is either 0.5 of 1.5, round(x_r/2)*2 results a 0 or 2, so the final
|
| 64 |
+
// result will always be a even number. Due to symmetricity, it also applies to
|
| 65 |
+
// negative cases.
|
| 66 |
+
inline double round_to_even(double a) {
|
| 67 |
+
return a - std::floor(a) == 0.5 ? (std::round(a * 0.5) * 2.0) : std::round(a);
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
// using the rules from python_arg_parser FunctionParameter::check
|
| 71 |
+
// tensor cannot have grad set, tensor must be 0 dim,
|
| 72 |
+
// and if the dest is an int the source must be integral type
|
| 73 |
+
void checkImplicitTensorToNum(const at::Tensor& t, bool toInt);
|
| 74 |
+
|
| 75 |
+
static C10_UNUSED int64_t floordiv(int64_t a, int64_t b) {
|
| 76 |
+
if (b == 0) {
|
| 77 |
+
throw std::runtime_error("division by 0");
|
| 78 |
+
}
|
| 79 |
+
if ((a > 0) == (b > 0)) {
|
| 80 |
+
// simple case, both have same sign
|
| 81 |
+
return a / b;
|
| 82 |
+
} else {
|
| 83 |
+
// in python division rounds down, it doesn't not truncate like in c++
|
| 84 |
+
auto r = lldiv(a, b);
|
| 85 |
+
return (r.rem) ? r.quot - 1 : r.quot;
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
+
TORCH_API void checkDoubleInRange(double a);
|
| 89 |
+
static C10_UNUSED int64_t floor(double a) {
|
| 90 |
+
checkDoubleInRange(a);
|
| 91 |
+
return std::floor(a);
|
| 92 |
+
}
|
| 93 |
+
static C10_UNUSED int64_t ceil(double a) {
|
| 94 |
+
checkDoubleInRange(a);
|
| 95 |
+
return std::ceil(a);
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
static C10_UNUSED int64_t gcd(int64_t a, int64_t b) {
|
| 99 |
+
while (b != 0) {
|
| 100 |
+
int64_t r = a % b;
|
| 101 |
+
a = b;
|
| 102 |
+
b = r;
|
| 103 |
+
}
|
| 104 |
+
// in python gcd returns non-negative values
|
| 105 |
+
return std::abs(a);
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
int64_t partProduct(int n, int m);
|
| 109 |
+
|
| 110 |
+
void loop(int n, int64_t& p, int64_t& r);
|
| 111 |
+
|
| 112 |
+
int nminussumofbits(int v);
|
| 113 |
+
|
| 114 |
+
int64_t factorial(int n);
|
| 115 |
+
static const double degToRad = std::acos(-1.0) / 180.0;
|
| 116 |
+
static const double radToDeg = 180.0 / std::acos(-1.0);
|
| 117 |
+
double degrees(double x);
|
| 118 |
+
double radians(double x);
|
| 119 |
+
|
| 120 |
+
// Convert an python index (which may be negative) into an index usable for a
|
| 121 |
+
// C++ container
|
| 122 |
+
|
| 123 |
+
// Equivalent to list.at(idx)
|
| 124 |
+
template <typename T>
|
| 125 |
+
decltype(auto) getItem(const c10::List<T>& list, int64_t idx) {
|
| 126 |
+
const int64_t list_size = list.size();
|
| 127 |
+
const int64_t normalized_idx = normalizeIndex(idx, list_size);
|
| 128 |
+
if (normalized_idx < 0 || normalized_idx >= list_size) {
|
| 129 |
+
throw std::out_of_range("list index out of range");
|
| 130 |
+
}
|
| 131 |
+
return list.get(normalized_idx);
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
template <typename T>
|
| 135 |
+
void setItem(const c10::List<T>& list, int64_t idx, T&& value) {
|
| 136 |
+
const int64_t list_size = list.size();
|
| 137 |
+
const int64_t normalized_idx = normalizeIndex(idx, list_size);
|
| 138 |
+
if (normalized_idx < 0 || normalized_idx >= list_size) {
|
| 139 |
+
throw std::out_of_range("list index out of range");
|
| 140 |
+
}
|
| 141 |
+
list.set(normalized_idx, std::forward<T>(value));
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
void listAppend(Stack& stack);
|
| 145 |
+
|
| 146 |
+
void listReverse(Stack& stack);
|
| 147 |
+
|
| 148 |
+
template <typename T>
|
| 149 |
+
void minList(Stack& stack) {
|
| 150 |
+
c10::List<T> a = pop(stack).to<c10::List<T>>();
|
| 151 |
+
c10::List<T> b = pop(stack).to<c10::List<T>>();
|
| 152 |
+
|
| 153 |
+
size_t min_size = std::min(a.size(), b.size());
|
| 154 |
+
for (const auto i : c10::irange(min_size)) {
|
| 155 |
+
if (a[i] == b[i]) {
|
| 156 |
+
continue;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
push(stack, a[i] < b[i] ? a : b);
|
| 160 |
+
return;
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
push(stack, b.size() < a.size() ? b : a);
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
template <typename T>
|
| 167 |
+
void maxList(Stack& stack) {
|
| 168 |
+
c10::List<T> a = pop(stack).to<c10::List<T>>();
|
| 169 |
+
c10::List<T> b = pop(stack).to<c10::List<T>>();
|
| 170 |
+
|
| 171 |
+
size_t min_size = std::min(a.size(), b.size());
|
| 172 |
+
for (const auto i : c10::irange(min_size)) {
|
| 173 |
+
if (a[i] == b[i]) {
|
| 174 |
+
continue;
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
push(stack, a[i] > b[i] ? a : b);
|
| 178 |
+
return;
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
push(stack, b.size() > a.size() ? b : a);
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
void listPopImpl(Stack& stack, const char* empty_message);
|
| 185 |
+
|
| 186 |
+
void listPop(Stack& stack);
|
| 187 |
+
|
| 188 |
+
void listClear(Stack& stack);
|
| 189 |
+
|
| 190 |
+
void listDelete(Stack& stack);
|
| 191 |
+
|
| 192 |
+
void listInsert(Stack& stack);
|
| 193 |
+
|
| 194 |
+
template <typename T>
|
| 195 |
+
void listRemove(Stack& stack) {
|
| 196 |
+
T elem = pop(stack).to<T>();
|
| 197 |
+
c10::List<T> list = pop(stack).to<c10::List<T>>();
|
| 198 |
+
|
| 199 |
+
auto pos = std::find(list.begin(), list.end(), elem);
|
| 200 |
+
|
| 201 |
+
if (pos != list.end()) {
|
| 202 |
+
list.erase(pos);
|
| 203 |
+
} else {
|
| 204 |
+
AT_ERROR("list.remove(x): x not in list");
|
| 205 |
+
}
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
template <typename T>
|
| 209 |
+
void listMin(Stack& stack) {
|
| 210 |
+
c10::List<T> list = pop(stack).to<c10::List<T>>();
|
| 211 |
+
size_t list_size = list.size();
|
| 212 |
+
if (list_size == 0) {
|
| 213 |
+
throw std::runtime_error("min() arg is an empty sequence");
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
T min_elem = list[0];
|
| 217 |
+
for (const auto i : c10::irange(1, list_size)) {
|
| 218 |
+
T elem = list[i];
|
| 219 |
+
min_elem = elem < min_elem ? elem : min_elem;
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
stack.push_back(min_elem);
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
template <typename T>
|
| 226 |
+
void listMax(Stack& stack) {
|
| 227 |
+
c10::List<T> list = pop(stack).to<c10::List<T>>();
|
| 228 |
+
size_t list_size = list.size();
|
| 229 |
+
if (list_size == 0) {
|
| 230 |
+
throw std::runtime_error("max() arg is an empty sequence");
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
T max_elem = list[0];
|
| 234 |
+
for (const auto i : c10::irange(1, list_size)) {
|
| 235 |
+
T elem = list[i];
|
| 236 |
+
max_elem = elem > max_elem ? elem : max_elem;
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
stack.push_back(max_elem);
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
template <>
|
| 243 |
+
void listRemove<at::Tensor>(Stack& stack);
|
| 244 |
+
|
| 245 |
+
template <typename T>
|
| 246 |
+
void listIndex(Stack& stack) {
|
| 247 |
+
T elem = pop(stack).to<T>();
|
| 248 |
+
c10::List<T> list = pop(stack).to<c10::List<T>>();
|
| 249 |
+
|
| 250 |
+
auto pos = std::find(list.begin(), list.end(), elem);
|
| 251 |
+
|
| 252 |
+
if (pos != list.end()) {
|
| 253 |
+
push(stack, static_cast<int64_t>(std::distance(list.begin(), pos)));
|
| 254 |
+
} else {
|
| 255 |
+
AT_ERROR("'", elem, "' is not in list");
|
| 256 |
+
}
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
template <>
|
| 260 |
+
void listIndex<at::Tensor>(Stack& stack);
|
| 261 |
+
|
| 262 |
+
template <typename T>
|
| 263 |
+
void listCount(Stack& stack) {
|
| 264 |
+
T elem = pop(stack).to<T>();
|
| 265 |
+
c10::List<T> list = pop(stack).to<c10::List<T>>();
|
| 266 |
+
|
| 267 |
+
const int64_t count = std::count(list.begin(), list.end(), elem);
|
| 268 |
+
push(stack, count);
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
template <>
|
| 272 |
+
void listCount<at::Tensor>(Stack& stack);
|
| 273 |
+
|
| 274 |
+
void listExtend(Stack& stack);
|
| 275 |
+
|
| 276 |
+
void listCopy(Stack& stack);
|
| 277 |
+
|
| 278 |
+
void listSelect(Stack& stack);
|
| 279 |
+
|
| 280 |
+
void listLen(Stack& stack);
|
| 281 |
+
|
| 282 |
+
template <typename T>
|
| 283 |
+
void listEq(Stack& stack) {
|
| 284 |
+
c10::List<T> b = pop(stack).to<c10::List<T>>();
|
| 285 |
+
c10::List<T> a = pop(stack).to<c10::List<T>>();
|
| 286 |
+
push(stack, a == b);
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
template <typename T>
|
| 290 |
+
void listNe(Stack& stack) {
|
| 291 |
+
c10::List<T> b = pop(stack).to<c10::List<T>>();
|
| 292 |
+
c10::List<T> a = pop(stack).to<c10::List<T>>();
|
| 293 |
+
push(stack, a != b);
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
inline bool tensor_list_equal(
|
| 297 |
+
const c10::List<at::Tensor>& a,
|
| 298 |
+
const c10::List<at::Tensor>& b) {
|
| 299 |
+
if (a.size() != b.size()) {
|
| 300 |
+
return false;
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
for (const auto i : c10::irange(a.size())) {
|
| 304 |
+
const at::Tensor& a_element = a[i];
|
| 305 |
+
const at::Tensor& b_element = b[i];
|
| 306 |
+
// This preserves Python's semantics, which uses eq() to compare two
|
| 307 |
+
// elements, then passes the result to bool().
|
| 308 |
+
// see: https://docs.python.org/3.4/reference/datamodel.html#object.__ge__
|
| 309 |
+
const auto cmp_result = a_element.eq(b_element);
|
| 310 |
+
if (!at::native::is_nonzero(cmp_result)) {
|
| 311 |
+
return false;
|
| 312 |
+
}
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
return true;
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
// Specialization for at::Tensor, since it doesn't define operator==
|
| 319 |
+
template <>
|
| 320 |
+
void listEq<at::Tensor>(Stack& stack);
|
| 321 |
+
|
| 322 |
+
// Specialization for at::Tensor, since it doesn't define operator==
|
| 323 |
+
template <>
|
| 324 |
+
void listNe<at::Tensor>(Stack& stack);
|
| 325 |
+
|
| 326 |
+
void listList(Stack& stack);
|
| 327 |
+
|
| 328 |
+
template <typename T>
|
| 329 |
+
void listContains(Stack& stack) {
|
| 330 |
+
auto key = pop(stack).to<T>();
|
| 331 |
+
auto list = pop(stack).to<c10::List<T>>();
|
| 332 |
+
// NOLINTNEXTLINE(performance-implicit-conversion-in-loop)
|
| 333 |
+
for (const T& item : list) {
|
| 334 |
+
if (item == key) {
|
| 335 |
+
push(stack, true);
|
| 336 |
+
return;
|
| 337 |
+
}
|
| 338 |
+
}
|
| 339 |
+
push(stack, false);
|
| 340 |
+
}
|
| 341 |
+
|
| 342 |
+
void listAdd(Stack& stack);
|
| 343 |
+
|
| 344 |
+
void listInplaceAdd(Stack& stack);
|
| 345 |
+
|
| 346 |
+
void listMulIntLeftInPlace(Stack& stack);
|
| 347 |
+
|
| 348 |
+
void listMulIntLeft(Stack& stack);
|
| 349 |
+
|
| 350 |
+
void listMulIntRight(Stack& stack);
|
| 351 |
+
|
| 352 |
+
void listSlice(Stack& stack);
|
| 353 |
+
|
| 354 |
+
template <typename T>
|
| 355 |
+
void listSort(Stack& stack) {
|
| 356 |
+
bool reverse = pop(stack).toBool();
|
| 357 |
+
c10::List<T> list = pop(stack).to<c10::List<T>>();
|
| 358 |
+
std::sort(list.begin(), list.end(), [reverse](const T& a, const T& b) {
|
| 359 |
+
// FBCode errors without this check - "strict weak ordering"
|
| 360 |
+
// TODO: remove when possible, since it just slows down
|
| 361 |
+
// sorting and doesn't do anything useful
|
| 362 |
+
if (a == b) {
|
| 363 |
+
return false;
|
| 364 |
+
}
|
| 365 |
+
return (a < b) != reverse;
|
| 366 |
+
});
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
// Specialization for at::Tensor
|
| 370 |
+
template <>
|
| 371 |
+
void listSort<at::Tensor>(Stack& stack);
|
| 372 |
+
|
| 373 |
+
template <typename T>
|
| 374 |
+
void listCopyAndSort(Stack& stack) {
|
| 375 |
+
c10::List<T> list = pop(stack).to<c10::List<T>>();
|
| 376 |
+
auto list_copied = list.copy();
|
| 377 |
+
std::sort(list_copied.begin(), list_copied.end(), [](const T& a, const T& b) {
|
| 378 |
+
// "strict weak ordering" issue - see other sort
|
| 379 |
+
if (a == b) {
|
| 380 |
+
return false;
|
| 381 |
+
}
|
| 382 |
+
return a < b;
|
| 383 |
+
});
|
| 384 |
+
push(stack, list_copied);
|
| 385 |
+
}
|
| 386 |
+
|
| 387 |
+
// Specialization for at::Tensor
|
| 388 |
+
template <>
|
| 389 |
+
void listCopyAndSort<at::Tensor>(Stack& stack);
|
| 390 |
+
|
| 391 |
+
void listSetItem(Stack& stack);
|
| 392 |
+
|
| 393 |
+
struct OperatorGeneratorArgs {
|
| 394 |
+
const char* schema_str;
|
| 395 |
+
bool isOperationCreator;
|
| 396 |
+
union {
|
| 397 |
+
void (*operation)(Stack&);
|
| 398 |
+
OperationCreator operationCreator;
|
| 399 |
+
};
|
| 400 |
+
AliasAnalysisKind aliasAnalysis;
|
| 401 |
+
|
| 402 |
+
explicit constexpr OperatorGeneratorArgs(
|
| 403 |
+
torch::detail::SelectiveStr<true> schema_str,
|
| 404 |
+
void (*op)(Stack&),
|
| 405 |
+
AliasAnalysisKind aa)
|
| 406 |
+
: schema_str(schema_str),
|
| 407 |
+
isOperationCreator(false),
|
| 408 |
+
operation(op),
|
| 409 |
+
aliasAnalysis(aa) {}
|
| 410 |
+
|
| 411 |
+
explicit constexpr OperatorGeneratorArgs(
|
| 412 |
+
torch::detail::SelectiveStr<true> schema_str,
|
| 413 |
+
OperationCreator opCreator,
|
| 414 |
+
AliasAnalysisKind aa)
|
| 415 |
+
: schema_str(schema_str),
|
| 416 |
+
isOperationCreator(true),
|
| 417 |
+
operationCreator(opCreator),
|
| 418 |
+
aliasAnalysis(aa) {}
|
| 419 |
+
|
| 420 |
+
template <typename... Args>
|
| 421 |
+
explicit constexpr OperatorGeneratorArgs(
|
| 422 |
+
torch::detail::SelectiveStr<false>,
|
| 423 |
+
Args...)
|
| 424 |
+
: schema_str(nullptr),
|
| 425 |
+
isOperationCreator(false),
|
| 426 |
+
operation(nullptr),
|
| 427 |
+
aliasAnalysis(AliasAnalysisKind::INTERNAL_SPECIAL_CASE) {}
|
| 428 |
+
};
|
| 429 |
+
|
| 430 |
+
#define DEFINE_GENERIC_BINARY_OP( \
|
| 431 |
+
aten_op, op, int_float_result, complex_result) \
|
| 432 |
+
OperatorGeneratorArgs( \
|
| 433 |
+
TORCH_SELECTIVE_SCHEMA(#aten_op \
|
| 434 |
+
".int_int(int a, int b) -> " #int_float_result), \
|
| 435 |
+
[](Stack& stack) { \
|
| 436 |
+
int64_t a, b; \
|
| 437 |
+
pop(stack, a, b); \
|
| 438 |
+
push(stack, op); \
|
| 439 |
+
}, \
|
| 440 |
+
aliasAnalysisFromSchema()), \
|
| 441 |
+
OperatorGeneratorArgs( \
|
| 442 |
+
TORCH_SELECTIVE_SCHEMA( \
|
| 443 |
+
#aten_op \
|
| 444 |
+
".float_float(float a, float b) -> " #int_float_result), \
|
| 445 |
+
[](Stack& stack) { \
|
| 446 |
+
double a, b; \
|
| 447 |
+
pop(stack, a, b); \
|
| 448 |
+
push(stack, op); \
|
| 449 |
+
}, \
|
| 450 |
+
aliasAnalysisFromSchema()), \
|
| 451 |
+
OperatorGeneratorArgs( \
|
| 452 |
+
TORCH_SELECTIVE_SCHEMA( \
|
| 453 |
+
#aten_op \
|
| 454 |
+
".complex_complex(complex a, complex b) -> " #complex_result), \
|
| 455 |
+
[](Stack& stack) { \
|
| 456 |
+
c10::complex<double> a, b; \
|
| 457 |
+
pop(stack, a, b); \
|
| 458 |
+
push(stack, op); \
|
| 459 |
+
}, \
|
| 460 |
+
aliasAnalysisFromSchema())
|
| 461 |
+
|
| 462 |
+
// define implementations for primitive number ops
|
| 463 |
+
#define DEFINE_GENERIC_OP(aten_op, int_op, float_op, int_result, float_result) \
|
| 464 |
+
OperatorGeneratorArgs( \
|
| 465 |
+
TORCH_SELECTIVE_SCHEMA(#aten_op ".int(int a, int b) -> " #int_result), \
|
| 466 |
+
[](Stack& stack) { \
|
| 467 |
+
int64_t a, b; \
|
| 468 |
+
pop(stack, a, b); \
|
| 469 |
+
push(stack, int_op); \
|
| 470 |
+
}, \
|
| 471 |
+
aliasAnalysisFromSchema()), \
|
| 472 |
+
OperatorGeneratorArgs( \
|
| 473 |
+
TORCH_SELECTIVE_SCHEMA( \
|
| 474 |
+
#aten_op ".float(float a, float b) -> " #float_result), \
|
| 475 |
+
[](Stack& stack) { \
|
| 476 |
+
double a, b; \
|
| 477 |
+
pop(stack, a, b); \
|
| 478 |
+
push(stack, float_op); \
|
| 479 |
+
}, \
|
| 480 |
+
aliasAnalysisFromSchema())
|
| 481 |
+
|
| 482 |
+
#define DEFINE_INT_FLOAT_OP(aten_op, op, result) \
|
| 483 |
+
OperatorGeneratorArgs( \
|
| 484 |
+
TORCH_SELECTIVE_SCHEMA(#aten_op \
|
| 485 |
+
".int_float(int a, float b) -> " #result), \
|
| 486 |
+
[](Stack& stack) { \
|
| 487 |
+
int64_t a; \
|
| 488 |
+
double b; \
|
| 489 |
+
pop(stack, a, b); \
|
| 490 |
+
push(stack, op); \
|
| 491 |
+
}, \
|
| 492 |
+
aliasAnalysisFromSchema()), \
|
| 493 |
+
OperatorGeneratorArgs( \
|
| 494 |
+
TORCH_SELECTIVE_SCHEMA(#aten_op \
|
| 495 |
+
".float_int(float a, int b) -> " #result), \
|
| 496 |
+
[](Stack& stack) { \
|
| 497 |
+
double a; \
|
| 498 |
+
int64_t b; \
|
| 499 |
+
pop(stack, a, b); \
|
| 500 |
+
push(stack, op); \
|
| 501 |
+
}, \
|
| 502 |
+
aliasAnalysisFromSchema())
|
| 503 |
+
|
| 504 |
+
#define DEFINE_INT_OP(aten_op, op) \
|
| 505 |
+
OperatorGeneratorArgs( \
|
| 506 |
+
TORCH_SELECTIVE_SCHEMA(#aten_op ".int(int a, int b) -> int"), \
|
| 507 |
+
[](Stack& stack) { \
|
| 508 |
+
int64_t a, b; \
|
| 509 |
+
pop(stack, a, b); \
|
| 510 |
+
push(stack, op); /* NOLINT(hicpp-signed-bitwise) */ \
|
| 511 |
+
}, \
|
| 512 |
+
aliasAnalysisFromSchema())
|
| 513 |
+
|
| 514 |
+
#define DEFINE_STR_CMP_OP(aten_op, op) \
|
| 515 |
+
OperatorGeneratorArgs( \
|
| 516 |
+
TORCH_SELECTIVE_SCHEMA(#aten_op ".str(str a, str b) -> bool"), \
|
| 517 |
+
[](Stack& stack) { \
|
| 518 |
+
auto b = pop(stack).toStringRef(); \
|
| 519 |
+
auto a = pop(stack).toStringRef(); \
|
| 520 |
+
push(stack, op); \
|
| 521 |
+
}, \
|
| 522 |
+
aliasAnalysisFromSchema())
|
| 523 |
+
|
| 524 |
+
// define a primitive op over Scalar operands.
|
| 525 |
+
// it's necessary to register this overload following
|
| 526 |
+
// int/float variations to avoid trapping Scalar args
|
| 527 |
+
// in unintended implicit conversions
|
| 528 |
+
#define DEFINE_SCALAR_BINARY_OP_AVOID_COLLISION_GENERIC( \
|
| 529 |
+
aten_op, int_op, float_op, result, string_val) \
|
| 530 |
+
OperatorGeneratorArgs( \
|
| 531 |
+
TORCH_SELECTIVE_SCHEMA(#aten_op string_val \
|
| 532 |
+
"(Scalar a, Scalar b) -> " #result), \
|
| 533 |
+
[](Stack& stack) { \
|
| 534 |
+
IValue x, y; \
|
| 535 |
+
pop(stack, x, y); \
|
| 536 |
+
if (x.isDouble()) { \
|
| 537 |
+
if (y.isDouble()) { \
|
| 538 |
+
double a = x.toDouble(); \
|
| 539 |
+
double b = y.toDouble(); \
|
| 540 |
+
push(stack, float_op); \
|
| 541 |
+
} else { \
|
| 542 |
+
double a = x.toDouble(); \
|
| 543 |
+
int64_t b = y.toInt(); \
|
| 544 |
+
push(stack, float_op); \
|
| 545 |
+
} \
|
| 546 |
+
} else { \
|
| 547 |
+
if (y.isDouble()) { \
|
| 548 |
+
int64_t a = x.toInt(); \
|
| 549 |
+
double b = y.toDouble(); \
|
| 550 |
+
push(stack, float_op); \
|
| 551 |
+
} else { \
|
| 552 |
+
int64_t a = x.toInt(); \
|
| 553 |
+
int64_t b = y.toInt(); \
|
| 554 |
+
push(stack, int_op); \
|
| 555 |
+
} \
|
| 556 |
+
} \
|
| 557 |
+
}, \
|
| 558 |
+
aliasAnalysisFromSchema())
|
| 559 |
+
|
| 560 |
+
#define DEFINE_SCALAR_BINARY_OP(aten_op, int_op, float_op, result) \
|
| 561 |
+
DEFINE_SCALAR_BINARY_OP_AVOID_COLLISION_GENERIC( \
|
| 562 |
+
aten_op, int_op, float_op, result, "")
|
| 563 |
+
|
| 564 |
+
#define DEFINE_SCALAR_BINARY_OP_AVOID_COLLISION( \
|
| 565 |
+
aten_op, int_op, float_op, result) \
|
| 566 |
+
DEFINE_SCALAR_BINARY_OP_AVOID_COLLISION_GENERIC( \
|
| 567 |
+
aten_op, int_op, float_op, result, ".Scalar_Scalar")
|
| 568 |
+
|
| 569 |
+
#define DEFINE_BINARY_OP(aten_op, op) \
|
| 570 |
+
DEFINE_GENERIC_OP(aten_op, op, op, int, float), \
|
| 571 |
+
DEFINE_INT_FLOAT_OP(aten_op, op, float), \
|
| 572 |
+
DEFINE_SCALAR_BINARY_OP(aten_op, op, op, Scalar)
|
| 573 |
+
|
| 574 |
+
#define DEFINE_BINARY_FLOAT_OP(aten_op, op) \
|
| 575 |
+
DEFINE_GENERIC_OP(aten_op, op, op, float, float), \
|
| 576 |
+
DEFINE_INT_FLOAT_OP(aten_op, op, float), \
|
| 577 |
+
DEFINE_SCALAR_BINARY_OP(aten_op, op, op, float)
|
| 578 |
+
|
| 579 |
+
#define DEFINE_COMPARISON_OP(aten_op, op) \
|
| 580 |
+
DEFINE_GENERIC_OP(aten_op, op, op, bool, bool), \
|
| 581 |
+
DEFINE_INT_FLOAT_OP(aten_op, op, bool), \
|
| 582 |
+
DEFINE_SCALAR_BINARY_OP(aten_op, op, op, bool), \
|
| 583 |
+
DEFINE_STR_CMP_OP(aten_op, op)
|
| 584 |
+
|
| 585 |
+
#define DEFINE_UNARY_INT_OP(aten_op, op, result) \
|
| 586 |
+
OperatorGeneratorArgs( \
|
| 587 |
+
TORCH_SELECTIVE_SCHEMA(#aten_op ".int(int a) -> " #result), \
|
| 588 |
+
[](Stack& stack) { \
|
| 589 |
+
int64_t a; \
|
| 590 |
+
pop(stack, a); \
|
| 591 |
+
push(stack, op); \
|
| 592 |
+
}, \
|
| 593 |
+
aliasAnalysisFromSchema())
|
| 594 |
+
|
| 595 |
+
#define DEFINE_UNARY_FLOAT_OP(aten_op, op, result) \
|
| 596 |
+
OperatorGeneratorArgs( \
|
| 597 |
+
TORCH_SELECTIVE_SCHEMA(#aten_op ".float(float a) -> " #result), \
|
| 598 |
+
[](Stack& stack) { \
|
| 599 |
+
double a; \
|
| 600 |
+
pop(stack, a); \
|
| 601 |
+
push(stack, op); \
|
| 602 |
+
}, \
|
| 603 |
+
aliasAnalysisFromSchema())
|
| 604 |
+
|
| 605 |
+
#define DEFINE_UNARY_OP(aten_op, op, int_result, float_result) \
|
| 606 |
+
DEFINE_UNARY_INT_OP(aten_op, op, int_result), \
|
| 607 |
+
DEFINE_UNARY_FLOAT_OP(aten_op, op, float_result), \
|
| 608 |
+
OperatorGeneratorArgs( \
|
| 609 |
+
TORCH_SELECTIVE_SCHEMA(#aten_op ".Scalar(Scalar a) -> Scalar"), \
|
| 610 |
+
[](Stack& stack) { \
|
| 611 |
+
IValue x; \
|
| 612 |
+
pop(stack, x); \
|
| 613 |
+
if (x.isDouble()) { \
|
| 614 |
+
double a = x.toDouble(); \
|
| 615 |
+
push(stack, static_cast<float_result>(op)); \
|
| 616 |
+
} else { \
|
| 617 |
+
int64_t a = x.toInt(); \
|
| 618 |
+
push(stack, static_cast<int_result>(op)); \
|
| 619 |
+
} \
|
| 620 |
+
}, \
|
| 621 |
+
aliasAnalysisFromSchema())
|
| 622 |
+
#define DEFINE_BOOL_OP(aten_op, op) \
|
| 623 |
+
OperatorGeneratorArgs( \
|
| 624 |
+
TORCH_SELECTIVE_SCHEMA(#aten_op ".bool(bool a, bool b) -> bool"), \
|
| 625 |
+
[](Stack& stack) { \
|
| 626 |
+
bool a, b; \
|
| 627 |
+
pop(stack, a, b); \
|
| 628 |
+
push(stack, op); \
|
| 629 |
+
}, \
|
| 630 |
+
aliasAnalysisFromSchema())
|
| 631 |
+
#define DEFINE_STRING_OP(op_name, string_op, result) \
|
| 632 |
+
OperatorGeneratorArgs( \
|
| 633 |
+
TORCH_SELECTIVE_SCHEMA(#op_name ".str(str a, str b) ->" #result), \
|
| 634 |
+
[](Stack& stack) { \
|
| 635 |
+
auto b = pop(stack).toStringRef(); \
|
| 636 |
+
auto a = pop(stack).toStringRef(); \
|
| 637 |
+
push(stack, string_op); \
|
| 638 |
+
}, \
|
| 639 |
+
aliasAnalysisFromSchema())
|
| 640 |
+
|
| 641 |
+
//-----------------------------------------------------------------------------
|
| 642 |
+
//-----------------------------------------------------------------------------
|
| 643 |
+
//-----------------------------------------------------------------------------
|
| 644 |
+
//-----------------------------------------------------------------------------
|
| 645 |
+
#define DEFINE_UNARY_COMPLEX_OP(aten_op, op, result) \
|
| 646 |
+
OperatorGeneratorArgs( \
|
| 647 |
+
TORCH_SELECTIVE_SCHEMA(#aten_op ".complex(complex a) -> " #result), \
|
| 648 |
+
[](Stack& stack) { \
|
| 649 |
+
c10::complex<double> a; \
|
| 650 |
+
pop(stack, a); \
|
| 651 |
+
push(stack, op); \
|
| 652 |
+
}, \
|
| 653 |
+
aliasAnalysisFromSchema())
|
| 654 |
+
|
| 655 |
+
// Some complex unary ops (like abs, angle) return real valued output, but most
|
| 656 |
+
// other unary ops return complex valued output. So, this macro is used in the
|
| 657 |
+
// former case where we can explicitly pass complex_result_cast argument, which
|
| 658 |
+
// is set to c10::complex<float> in the macro `DEFINE_UNARY_OP_WITH_COMPLEX`
|
| 659 |
+
// defined below.
|
| 660 |
+
#define DEFINE_UNARY_OP_WITH_COMPLEX_CAST( \
|
| 661 |
+
aten_op, \
|
| 662 |
+
op, \
|
| 663 |
+
int_result, \
|
| 664 |
+
float_result, \
|
| 665 |
+
complex_result, \
|
| 666 |
+
complex_result_cast) \
|
| 667 |
+
DEFINE_UNARY_INT_OP(aten_op, op, int_result), \
|
| 668 |
+
DEFINE_UNARY_FLOAT_OP(aten_op, op, float_result), \
|
| 669 |
+
DEFINE_UNARY_COMPLEX_OP(aten_op, op, complex_result), \
|
| 670 |
+
OperatorGeneratorArgs( \
|
| 671 |
+
TORCH_SELECTIVE_SCHEMA(#aten_op ".Scalar(Scalar a) -> Scalar"), \
|
| 672 |
+
[](Stack& stack) { \
|
| 673 |
+
IValue x; \
|
| 674 |
+
pop(stack, x); \
|
| 675 |
+
if (x.isDouble()) { \
|
| 676 |
+
double a = x.toDouble(); \
|
| 677 |
+
push(stack, static_cast<float_result>(op)); \
|
| 678 |
+
} else if (x.isComplexDouble()) { \
|
| 679 |
+
c10::complex<double> a = x.toComplexDouble(); \
|
| 680 |
+
push(stack, static_cast<complex_result_cast>(op)); \
|
| 681 |
+
} else { \
|
| 682 |
+
int64_t a = x.toInt(); \
|
| 683 |
+
push(stack, static_cast<int_result>(op)); \
|
| 684 |
+
} \
|
| 685 |
+
}, \
|
| 686 |
+
aliasAnalysisFromSchema())
|
| 687 |
+
|
| 688 |
+
#define DEFINE_UNARY_OP_WITH_COMPLEX(aten_op, op, int_result, float_result) \
|
| 689 |
+
DEFINE_UNARY_OP_WITH_COMPLEX_CAST( \
|
| 690 |
+
aten_op, op, int_result, float_result, complex, c10::complex<double>)
|
| 691 |
+
|
| 692 |
+
#define DEFINE_GENERIC_OP_WITH_COMPLEX( \
|
| 693 |
+
aten_op, \
|
| 694 |
+
int_op, \
|
| 695 |
+
float_op, \
|
| 696 |
+
complex_op, \
|
| 697 |
+
int_result, \
|
| 698 |
+
float_result, \
|
| 699 |
+
complex_result) \
|
| 700 |
+
OperatorGeneratorArgs( \
|
| 701 |
+
TORCH_SELECTIVE_SCHEMA(#aten_op ".int(int a, int b) -> " #int_result), \
|
| 702 |
+
[](Stack& stack) { \
|
| 703 |
+
int64_t a, b; \
|
| 704 |
+
pop(stack, a, b); \
|
| 705 |
+
push(stack, int_op); \
|
| 706 |
+
}, \
|
| 707 |
+
aliasAnalysisFromSchema()), \
|
| 708 |
+
OperatorGeneratorArgs( \
|
| 709 |
+
TORCH_SELECTIVE_SCHEMA( \
|
| 710 |
+
#aten_op ".complex(complex a, complex b) -> " #complex_result), \
|
| 711 |
+
[](Stack& stack) { \
|
| 712 |
+
c10::complex<double> a, b; \
|
| 713 |
+
pop(stack, a, b); \
|
| 714 |
+
push(stack, complex_op); \
|
| 715 |
+
}, \
|
| 716 |
+
aliasAnalysisFromSchema()), \
|
| 717 |
+
OperatorGeneratorArgs( \
|
| 718 |
+
TORCH_SELECTIVE_SCHEMA( \
|
| 719 |
+
#aten_op ".float(float a, float b) -> " #float_result), \
|
| 720 |
+
[](Stack& stack) { \
|
| 721 |
+
double a, b; \
|
| 722 |
+
pop(stack, a, b); \
|
| 723 |
+
push(stack, float_op); \
|
| 724 |
+
}, \
|
| 725 |
+
aliasAnalysisFromSchema())
|
| 726 |
+
|
| 727 |
+
#define DEFINE_INT_COMPLEX_OP(aten_op, op, result) \
|
| 728 |
+
OperatorGeneratorArgs( \
|
| 729 |
+
TORCH_SELECTIVE_SCHEMA(#aten_op \
|
| 730 |
+
".int_complex(int a, complex b) -> " #result), \
|
| 731 |
+
[](Stack& stack) { \
|
| 732 |
+
int64_t a; \
|
| 733 |
+
c10::complex<double> b; \
|
| 734 |
+
pop(stack, a, b); \
|
| 735 |
+
push(stack, op); \
|
| 736 |
+
}, \
|
| 737 |
+
aliasAnalysisFromSchema()), \
|
| 738 |
+
OperatorGeneratorArgs( \
|
| 739 |
+
TORCH_SELECTIVE_SCHEMA( \
|
| 740 |
+
#aten_op ".complex_int(complex a, int b) -> " #result), \
|
| 741 |
+
[](Stack& stack) { \
|
| 742 |
+
c10::complex<double> a; \
|
| 743 |
+
int64_t b; \
|
| 744 |
+
pop(stack, a, b); \
|
| 745 |
+
push(stack, op); \
|
| 746 |
+
}, \
|
| 747 |
+
aliasAnalysisFromSchema())
|
| 748 |
+
|
| 749 |
+
#define DEFINE_FLOAT_COMPLEX_OP(aten_op, op, result) \
|
| 750 |
+
OperatorGeneratorArgs( \
|
| 751 |
+
TORCH_SELECTIVE_SCHEMA( \
|
| 752 |
+
#aten_op ".float_complex(float a, complex b) -> " #result), \
|
| 753 |
+
[](Stack& stack) { \
|
| 754 |
+
double a; \
|
| 755 |
+
c10::complex<double> b; \
|
| 756 |
+
pop(stack, a, b); \
|
| 757 |
+
push(stack, op); \
|
| 758 |
+
}, \
|
| 759 |
+
aliasAnalysisFromSchema()), \
|
| 760 |
+
OperatorGeneratorArgs( \
|
| 761 |
+
TORCH_SELECTIVE_SCHEMA( \
|
| 762 |
+
#aten_op ".complex_float(complex a, float b) -> " #result), \
|
| 763 |
+
[](Stack& stack) { \
|
| 764 |
+
c10::complex<double> a; \
|
| 765 |
+
double b; \
|
| 766 |
+
pop(stack, a, b); \
|
| 767 |
+
push(stack, op); \
|
| 768 |
+
}, \
|
| 769 |
+
aliasAnalysisFromSchema())
|
| 770 |
+
|
| 771 |
+
#define DEFINE_SCALAR_BINARY_OP_WITH_COMPLEX_AVOID_COLLISION_GENERIC( \
|
| 772 |
+
aten_op, int_op, float_op, complex_op, result, string_val) \
|
| 773 |
+
OperatorGeneratorArgs( \
|
| 774 |
+
TORCH_SELECTIVE_SCHEMA(#aten_op string_val \
|
| 775 |
+
"(Scalar a, Scalar b) -> " #result), \
|
| 776 |
+
[](Stack& stack) { \
|
| 777 |
+
IValue x, y; \
|
| 778 |
+
pop(stack, x, y); \
|
| 779 |
+
if (x.isComplexDouble()) { \
|
| 780 |
+
c10::complex<double> a = x.toComplexDouble(); \
|
| 781 |
+
if (y.isComplexDouble()) { \
|
| 782 |
+
c10::complex<double> b = y.toComplexDouble(); \
|
| 783 |
+
push(stack, complex_op); \
|
| 784 |
+
} else if (y.isDouble()) { \
|
| 785 |
+
double b = y.toDouble(); \
|
| 786 |
+
push(stack, complex_op); \
|
| 787 |
+
} else { \
|
| 788 |
+
int64_t b = y.toInt(); \
|
| 789 |
+
push(stack, complex_op); \
|
| 790 |
+
} \
|
| 791 |
+
} else if (x.isDouble()) { \
|
| 792 |
+
double a = x.toDouble(); \
|
| 793 |
+
if (y.isComplexDouble()) { \
|
| 794 |
+
c10::complex<double> b = y.toComplexDouble(); \
|
| 795 |
+
push(stack, complex_op); \
|
| 796 |
+
} else if (y.isDouble()) { \
|
| 797 |
+
double b = y.toDouble(); \
|
| 798 |
+
push(stack, float_op); \
|
| 799 |
+
} else { \
|
| 800 |
+
int64_t b = y.toInt(); \
|
| 801 |
+
push(stack, float_op); \
|
| 802 |
+
} \
|
| 803 |
+
} else { \
|
| 804 |
+
int64_t a = x.toInt(); \
|
| 805 |
+
if (y.isComplexDouble()) { \
|
| 806 |
+
c10::complex<double> b = y.toComplexDouble(); \
|
| 807 |
+
push(stack, complex_op); \
|
| 808 |
+
} else if (y.isDouble()) { \
|
| 809 |
+
double b = y.toDouble(); \
|
| 810 |
+
push(stack, float_op); \
|
| 811 |
+
} else { \
|
| 812 |
+
int64_t b = y.toInt(); \
|
| 813 |
+
push(stack, int_op); \
|
| 814 |
+
} \
|
| 815 |
+
} \
|
| 816 |
+
}, \
|
| 817 |
+
aliasAnalysisFromSchema())
|
| 818 |
+
|
| 819 |
+
#define DEFINE_SCALAR_BINARY_OP_WITH_COMPLEX_WITHOUT_INT_COMPLEX_PAIR( \
|
| 820 |
+
aten_op, int_op, float_op, complex_op, result) \
|
| 821 |
+
OperatorGeneratorArgs( \
|
| 822 |
+
TORCH_SELECTIVE_SCHEMA(#aten_op "(Scalar a, Scalar b) -> " #result), \
|
| 823 |
+
[](Stack& stack) { \
|
| 824 |
+
IValue x, y; \
|
| 825 |
+
pop(stack, x, y); \
|
| 826 |
+
if (x.isComplexDouble()) { \
|
| 827 |
+
c10::complex<double> a = x.toComplexDouble(); \
|
| 828 |
+
if (y.isComplexDouble()) { \
|
| 829 |
+
c10::complex<double> b = y.toComplexDouble(); \
|
| 830 |
+
push(stack, complex_op); \
|
| 831 |
+
} else if (y.isDouble()) { \
|
| 832 |
+
double b = y.toDouble(); \
|
| 833 |
+
push(stack, complex_op); \
|
| 834 |
+
} \
|
| 835 |
+
} else if (x.isDouble()) { \
|
| 836 |
+
double a = x.toDouble(); \
|
| 837 |
+
if (y.isComplexDouble()) { \
|
| 838 |
+
c10::complex<double> b = y.toComplexDouble(); \
|
| 839 |
+
push(stack, complex_op); \
|
| 840 |
+
} else if (y.isDouble()) { \
|
| 841 |
+
double b = y.toDouble(); \
|
| 842 |
+
push(stack, float_op); \
|
| 843 |
+
} else { \
|
| 844 |
+
int64_t b = y.toInt(); \
|
| 845 |
+
push(stack, float_op); \
|
| 846 |
+
} \
|
| 847 |
+
} else { \
|
| 848 |
+
int64_t a = x.toInt(); \
|
| 849 |
+
if (y.isDouble()) { \
|
| 850 |
+
double b = y.toDouble(); \
|
| 851 |
+
push(stack, float_op); \
|
| 852 |
+
} else if (y.isInt()) { \
|
| 853 |
+
int64_t b = y.toInt(); \
|
| 854 |
+
push(stack, int_op); \
|
| 855 |
+
} \
|
| 856 |
+
} \
|
| 857 |
+
}, \
|
| 858 |
+
aliasAnalysisFromSchema())
|
| 859 |
+
|
| 860 |
+
#define DEFINE_SCALAR_BINARY_OP_WITH_COMPLEX( \
|
| 861 |
+
aten_op, int_op, float_op, complex_op, result) \
|
| 862 |
+
DEFINE_SCALAR_BINARY_OP_WITH_COMPLEX_AVOID_COLLISION_GENERIC( \
|
| 863 |
+
aten_op, int_op, float_op, complex_op, result, "")
|
| 864 |
+
|
| 865 |
+
#define DEFINE_BINARY_OP_WITH_COMPLEX(aten_op, op) \
|
| 866 |
+
DEFINE_GENERIC_OP_WITH_COMPLEX(aten_op, op, op, op, int, float, complex), \
|
| 867 |
+
DEFINE_INT_COMPLEX_OP(aten_op, op, complex), \
|
| 868 |
+
DEFINE_FLOAT_COMPLEX_OP(aten_op, op, complex), \
|
| 869 |
+
DEFINE_INT_FLOAT_OP(aten_op, op, float), \
|
| 870 |
+
DEFINE_SCALAR_BINARY_OP_WITH_COMPLEX(aten_op, op, op, op, Scalar)
|
| 871 |
+
|
| 872 |
+
#define DEFINE_COMPARISON_OP_WITH_COMPLEX(aten_op, op) \
|
| 873 |
+
DEFINE_GENERIC_OP_WITH_COMPLEX(aten_op, op, op, op, bool, bool, bool), \
|
| 874 |
+
DEFINE_INT_FLOAT_OP(aten_op, op, bool), \
|
| 875 |
+
DEFINE_FLOAT_COMPLEX_OP(aten_op, op, bool), \
|
| 876 |
+
DEFINE_SCALAR_BINARY_OP_WITH_COMPLEX_WITHOUT_INT_COMPLEX_PAIR( \
|
| 877 |
+
aten_op, op, op, op, bool), \
|
| 878 |
+
DEFINE_STR_CMP_OP(aten_op, op)
|
| 879 |
+
|
| 880 |
+
TORCH_API at::Generator make_generator_for_device(
|
| 881 |
+
c10::Device device,
|
| 882 |
+
c10::optional<int64_t> seed = c10::nullopt);
|
| 883 |
+
|
| 884 |
+
} // namespace torch::jit
|
shared/package-files/9b/9b484599c4f3bd9f2c65b6e759e10dc332b2b9fa44f735b0651f96088e247695/blob
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Tests for homomorphisms."""
|
| 2 |
+
|
| 3 |
+
from sympy.core.singleton import S
|
| 4 |
+
from sympy.polys.domains.rationalfield import QQ
|
| 5 |
+
from sympy.abc import x, y
|
| 6 |
+
from sympy.polys.agca import homomorphism
|
| 7 |
+
from sympy.testing.pytest import raises
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def test_printing():
|
| 11 |
+
R = QQ.old_poly_ring(x)
|
| 12 |
+
|
| 13 |
+
assert str(homomorphism(R.free_module(1), R.free_module(1), [0])) == \
|
| 14 |
+
'Matrix([[0]]) : QQ[x]**1 -> QQ[x]**1'
|
| 15 |
+
assert str(homomorphism(R.free_module(2), R.free_module(2), [0, 0])) == \
|
| 16 |
+
'Matrix([ \n[0, 0], : QQ[x]**2 -> QQ[x]**2\n[0, 0]]) '
|
| 17 |
+
assert str(homomorphism(R.free_module(1), R.free_module(1) / [[x]], [0])) == \
|
| 18 |
+
'Matrix([[0]]) : QQ[x]**1 -> QQ[x]**1/<[x]>'
|
| 19 |
+
assert str(R.free_module(0).identity_hom()) == 'Matrix(0, 0, []) : QQ[x]**0 -> QQ[x]**0'
|
| 20 |
+
|
| 21 |
+
def test_operations():
|
| 22 |
+
F = QQ.old_poly_ring(x).free_module(2)
|
| 23 |
+
G = QQ.old_poly_ring(x).free_module(3)
|
| 24 |
+
f = F.identity_hom()
|
| 25 |
+
g = homomorphism(F, F, [0, [1, x]])
|
| 26 |
+
h = homomorphism(F, F, [[1, 0], 0])
|
| 27 |
+
i = homomorphism(F, G, [[1, 0, 0], [0, 1, 0]])
|
| 28 |
+
|
| 29 |
+
assert f == f
|
| 30 |
+
assert f != g
|
| 31 |
+
assert f != i
|
| 32 |
+
assert (f != F.identity_hom()) is False
|
| 33 |
+
assert 2*f == f*2 == homomorphism(F, F, [[2, 0], [0, 2]])
|
| 34 |
+
assert f/2 == homomorphism(F, F, [[S.Half, 0], [0, S.Half]])
|
| 35 |
+
assert f + g == homomorphism(F, F, [[1, 0], [1, x + 1]])
|
| 36 |
+
assert f - g == homomorphism(F, F, [[1, 0], [-1, 1 - x]])
|
| 37 |
+
assert f*g == g == g*f
|
| 38 |
+
assert h*g == homomorphism(F, F, [0, [1, 0]])
|
| 39 |
+
assert g*h == homomorphism(F, F, [0, 0])
|
| 40 |
+
assert i*f == i
|
| 41 |
+
assert f([1, 2]) == [1, 2]
|
| 42 |
+
assert g([1, 2]) == [2, 2*x]
|
| 43 |
+
|
| 44 |
+
assert i.restrict_domain(F.submodule([x, x]))([x, x]) == i([x, x])
|
| 45 |
+
h1 = h.quotient_domain(F.submodule([0, 1]))
|
| 46 |
+
assert h1([1, 0]) == h([1, 0])
|
| 47 |
+
assert h1.restrict_domain(h1.domain.submodule([x, 0]))([x, 0]) == h([x, 0])
|
| 48 |
+
|
| 49 |
+
raises(TypeError, lambda: f/g)
|
| 50 |
+
raises(TypeError, lambda: f + 1)
|
| 51 |
+
raises(TypeError, lambda: f + i)
|
| 52 |
+
raises(TypeError, lambda: f - 1)
|
| 53 |
+
raises(TypeError, lambda: f*i)
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def test_creation():
|
| 57 |
+
F = QQ.old_poly_ring(x).free_module(3)
|
| 58 |
+
G = QQ.old_poly_ring(x).free_module(2)
|
| 59 |
+
SM = F.submodule([1, 1, 1])
|
| 60 |
+
Q = F / SM
|
| 61 |
+
SQ = Q.submodule([1, 0, 0])
|
| 62 |
+
|
| 63 |
+
matrix = [[1, 0], [0, 1], [-1, -1]]
|
| 64 |
+
h = homomorphism(F, G, matrix)
|
| 65 |
+
h2 = homomorphism(Q, G, matrix)
|
| 66 |
+
assert h.quotient_domain(SM) == h2
|
| 67 |
+
raises(ValueError, lambda: h.quotient_domain(F.submodule([1, 0, 0])))
|
| 68 |
+
assert h2.restrict_domain(SQ) == homomorphism(SQ, G, matrix)
|
| 69 |
+
raises(ValueError, lambda: h.restrict_domain(G))
|
| 70 |
+
raises(ValueError, lambda: h.restrict_codomain(G.submodule([1, 0])))
|
| 71 |
+
raises(ValueError, lambda: h.quotient_codomain(F))
|
| 72 |
+
|
| 73 |
+
im = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
|
| 74 |
+
for M in [F, SM, Q, SQ]:
|
| 75 |
+
assert M.identity_hom() == homomorphism(M, M, im)
|
| 76 |
+
assert SM.inclusion_hom() == homomorphism(SM, F, im)
|
| 77 |
+
assert SQ.inclusion_hom() == homomorphism(SQ, Q, im)
|
| 78 |
+
assert Q.quotient_hom() == homomorphism(F, Q, im)
|
| 79 |
+
assert SQ.quotient_hom() == homomorphism(SQ.base, SQ, im)
|
| 80 |
+
|
| 81 |
+
class conv:
|
| 82 |
+
def convert(x, y=None):
|
| 83 |
+
return x
|
| 84 |
+
|
| 85 |
+
class dummy:
|
| 86 |
+
container = conv()
|
| 87 |
+
|
| 88 |
+
def submodule(*args):
|
| 89 |
+
return None
|
| 90 |
+
raises(TypeError, lambda: homomorphism(dummy(), G, matrix))
|
| 91 |
+
raises(TypeError, lambda: homomorphism(F, dummy(), matrix))
|
| 92 |
+
raises(
|
| 93 |
+
ValueError, lambda: homomorphism(QQ.old_poly_ring(x, y).free_module(3), G, matrix))
|
| 94 |
+
raises(ValueError, lambda: homomorphism(F, G, [0, 0]))
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
def test_properties():
|
| 98 |
+
R = QQ.old_poly_ring(x, y)
|
| 99 |
+
F = R.free_module(2)
|
| 100 |
+
h = homomorphism(F, F, [[x, 0], [y, 0]])
|
| 101 |
+
assert h.kernel() == F.submodule([-y, x])
|
| 102 |
+
assert h.image() == F.submodule([x, 0], [y, 0])
|
| 103 |
+
assert not h.is_injective()
|
| 104 |
+
assert not h.is_surjective()
|
| 105 |
+
assert h.restrict_codomain(h.image()).is_surjective()
|
| 106 |
+
assert h.restrict_domain(F.submodule([1, 0])).is_injective()
|
| 107 |
+
assert h.quotient_domain(
|
| 108 |
+
h.kernel()).restrict_codomain(h.image()).is_isomorphism()
|
| 109 |
+
|
| 110 |
+
R2 = QQ.old_poly_ring(x, y, order=(("lex", x), ("ilex", y))) / [x**2 + 1]
|
| 111 |
+
F = R2.free_module(2)
|
| 112 |
+
h = homomorphism(F, F, [[x, 0], [y, y + 1]])
|
| 113 |
+
assert h.is_isomorphism()
|
shared/package-files/9b/9b4b2ab4ef7b3c4bfcfff6eca7136078b7c168c81adab9d952790797eea37249/blob
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any, Dict, Optional, TypeVar, Union
|
| 2 |
+
|
| 3 |
+
from django.db.models.expressions import Combinable, CombinedExpression, Func, Value, _OutputField
|
| 4 |
+
from django.db.models.lookups import Lookup
|
| 5 |
+
|
| 6 |
+
from django.db.models import Field
|
| 7 |
+
|
| 8 |
+
_Expression = Union[str, Combinable, "SearchQueryCombinable"]
|
| 9 |
+
|
| 10 |
+
class SearchVectorExact(Lookup): ...
|
| 11 |
+
class SearchVectorField(Field): ...
|
| 12 |
+
class SearchQueryField(Field): ...
|
| 13 |
+
|
| 14 |
+
class SearchVectorCombinable:
|
| 15 |
+
ADD: str = ...
|
| 16 |
+
|
| 17 |
+
class SearchVector(SearchVectorCombinable, Func):
|
| 18 |
+
config: Optional[Any] = ...
|
| 19 |
+
def __init__(self, *expressions: _Expression, **extra: Any): ...
|
| 20 |
+
|
| 21 |
+
class CombinedSearchVector(SearchVectorCombinable, CombinedExpression):
|
| 22 |
+
def __init__(
|
| 23 |
+
self, lhs, connector, rhs, config: Optional[_Expression] = ..., output_field: Optional[_OutputField] = ...
|
| 24 |
+
): ...
|
| 25 |
+
|
| 26 |
+
_T = TypeVar("_T", bound="SearchQueryCombinable")
|
| 27 |
+
|
| 28 |
+
class SearchQueryCombinable:
|
| 29 |
+
BITAND: str = ...
|
| 30 |
+
BITOR: str = ...
|
| 31 |
+
def __or__(self: _T, other: SearchQueryCombinable) -> _T: ...
|
| 32 |
+
def __ror__(self: _T, other: SearchQueryCombinable) -> _T: ...
|
| 33 |
+
def __and__(self: _T, other: SearchQueryCombinable) -> _T: ...
|
| 34 |
+
def __rand__(self: _T, other: SearchQueryCombinable) -> _T: ...
|
| 35 |
+
|
| 36 |
+
class SearchQuery(SearchQueryCombinable, Value): # type: ignore
|
| 37 |
+
SEARCH_TYPES: Dict[str, str] = ...
|
| 38 |
+
def __init__(
|
| 39 |
+
self,
|
| 40 |
+
value: str,
|
| 41 |
+
output_field: Optional[_OutputField] = ...,
|
| 42 |
+
*,
|
| 43 |
+
config: Optional[_Expression] = ...,
|
| 44 |
+
invert: bool = ...,
|
| 45 |
+
search_type: str = ...
|
| 46 |
+
): ...
|
| 47 |
+
def __invert__(self: _T) -> _T: ...
|
| 48 |
+
|
| 49 |
+
class CombinedSearchQuery(SearchQueryCombinable, CombinedExpression): # type: ignore
|
| 50 |
+
def __init__(
|
| 51 |
+
self, lhs, connector, rhs, config: Optional[_Expression] = ..., output_field: Optional[_OutputField] = ...
|
| 52 |
+
) -> None: ...
|
| 53 |
+
|
| 54 |
+
class SearchRank(Func):
|
| 55 |
+
def __init__(
|
| 56 |
+
self, vector: Union[SearchVector, _Expression], query: Union[SearchQuery, _Expression], **extra: Any
|
| 57 |
+
) -> None: ...
|
| 58 |
+
|
| 59 |
+
class TrigramBase(Func):
|
| 60 |
+
def __init__(self, expression: _Expression, string, **extra: Any) -> None: ...
|
| 61 |
+
|
| 62 |
+
class TrigramSimilarity(TrigramBase): ...
|
| 63 |
+
class TrigramDistance(TrigramBase): ...
|
shared/package-files/9b/9b4d6e6e077c5be4e16cbf790138fb75158aea70027ab99005cd0cac43cf42bf/blob
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Authors: The scikit-learn developers
|
| 2 |
+
# SPDX-License-Identifier: BSD-3-Clause
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def _check_feature_names(X, feature_names=None):
|
| 6 |
+
"""Check feature names.
|
| 7 |
+
|
| 8 |
+
Parameters
|
| 9 |
+
----------
|
| 10 |
+
X : array-like of shape (n_samples, n_features)
|
| 11 |
+
Input data.
|
| 12 |
+
|
| 13 |
+
feature_names : None or array-like of shape (n_names,), dtype=str
|
| 14 |
+
Feature names to check or `None`.
|
| 15 |
+
|
| 16 |
+
Returns
|
| 17 |
+
-------
|
| 18 |
+
feature_names : list of str
|
| 19 |
+
Feature names validated. If `feature_names` is `None`, then a list of
|
| 20 |
+
feature names is provided, i.e. the column names of a pandas dataframe
|
| 21 |
+
or a generic list of feature names (e.g. `["x0", "x1", ...]`) for a
|
| 22 |
+
NumPy array.
|
| 23 |
+
"""
|
| 24 |
+
if feature_names is None:
|
| 25 |
+
if hasattr(X, "columns") and hasattr(X.columns, "tolist"):
|
| 26 |
+
# get the column names for a pandas dataframe
|
| 27 |
+
feature_names = X.columns.tolist()
|
| 28 |
+
else:
|
| 29 |
+
# define a list of numbered indices for a numpy array
|
| 30 |
+
feature_names = [f"x{i}" for i in range(X.shape[1])]
|
| 31 |
+
elif hasattr(feature_names, "tolist"):
|
| 32 |
+
# convert numpy array or pandas index to a list
|
| 33 |
+
feature_names = feature_names.tolist()
|
| 34 |
+
if len(set(feature_names)) != len(feature_names):
|
| 35 |
+
raise ValueError("feature_names should not contain duplicates.")
|
| 36 |
+
|
| 37 |
+
return feature_names
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def _get_feature_index(fx, feature_names=None):
|
| 41 |
+
"""Get feature index.
|
| 42 |
+
|
| 43 |
+
Parameters
|
| 44 |
+
----------
|
| 45 |
+
fx : int or str
|
| 46 |
+
Feature index or name.
|
| 47 |
+
|
| 48 |
+
feature_names : list of str, default=None
|
| 49 |
+
All feature names from which to search the indices.
|
| 50 |
+
|
| 51 |
+
Returns
|
| 52 |
+
-------
|
| 53 |
+
idx : int
|
| 54 |
+
Feature index.
|
| 55 |
+
"""
|
| 56 |
+
if isinstance(fx, str):
|
| 57 |
+
if feature_names is None:
|
| 58 |
+
raise ValueError(
|
| 59 |
+
f"Cannot plot partial dependence for feature {fx!r} since "
|
| 60 |
+
"the list of feature names was not provided, neither as "
|
| 61 |
+
"column names of a pandas data-frame nor via the feature_names "
|
| 62 |
+
"parameter."
|
| 63 |
+
)
|
| 64 |
+
try:
|
| 65 |
+
return feature_names.index(fx)
|
| 66 |
+
except ValueError as e:
|
| 67 |
+
raise ValueError(f"Feature {fx!r} not in feature_names") from e
|
| 68 |
+
return fx
|
shared/package-files/9b/9b4fa9e614c6536132eee050ac1ecb48f813bd2d02f05afe480f5dd81017e8c9/blob
ADDED
|
@@ -0,0 +1,687 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import itertools
|
| 2 |
+
|
| 3 |
+
from sympy.concrete.summations import Sum
|
| 4 |
+
from sympy.core.add import Add
|
| 5 |
+
from sympy.core.expr import Expr
|
| 6 |
+
from sympy.core.function import expand as _expand
|
| 7 |
+
from sympy.core.mul import Mul
|
| 8 |
+
from sympy.core.relational import Eq
|
| 9 |
+
from sympy.core.singleton import S
|
| 10 |
+
from sympy.core.symbol import Symbol
|
| 11 |
+
from sympy.integrals.integrals import Integral
|
| 12 |
+
from sympy.logic.boolalg import Not
|
| 13 |
+
from sympy.core.parameters import global_parameters
|
| 14 |
+
from sympy.core.sorting import default_sort_key
|
| 15 |
+
from sympy.core.sympify import _sympify
|
| 16 |
+
from sympy.core.relational import Relational
|
| 17 |
+
from sympy.logic.boolalg import Boolean
|
| 18 |
+
from sympy.stats import variance, covariance
|
| 19 |
+
from sympy.stats.rv import (RandomSymbol, pspace, dependent,
|
| 20 |
+
given, sampling_E, RandomIndexedSymbol, is_random,
|
| 21 |
+
PSpace, sampling_P, random_symbols)
|
| 22 |
+
|
| 23 |
+
__all__ = ['Probability', 'Expectation', 'Variance', 'Covariance']
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
@is_random.register(Expr)
|
| 27 |
+
def _(x):
|
| 28 |
+
atoms = x.free_symbols
|
| 29 |
+
if len(atoms) == 1 and next(iter(atoms)) == x:
|
| 30 |
+
return False
|
| 31 |
+
return any(is_random(i) for i in atoms)
|
| 32 |
+
|
| 33 |
+
@is_random.register(RandomSymbol) # type: ignore
|
| 34 |
+
def _(x):
|
| 35 |
+
return True
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
class Probability(Expr):
|
| 39 |
+
"""
|
| 40 |
+
Symbolic expression for the probability.
|
| 41 |
+
|
| 42 |
+
Examples
|
| 43 |
+
========
|
| 44 |
+
|
| 45 |
+
>>> from sympy.stats import Probability, Normal
|
| 46 |
+
>>> from sympy import Integral
|
| 47 |
+
>>> X = Normal("X", 0, 1)
|
| 48 |
+
>>> prob = Probability(X > 1)
|
| 49 |
+
>>> prob
|
| 50 |
+
Probability(X > 1)
|
| 51 |
+
|
| 52 |
+
Integral representation:
|
| 53 |
+
|
| 54 |
+
>>> prob.rewrite(Integral)
|
| 55 |
+
Integral(sqrt(2)*exp(-_z**2/2)/(2*sqrt(pi)), (_z, 1, oo))
|
| 56 |
+
|
| 57 |
+
Evaluation of the integral:
|
| 58 |
+
|
| 59 |
+
>>> prob.evaluate_integral()
|
| 60 |
+
sqrt(2)*(-sqrt(2)*sqrt(pi)*erf(sqrt(2)/2) + sqrt(2)*sqrt(pi))/(4*sqrt(pi))
|
| 61 |
+
"""
|
| 62 |
+
def __new__(cls, prob, condition=None, **kwargs):
|
| 63 |
+
prob = _sympify(prob)
|
| 64 |
+
if condition is None:
|
| 65 |
+
obj = Expr.__new__(cls, prob)
|
| 66 |
+
else:
|
| 67 |
+
condition = _sympify(condition)
|
| 68 |
+
obj = Expr.__new__(cls, prob, condition)
|
| 69 |
+
obj._condition = condition
|
| 70 |
+
return obj
|
| 71 |
+
|
| 72 |
+
def doit(self, **hints):
|
| 73 |
+
condition = self.args[0]
|
| 74 |
+
given_condition = self._condition
|
| 75 |
+
numsamples = hints.get('numsamples', False)
|
| 76 |
+
for_rewrite = not hints.get('for_rewrite', False)
|
| 77 |
+
|
| 78 |
+
if isinstance(condition, Not):
|
| 79 |
+
return S.One - self.func(condition.args[0], given_condition,
|
| 80 |
+
evaluate=for_rewrite).doit(**hints)
|
| 81 |
+
|
| 82 |
+
if condition.has(RandomIndexedSymbol):
|
| 83 |
+
return pspace(condition).probability(condition, given_condition,
|
| 84 |
+
evaluate=for_rewrite)
|
| 85 |
+
|
| 86 |
+
if isinstance(given_condition, RandomSymbol):
|
| 87 |
+
condrv = random_symbols(condition)
|
| 88 |
+
if len(condrv) == 1 and condrv[0] == given_condition:
|
| 89 |
+
from sympy.stats.frv_types import BernoulliDistribution
|
| 90 |
+
return BernoulliDistribution(self.func(condition).doit(**hints), 0, 1)
|
| 91 |
+
if any(dependent(rv, given_condition) for rv in condrv):
|
| 92 |
+
return Probability(condition, given_condition)
|
| 93 |
+
else:
|
| 94 |
+
return Probability(condition).doit()
|
| 95 |
+
|
| 96 |
+
if given_condition is not None and \
|
| 97 |
+
not isinstance(given_condition, (Relational, Boolean)):
|
| 98 |
+
raise ValueError("%s is not a relational or combination of relationals"
|
| 99 |
+
% (given_condition))
|
| 100 |
+
|
| 101 |
+
if given_condition == False or condition is S.false:
|
| 102 |
+
return S.Zero
|
| 103 |
+
if not isinstance(condition, (Relational, Boolean)):
|
| 104 |
+
raise ValueError("%s is not a relational or combination of relationals"
|
| 105 |
+
% (condition))
|
| 106 |
+
if condition is S.true:
|
| 107 |
+
return S.One
|
| 108 |
+
|
| 109 |
+
if numsamples:
|
| 110 |
+
return sampling_P(condition, given_condition, numsamples=numsamples)
|
| 111 |
+
if given_condition is not None: # If there is a condition
|
| 112 |
+
# Recompute on new conditional expr
|
| 113 |
+
return Probability(given(condition, given_condition)).doit()
|
| 114 |
+
|
| 115 |
+
# Otherwise pass work off to the ProbabilitySpace
|
| 116 |
+
if pspace(condition) == PSpace():
|
| 117 |
+
return Probability(condition, given_condition)
|
| 118 |
+
|
| 119 |
+
result = pspace(condition).probability(condition)
|
| 120 |
+
if hasattr(result, 'doit') and for_rewrite:
|
| 121 |
+
return result.doit()
|
| 122 |
+
else:
|
| 123 |
+
return result
|
| 124 |
+
|
| 125 |
+
def _eval_rewrite_as_Integral(self, arg, condition=None, **kwargs):
|
| 126 |
+
return self.func(arg, condition=condition).doit(for_rewrite=True)
|
| 127 |
+
|
| 128 |
+
_eval_rewrite_as_Sum = _eval_rewrite_as_Integral
|
| 129 |
+
|
| 130 |
+
def evaluate_integral(self):
|
| 131 |
+
return self.rewrite(Integral).doit()
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
class Expectation(Expr):
|
| 135 |
+
"""
|
| 136 |
+
Symbolic expression for the expectation.
|
| 137 |
+
|
| 138 |
+
Examples
|
| 139 |
+
========
|
| 140 |
+
|
| 141 |
+
>>> from sympy.stats import Expectation, Normal, Probability, Poisson
|
| 142 |
+
>>> from sympy import symbols, Integral, Sum
|
| 143 |
+
>>> mu = symbols("mu")
|
| 144 |
+
>>> sigma = symbols("sigma", positive=True)
|
| 145 |
+
>>> X = Normal("X", mu, sigma)
|
| 146 |
+
>>> Expectation(X)
|
| 147 |
+
Expectation(X)
|
| 148 |
+
>>> Expectation(X).evaluate_integral().simplify()
|
| 149 |
+
mu
|
| 150 |
+
|
| 151 |
+
To get the integral expression of the expectation:
|
| 152 |
+
|
| 153 |
+
>>> Expectation(X).rewrite(Integral)
|
| 154 |
+
Integral(sqrt(2)*X*exp(-(X - mu)**2/(2*sigma**2))/(2*sqrt(pi)*sigma), (X, -oo, oo))
|
| 155 |
+
|
| 156 |
+
The same integral expression, in more abstract terms:
|
| 157 |
+
|
| 158 |
+
>>> Expectation(X).rewrite(Probability)
|
| 159 |
+
Integral(x*Probability(Eq(X, x)), (x, -oo, oo))
|
| 160 |
+
|
| 161 |
+
To get the Summation expression of the expectation for discrete random variables:
|
| 162 |
+
|
| 163 |
+
>>> lamda = symbols('lamda', positive=True)
|
| 164 |
+
>>> Z = Poisson('Z', lamda)
|
| 165 |
+
>>> Expectation(Z).rewrite(Sum)
|
| 166 |
+
Sum(Z*lamda**Z*exp(-lamda)/factorial(Z), (Z, 0, oo))
|
| 167 |
+
|
| 168 |
+
This class is aware of some properties of the expectation:
|
| 169 |
+
|
| 170 |
+
>>> from sympy.abc import a
|
| 171 |
+
>>> Expectation(a*X)
|
| 172 |
+
Expectation(a*X)
|
| 173 |
+
>>> Y = Normal("Y", 1, 2)
|
| 174 |
+
>>> Expectation(X + Y)
|
| 175 |
+
Expectation(X + Y)
|
| 176 |
+
|
| 177 |
+
To expand the ``Expectation`` into its expression, use ``expand()``:
|
| 178 |
+
|
| 179 |
+
>>> Expectation(X + Y).expand()
|
| 180 |
+
Expectation(X) + Expectation(Y)
|
| 181 |
+
>>> Expectation(a*X + Y).expand()
|
| 182 |
+
a*Expectation(X) + Expectation(Y)
|
| 183 |
+
>>> Expectation(a*X + Y)
|
| 184 |
+
Expectation(a*X + Y)
|
| 185 |
+
>>> Expectation((X + Y)*(X - Y)).expand()
|
| 186 |
+
Expectation(X**2) - Expectation(Y**2)
|
| 187 |
+
|
| 188 |
+
To evaluate the ``Expectation``, use ``doit()``:
|
| 189 |
+
|
| 190 |
+
>>> Expectation(X + Y).doit()
|
| 191 |
+
mu + 1
|
| 192 |
+
>>> Expectation(X + Expectation(Y + Expectation(2*X))).doit()
|
| 193 |
+
3*mu + 1
|
| 194 |
+
|
| 195 |
+
To prevent evaluating nested ``Expectation``, use ``doit(deep=False)``
|
| 196 |
+
|
| 197 |
+
>>> Expectation(X + Expectation(Y)).doit(deep=False)
|
| 198 |
+
mu + Expectation(Expectation(Y))
|
| 199 |
+
>>> Expectation(X + Expectation(Y + Expectation(2*X))).doit(deep=False)
|
| 200 |
+
mu + Expectation(Expectation(Y + Expectation(2*X)))
|
| 201 |
+
|
| 202 |
+
"""
|
| 203 |
+
|
| 204 |
+
def __new__(cls, expr, condition=None, **kwargs):
|
| 205 |
+
expr = _sympify(expr)
|
| 206 |
+
if expr.is_Matrix:
|
| 207 |
+
from sympy.stats.symbolic_multivariate_probability import ExpectationMatrix
|
| 208 |
+
return ExpectationMatrix(expr, condition)
|
| 209 |
+
if condition is None:
|
| 210 |
+
if not is_random(expr):
|
| 211 |
+
return expr
|
| 212 |
+
obj = Expr.__new__(cls, expr)
|
| 213 |
+
else:
|
| 214 |
+
condition = _sympify(condition)
|
| 215 |
+
obj = Expr.__new__(cls, expr, condition)
|
| 216 |
+
obj._condition = condition
|
| 217 |
+
return obj
|
| 218 |
+
|
| 219 |
+
def expand(self, **hints):
|
| 220 |
+
expr = self.args[0]
|
| 221 |
+
condition = self._condition
|
| 222 |
+
|
| 223 |
+
if not is_random(expr):
|
| 224 |
+
return expr
|
| 225 |
+
|
| 226 |
+
if isinstance(expr, Add):
|
| 227 |
+
return Add.fromiter(Expectation(a, condition=condition).expand()
|
| 228 |
+
for a in expr.args)
|
| 229 |
+
|
| 230 |
+
expand_expr = _expand(expr)
|
| 231 |
+
if isinstance(expand_expr, Add):
|
| 232 |
+
return Add.fromiter(Expectation(a, condition=condition).expand()
|
| 233 |
+
for a in expand_expr.args)
|
| 234 |
+
|
| 235 |
+
elif isinstance(expr, Mul):
|
| 236 |
+
rv = []
|
| 237 |
+
nonrv = []
|
| 238 |
+
for a in expr.args:
|
| 239 |
+
if is_random(a):
|
| 240 |
+
rv.append(a)
|
| 241 |
+
else:
|
| 242 |
+
nonrv.append(a)
|
| 243 |
+
return Mul.fromiter(nonrv)*Expectation(Mul.fromiter(rv), condition=condition)
|
| 244 |
+
|
| 245 |
+
return self
|
| 246 |
+
|
| 247 |
+
def doit(self, **hints):
|
| 248 |
+
deep = hints.get('deep', True)
|
| 249 |
+
condition = self._condition
|
| 250 |
+
expr = self.args[0]
|
| 251 |
+
numsamples = hints.get('numsamples', False)
|
| 252 |
+
for_rewrite = not hints.get('for_rewrite', False)
|
| 253 |
+
|
| 254 |
+
if deep:
|
| 255 |
+
expr = expr.doit(**hints)
|
| 256 |
+
|
| 257 |
+
if not is_random(expr) or isinstance(expr, Expectation): # expr isn't random?
|
| 258 |
+
return expr
|
| 259 |
+
if numsamples: # Computing by monte carlo sampling?
|
| 260 |
+
evalf = hints.get('evalf', True)
|
| 261 |
+
return sampling_E(expr, condition, numsamples=numsamples, evalf=evalf)
|
| 262 |
+
|
| 263 |
+
if expr.has(RandomIndexedSymbol):
|
| 264 |
+
return pspace(expr).compute_expectation(expr, condition)
|
| 265 |
+
|
| 266 |
+
# Create new expr and recompute E
|
| 267 |
+
if condition is not None: # If there is a condition
|
| 268 |
+
return self.func(given(expr, condition)).doit(**hints)
|
| 269 |
+
|
| 270 |
+
# A few known statements for efficiency
|
| 271 |
+
|
| 272 |
+
if expr.is_Add: # We know that E is Linear
|
| 273 |
+
return Add(*[self.func(arg, condition).doit(**hints)
|
| 274 |
+
if not isinstance(arg, Expectation) else self.func(arg, condition)
|
| 275 |
+
for arg in expr.args])
|
| 276 |
+
if expr.is_Mul:
|
| 277 |
+
if expr.atoms(Expectation):
|
| 278 |
+
return expr
|
| 279 |
+
|
| 280 |
+
if pspace(expr) == PSpace():
|
| 281 |
+
return self.func(expr)
|
| 282 |
+
# Otherwise case is simple, pass work off to the ProbabilitySpace
|
| 283 |
+
result = pspace(expr).compute_expectation(expr, evaluate=for_rewrite)
|
| 284 |
+
if hasattr(result, 'doit') and for_rewrite:
|
| 285 |
+
return result.doit(**hints)
|
| 286 |
+
else:
|
| 287 |
+
return result
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
def _eval_rewrite_as_Probability(self, arg, condition=None, **kwargs):
|
| 291 |
+
rvs = arg.atoms(RandomSymbol)
|
| 292 |
+
if len(rvs) > 1:
|
| 293 |
+
raise NotImplementedError()
|
| 294 |
+
if len(rvs) == 0:
|
| 295 |
+
return arg
|
| 296 |
+
|
| 297 |
+
rv = rvs.pop()
|
| 298 |
+
if rv.pspace is None:
|
| 299 |
+
raise ValueError("Probability space not known")
|
| 300 |
+
|
| 301 |
+
symbol = rv.symbol
|
| 302 |
+
if symbol.name[0].isupper():
|
| 303 |
+
symbol = Symbol(symbol.name.lower())
|
| 304 |
+
else :
|
| 305 |
+
symbol = Symbol(symbol.name + "_1")
|
| 306 |
+
|
| 307 |
+
if rv.pspace.is_Continuous:
|
| 308 |
+
return Integral(arg.replace(rv, symbol)*Probability(Eq(rv, symbol), condition), (symbol, rv.pspace.domain.set.inf, rv.pspace.domain.set.sup))
|
| 309 |
+
else:
|
| 310 |
+
if rv.pspace.is_Finite:
|
| 311 |
+
raise NotImplementedError
|
| 312 |
+
else:
|
| 313 |
+
return Sum(arg.replace(rv, symbol)*Probability(Eq(rv, symbol), condition), (symbol, rv.pspace.domain.set.inf, rv.pspace.set.sup))
|
| 314 |
+
|
| 315 |
+
def _eval_rewrite_as_Integral(self, arg, condition=None, **kwargs):
|
| 316 |
+
return self.func(arg, condition=condition).doit(deep=False, for_rewrite=True)
|
| 317 |
+
|
| 318 |
+
_eval_rewrite_as_Sum = _eval_rewrite_as_Integral # For discrete this will be Sum
|
| 319 |
+
|
| 320 |
+
def evaluate_integral(self):
|
| 321 |
+
return self.rewrite(Integral).doit()
|
| 322 |
+
|
| 323 |
+
evaluate_sum = evaluate_integral
|
| 324 |
+
|
| 325 |
+
class Variance(Expr):
|
| 326 |
+
"""
|
| 327 |
+
Symbolic expression for the variance.
|
| 328 |
+
|
| 329 |
+
Examples
|
| 330 |
+
========
|
| 331 |
+
|
| 332 |
+
>>> from sympy import symbols, Integral
|
| 333 |
+
>>> from sympy.stats import Normal, Expectation, Variance, Probability
|
| 334 |
+
>>> mu = symbols("mu", positive=True)
|
| 335 |
+
>>> sigma = symbols("sigma", positive=True)
|
| 336 |
+
>>> X = Normal("X", mu, sigma)
|
| 337 |
+
>>> Variance(X)
|
| 338 |
+
Variance(X)
|
| 339 |
+
>>> Variance(X).evaluate_integral()
|
| 340 |
+
sigma**2
|
| 341 |
+
|
| 342 |
+
Integral representation of the underlying calculations:
|
| 343 |
+
|
| 344 |
+
>>> Variance(X).rewrite(Integral)
|
| 345 |
+
Integral(sqrt(2)*(X - Integral(sqrt(2)*X*exp(-(X - mu)**2/(2*sigma**2))/(2*sqrt(pi)*sigma), (X, -oo, oo)))**2*exp(-(X - mu)**2/(2*sigma**2))/(2*sqrt(pi)*sigma), (X, -oo, oo))
|
| 346 |
+
|
| 347 |
+
Integral representation, without expanding the PDF:
|
| 348 |
+
|
| 349 |
+
>>> Variance(X).rewrite(Probability)
|
| 350 |
+
-Integral(x*Probability(Eq(X, x)), (x, -oo, oo))**2 + Integral(x**2*Probability(Eq(X, x)), (x, -oo, oo))
|
| 351 |
+
|
| 352 |
+
Rewrite the variance in terms of the expectation
|
| 353 |
+
|
| 354 |
+
>>> Variance(X).rewrite(Expectation)
|
| 355 |
+
-Expectation(X)**2 + Expectation(X**2)
|
| 356 |
+
|
| 357 |
+
Some transformations based on the properties of the variance may happen:
|
| 358 |
+
|
| 359 |
+
>>> from sympy.abc import a
|
| 360 |
+
>>> Y = Normal("Y", 0, 1)
|
| 361 |
+
>>> Variance(a*X)
|
| 362 |
+
Variance(a*X)
|
| 363 |
+
|
| 364 |
+
To expand the variance in its expression, use ``expand()``:
|
| 365 |
+
|
| 366 |
+
>>> Variance(a*X).expand()
|
| 367 |
+
a**2*Variance(X)
|
| 368 |
+
>>> Variance(X + Y)
|
| 369 |
+
Variance(X + Y)
|
| 370 |
+
>>> Variance(X + Y).expand()
|
| 371 |
+
2*Covariance(X, Y) + Variance(X) + Variance(Y)
|
| 372 |
+
|
| 373 |
+
"""
|
| 374 |
+
def __new__(cls, arg, condition=None, **kwargs):
|
| 375 |
+
arg = _sympify(arg)
|
| 376 |
+
|
| 377 |
+
if arg.is_Matrix:
|
| 378 |
+
from sympy.stats.symbolic_multivariate_probability import VarianceMatrix
|
| 379 |
+
return VarianceMatrix(arg, condition)
|
| 380 |
+
if condition is None:
|
| 381 |
+
obj = Expr.__new__(cls, arg)
|
| 382 |
+
else:
|
| 383 |
+
condition = _sympify(condition)
|
| 384 |
+
obj = Expr.__new__(cls, arg, condition)
|
| 385 |
+
obj._condition = condition
|
| 386 |
+
return obj
|
| 387 |
+
|
| 388 |
+
def expand(self, **hints):
|
| 389 |
+
arg = self.args[0]
|
| 390 |
+
condition = self._condition
|
| 391 |
+
|
| 392 |
+
if not is_random(arg):
|
| 393 |
+
return S.Zero
|
| 394 |
+
|
| 395 |
+
if isinstance(arg, RandomSymbol):
|
| 396 |
+
return self
|
| 397 |
+
elif isinstance(arg, Add):
|
| 398 |
+
rv = []
|
| 399 |
+
for a in arg.args:
|
| 400 |
+
if is_random(a):
|
| 401 |
+
rv.append(a)
|
| 402 |
+
variances = Add(*(Variance(xv, condition).expand() for xv in rv))
|
| 403 |
+
map_to_covar = lambda x: 2*Covariance(*x, condition=condition).expand()
|
| 404 |
+
covariances = Add(*map(map_to_covar, itertools.combinations(rv, 2)))
|
| 405 |
+
return variances + covariances
|
| 406 |
+
elif isinstance(arg, Mul):
|
| 407 |
+
nonrv = []
|
| 408 |
+
rv = []
|
| 409 |
+
for a in arg.args:
|
| 410 |
+
if is_random(a):
|
| 411 |
+
rv.append(a)
|
| 412 |
+
else:
|
| 413 |
+
nonrv.append(a**2)
|
| 414 |
+
if len(rv) == 0:
|
| 415 |
+
return S.Zero
|
| 416 |
+
return Mul.fromiter(nonrv)*Variance(Mul.fromiter(rv), condition)
|
| 417 |
+
|
| 418 |
+
# this expression contains a RandomSymbol somehow:
|
| 419 |
+
return self
|
| 420 |
+
|
| 421 |
+
def _eval_rewrite_as_Expectation(self, arg, condition=None, **kwargs):
|
| 422 |
+
e1 = Expectation(arg**2, condition)
|
| 423 |
+
e2 = Expectation(arg, condition)**2
|
| 424 |
+
return e1 - e2
|
| 425 |
+
|
| 426 |
+
def _eval_rewrite_as_Probability(self, arg, condition=None, **kwargs):
|
| 427 |
+
return self.rewrite(Expectation).rewrite(Probability)
|
| 428 |
+
|
| 429 |
+
def _eval_rewrite_as_Integral(self, arg, condition=None, **kwargs):
|
| 430 |
+
return variance(self.args[0], self._condition, evaluate=False)
|
| 431 |
+
|
| 432 |
+
_eval_rewrite_as_Sum = _eval_rewrite_as_Integral
|
| 433 |
+
|
| 434 |
+
def evaluate_integral(self):
|
| 435 |
+
return self.rewrite(Integral).doit()
|
| 436 |
+
|
| 437 |
+
|
| 438 |
+
class Covariance(Expr):
|
| 439 |
+
"""
|
| 440 |
+
Symbolic expression for the covariance.
|
| 441 |
+
|
| 442 |
+
Examples
|
| 443 |
+
========
|
| 444 |
+
|
| 445 |
+
>>> from sympy.stats import Covariance
|
| 446 |
+
>>> from sympy.stats import Normal
|
| 447 |
+
>>> X = Normal("X", 3, 2)
|
| 448 |
+
>>> Y = Normal("Y", 0, 1)
|
| 449 |
+
>>> Z = Normal("Z", 0, 1)
|
| 450 |
+
>>> W = Normal("W", 0, 1)
|
| 451 |
+
>>> cexpr = Covariance(X, Y)
|
| 452 |
+
>>> cexpr
|
| 453 |
+
Covariance(X, Y)
|
| 454 |
+
|
| 455 |
+
Evaluate the covariance, `X` and `Y` are independent,
|
| 456 |
+
therefore zero is the result:
|
| 457 |
+
|
| 458 |
+
>>> cexpr.evaluate_integral()
|
| 459 |
+
0
|
| 460 |
+
|
| 461 |
+
Rewrite the covariance expression in terms of expectations:
|
| 462 |
+
|
| 463 |
+
>>> from sympy.stats import Expectation
|
| 464 |
+
>>> cexpr.rewrite(Expectation)
|
| 465 |
+
Expectation(X*Y) - Expectation(X)*Expectation(Y)
|
| 466 |
+
|
| 467 |
+
In order to expand the argument, use ``expand()``:
|
| 468 |
+
|
| 469 |
+
>>> from sympy.abc import a, b, c, d
|
| 470 |
+
>>> Covariance(a*X + b*Y, c*Z + d*W)
|
| 471 |
+
Covariance(a*X + b*Y, c*Z + d*W)
|
| 472 |
+
>>> Covariance(a*X + b*Y, c*Z + d*W).expand()
|
| 473 |
+
a*c*Covariance(X, Z) + a*d*Covariance(W, X) + b*c*Covariance(Y, Z) + b*d*Covariance(W, Y)
|
| 474 |
+
|
| 475 |
+
This class is aware of some properties of the covariance:
|
| 476 |
+
|
| 477 |
+
>>> Covariance(X, X).expand()
|
| 478 |
+
Variance(X)
|
| 479 |
+
>>> Covariance(a*X, b*Y).expand()
|
| 480 |
+
a*b*Covariance(X, Y)
|
| 481 |
+
"""
|
| 482 |
+
|
| 483 |
+
def __new__(cls, arg1, arg2, condition=None, **kwargs):
|
| 484 |
+
arg1 = _sympify(arg1)
|
| 485 |
+
arg2 = _sympify(arg2)
|
| 486 |
+
|
| 487 |
+
if arg1.is_Matrix or arg2.is_Matrix:
|
| 488 |
+
from sympy.stats.symbolic_multivariate_probability import CrossCovarianceMatrix
|
| 489 |
+
return CrossCovarianceMatrix(arg1, arg2, condition)
|
| 490 |
+
|
| 491 |
+
if kwargs.pop('evaluate', global_parameters.evaluate):
|
| 492 |
+
arg1, arg2 = sorted([arg1, arg2], key=default_sort_key)
|
| 493 |
+
|
| 494 |
+
if condition is None:
|
| 495 |
+
obj = Expr.__new__(cls, arg1, arg2)
|
| 496 |
+
else:
|
| 497 |
+
condition = _sympify(condition)
|
| 498 |
+
obj = Expr.__new__(cls, arg1, arg2, condition)
|
| 499 |
+
obj._condition = condition
|
| 500 |
+
return obj
|
| 501 |
+
|
| 502 |
+
def expand(self, **hints):
|
| 503 |
+
arg1 = self.args[0]
|
| 504 |
+
arg2 = self.args[1]
|
| 505 |
+
condition = self._condition
|
| 506 |
+
|
| 507 |
+
if arg1 == arg2:
|
| 508 |
+
return Variance(arg1, condition).expand()
|
| 509 |
+
|
| 510 |
+
if not is_random(arg1):
|
| 511 |
+
return S.Zero
|
| 512 |
+
if not is_random(arg2):
|
| 513 |
+
return S.Zero
|
| 514 |
+
|
| 515 |
+
arg1, arg2 = sorted([arg1, arg2], key=default_sort_key)
|
| 516 |
+
|
| 517 |
+
if isinstance(arg1, RandomSymbol) and isinstance(arg2, RandomSymbol):
|
| 518 |
+
return Covariance(arg1, arg2, condition)
|
| 519 |
+
|
| 520 |
+
coeff_rv_list1 = self._expand_single_argument(arg1.expand())
|
| 521 |
+
coeff_rv_list2 = self._expand_single_argument(arg2.expand())
|
| 522 |
+
|
| 523 |
+
addends = [a*b*Covariance(*sorted([r1, r2], key=default_sort_key), condition=condition)
|
| 524 |
+
for (a, r1) in coeff_rv_list1 for (b, r2) in coeff_rv_list2]
|
| 525 |
+
return Add.fromiter(addends)
|
| 526 |
+
|
| 527 |
+
@classmethod
|
| 528 |
+
def _expand_single_argument(cls, expr):
|
| 529 |
+
# return (coefficient, random_symbol) pairs:
|
| 530 |
+
if isinstance(expr, RandomSymbol):
|
| 531 |
+
return [(S.One, expr)]
|
| 532 |
+
elif isinstance(expr, Add):
|
| 533 |
+
outval = []
|
| 534 |
+
for a in expr.args:
|
| 535 |
+
if isinstance(a, Mul):
|
| 536 |
+
outval.append(cls._get_mul_nonrv_rv_tuple(a))
|
| 537 |
+
elif is_random(a):
|
| 538 |
+
outval.append((S.One, a))
|
| 539 |
+
|
| 540 |
+
return outval
|
| 541 |
+
elif isinstance(expr, Mul):
|
| 542 |
+
return [cls._get_mul_nonrv_rv_tuple(expr)]
|
| 543 |
+
elif is_random(expr):
|
| 544 |
+
return [(S.One, expr)]
|
| 545 |
+
|
| 546 |
+
@classmethod
|
| 547 |
+
def _get_mul_nonrv_rv_tuple(cls, m):
|
| 548 |
+
rv = []
|
| 549 |
+
nonrv = []
|
| 550 |
+
for a in m.args:
|
| 551 |
+
if is_random(a):
|
| 552 |
+
rv.append(a)
|
| 553 |
+
else:
|
| 554 |
+
nonrv.append(a)
|
| 555 |
+
return (Mul.fromiter(nonrv), Mul.fromiter(rv))
|
| 556 |
+
|
| 557 |
+
def _eval_rewrite_as_Expectation(self, arg1, arg2, condition=None, **kwargs):
|
| 558 |
+
e1 = Expectation(arg1*arg2, condition)
|
| 559 |
+
e2 = Expectation(arg1, condition)*Expectation(arg2, condition)
|
| 560 |
+
return e1 - e2
|
| 561 |
+
|
| 562 |
+
def _eval_rewrite_as_Probability(self, arg1, arg2, condition=None, **kwargs):
|
| 563 |
+
return self.rewrite(Expectation).rewrite(Probability)
|
| 564 |
+
|
| 565 |
+
def _eval_rewrite_as_Integral(self, arg1, arg2, condition=None, **kwargs):
|
| 566 |
+
return covariance(self.args[0], self.args[1], self._condition, evaluate=False)
|
| 567 |
+
|
| 568 |
+
_eval_rewrite_as_Sum = _eval_rewrite_as_Integral
|
| 569 |
+
|
| 570 |
+
def evaluate_integral(self):
|
| 571 |
+
return self.rewrite(Integral).doit()
|
| 572 |
+
|
| 573 |
+
|
| 574 |
+
class Moment(Expr):
|
| 575 |
+
"""
|
| 576 |
+
Symbolic class for Moment
|
| 577 |
+
|
| 578 |
+
Examples
|
| 579 |
+
========
|
| 580 |
+
|
| 581 |
+
>>> from sympy import Symbol, Integral
|
| 582 |
+
>>> from sympy.stats import Normal, Expectation, Probability, Moment
|
| 583 |
+
>>> mu = Symbol('mu', real=True)
|
| 584 |
+
>>> sigma = Symbol('sigma', positive=True)
|
| 585 |
+
>>> X = Normal('X', mu, sigma)
|
| 586 |
+
>>> M = Moment(X, 3, 1)
|
| 587 |
+
|
| 588 |
+
To evaluate the result of Moment use `doit`:
|
| 589 |
+
|
| 590 |
+
>>> M.doit()
|
| 591 |
+
mu**3 - 3*mu**2 + 3*mu*sigma**2 + 3*mu - 3*sigma**2 - 1
|
| 592 |
+
|
| 593 |
+
Rewrite the Moment expression in terms of Expectation:
|
| 594 |
+
|
| 595 |
+
>>> M.rewrite(Expectation)
|
| 596 |
+
Expectation((X - 1)**3)
|
| 597 |
+
|
| 598 |
+
Rewrite the Moment expression in terms of Probability:
|
| 599 |
+
|
| 600 |
+
>>> M.rewrite(Probability)
|
| 601 |
+
Integral((x - 1)**3*Probability(Eq(X, x)), (x, -oo, oo))
|
| 602 |
+
|
| 603 |
+
Rewrite the Moment expression in terms of Integral:
|
| 604 |
+
|
| 605 |
+
>>> M.rewrite(Integral)
|
| 606 |
+
Integral(sqrt(2)*(X - 1)**3*exp(-(X - mu)**2/(2*sigma**2))/(2*sqrt(pi)*sigma), (X, -oo, oo))
|
| 607 |
+
|
| 608 |
+
"""
|
| 609 |
+
def __new__(cls, X, n, c=0, condition=None, **kwargs):
|
| 610 |
+
X = _sympify(X)
|
| 611 |
+
n = _sympify(n)
|
| 612 |
+
c = _sympify(c)
|
| 613 |
+
if condition is not None:
|
| 614 |
+
condition = _sympify(condition)
|
| 615 |
+
return super().__new__(cls, X, n, c, condition)
|
| 616 |
+
else:
|
| 617 |
+
return super().__new__(cls, X, n, c)
|
| 618 |
+
|
| 619 |
+
def doit(self, **hints):
|
| 620 |
+
return self.rewrite(Expectation).doit(**hints)
|
| 621 |
+
|
| 622 |
+
def _eval_rewrite_as_Expectation(self, X, n, c=0, condition=None, **kwargs):
|
| 623 |
+
return Expectation((X - c)**n, condition)
|
| 624 |
+
|
| 625 |
+
def _eval_rewrite_as_Probability(self, X, n, c=0, condition=None, **kwargs):
|
| 626 |
+
return self.rewrite(Expectation).rewrite(Probability)
|
| 627 |
+
|
| 628 |
+
def _eval_rewrite_as_Integral(self, X, n, c=0, condition=None, **kwargs):
|
| 629 |
+
return self.rewrite(Expectation).rewrite(Integral)
|
| 630 |
+
|
| 631 |
+
|
| 632 |
+
class CentralMoment(Expr):
|
| 633 |
+
"""
|
| 634 |
+
Symbolic class Central Moment
|
| 635 |
+
|
| 636 |
+
Examples
|
| 637 |
+
========
|
| 638 |
+
|
| 639 |
+
>>> from sympy import Symbol, Integral
|
| 640 |
+
>>> from sympy.stats import Normal, Expectation, Probability, CentralMoment
|
| 641 |
+
>>> mu = Symbol('mu', real=True)
|
| 642 |
+
>>> sigma = Symbol('sigma', positive=True)
|
| 643 |
+
>>> X = Normal('X', mu, sigma)
|
| 644 |
+
>>> CM = CentralMoment(X, 4)
|
| 645 |
+
|
| 646 |
+
To evaluate the result of CentralMoment use `doit`:
|
| 647 |
+
|
| 648 |
+
>>> CM.doit().simplify()
|
| 649 |
+
3*sigma**4
|
| 650 |
+
|
| 651 |
+
Rewrite the CentralMoment expression in terms of Expectation:
|
| 652 |
+
|
| 653 |
+
>>> CM.rewrite(Expectation)
|
| 654 |
+
Expectation((X - Expectation(X))**4)
|
| 655 |
+
|
| 656 |
+
Rewrite the CentralMoment expression in terms of Probability:
|
| 657 |
+
|
| 658 |
+
>>> CM.rewrite(Probability)
|
| 659 |
+
Integral((x - Integral(x*Probability(True), (x, -oo, oo)))**4*Probability(Eq(X, x)), (x, -oo, oo))
|
| 660 |
+
|
| 661 |
+
Rewrite the CentralMoment expression in terms of Integral:
|
| 662 |
+
|
| 663 |
+
>>> CM.rewrite(Integral)
|
| 664 |
+
Integral(sqrt(2)*(X - Integral(sqrt(2)*X*exp(-(X - mu)**2/(2*sigma**2))/(2*sqrt(pi)*sigma), (X, -oo, oo)))**4*exp(-(X - mu)**2/(2*sigma**2))/(2*sqrt(pi)*sigma), (X, -oo, oo))
|
| 665 |
+
|
| 666 |
+
"""
|
| 667 |
+
def __new__(cls, X, n, condition=None, **kwargs):
|
| 668 |
+
X = _sympify(X)
|
| 669 |
+
n = _sympify(n)
|
| 670 |
+
if condition is not None:
|
| 671 |
+
condition = _sympify(condition)
|
| 672 |
+
return super().__new__(cls, X, n, condition)
|
| 673 |
+
else:
|
| 674 |
+
return super().__new__(cls, X, n)
|
| 675 |
+
|
| 676 |
+
def doit(self, **hints):
|
| 677 |
+
return self.rewrite(Expectation).doit(**hints)
|
| 678 |
+
|
| 679 |
+
def _eval_rewrite_as_Expectation(self, X, n, condition=None, **kwargs):
|
| 680 |
+
mu = Expectation(X, condition, **kwargs)
|
| 681 |
+
return Moment(X, n, mu, condition, **kwargs).rewrite(Expectation)
|
| 682 |
+
|
| 683 |
+
def _eval_rewrite_as_Probability(self, X, n, condition=None, **kwargs):
|
| 684 |
+
return self.rewrite(Expectation).rewrite(Probability)
|
| 685 |
+
|
| 686 |
+
def _eval_rewrite_as_Integral(self, X, n, condition=None, **kwargs):
|
| 687 |
+
return self.rewrite(Expectation).rewrite(Integral)
|
shared/package-files/9b/9b542cdd392345b80afdab68e0f7056548da6fee5a1315a7bf918d1b54bd957b/blob
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .optimizer import Optimizer, ParamsT
|
| 2 |
+
|
| 3 |
+
class Adadelta(Optimizer):
|
| 4 |
+
def __init__(
|
| 5 |
+
self,
|
| 6 |
+
params: ParamsT,
|
| 7 |
+
lr: float = ...,
|
| 8 |
+
rho: float = ...,
|
| 9 |
+
eps: float = ...,
|
| 10 |
+
weight_decay: float = ...,
|
| 11 |
+
) -> None: ...
|
shared/package-files/9b/9b5b3703806bbd17835f93e58836a5639dd884f7ef875b3ec7879f6b57e521a1/blob
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""A variety of linear models."""
|
| 2 |
+
|
| 3 |
+
# Authors: The scikit-learn developers
|
| 4 |
+
# SPDX-License-Identifier: BSD-3-Clause
|
| 5 |
+
|
| 6 |
+
# See http://scikit-learn.sourceforge.net/modules/sgd.html and
|
| 7 |
+
# http://scikit-learn.sourceforge.net/modules/linear_model.html for
|
| 8 |
+
# complete documentation.
|
| 9 |
+
|
| 10 |
+
from ._base import LinearRegression
|
| 11 |
+
from ._bayes import ARDRegression, BayesianRidge
|
| 12 |
+
from ._coordinate_descent import (
|
| 13 |
+
ElasticNet,
|
| 14 |
+
ElasticNetCV,
|
| 15 |
+
Lasso,
|
| 16 |
+
LassoCV,
|
| 17 |
+
MultiTaskElasticNet,
|
| 18 |
+
MultiTaskElasticNetCV,
|
| 19 |
+
MultiTaskLasso,
|
| 20 |
+
MultiTaskLassoCV,
|
| 21 |
+
enet_path,
|
| 22 |
+
lasso_path,
|
| 23 |
+
)
|
| 24 |
+
from ._glm import GammaRegressor, PoissonRegressor, TweedieRegressor
|
| 25 |
+
from ._huber import HuberRegressor
|
| 26 |
+
from ._least_angle import (
|
| 27 |
+
Lars,
|
| 28 |
+
LarsCV,
|
| 29 |
+
LassoLars,
|
| 30 |
+
LassoLarsCV,
|
| 31 |
+
LassoLarsIC,
|
| 32 |
+
lars_path,
|
| 33 |
+
lars_path_gram,
|
| 34 |
+
)
|
| 35 |
+
from ._logistic import LogisticRegression, LogisticRegressionCV
|
| 36 |
+
from ._omp import (
|
| 37 |
+
OrthogonalMatchingPursuit,
|
| 38 |
+
OrthogonalMatchingPursuitCV,
|
| 39 |
+
orthogonal_mp,
|
| 40 |
+
orthogonal_mp_gram,
|
| 41 |
+
)
|
| 42 |
+
from ._passive_aggressive import PassiveAggressiveClassifier, PassiveAggressiveRegressor
|
| 43 |
+
from ._perceptron import Perceptron
|
| 44 |
+
from ._quantile import QuantileRegressor
|
| 45 |
+
from ._ransac import RANSACRegressor
|
| 46 |
+
from ._ridge import Ridge, RidgeClassifier, RidgeClassifierCV, RidgeCV, ridge_regression
|
| 47 |
+
from ._stochastic_gradient import SGDClassifier, SGDOneClassSVM, SGDRegressor
|
| 48 |
+
from ._theil_sen import TheilSenRegressor
|
| 49 |
+
|
| 50 |
+
__all__ = [
|
| 51 |
+
"ARDRegression",
|
| 52 |
+
"BayesianRidge",
|
| 53 |
+
"ElasticNet",
|
| 54 |
+
"ElasticNetCV",
|
| 55 |
+
"GammaRegressor",
|
| 56 |
+
"HuberRegressor",
|
| 57 |
+
"Lars",
|
| 58 |
+
"LarsCV",
|
| 59 |
+
"Lasso",
|
| 60 |
+
"LassoCV",
|
| 61 |
+
"LassoLars",
|
| 62 |
+
"LassoLarsCV",
|
| 63 |
+
"LassoLarsIC",
|
| 64 |
+
"LinearRegression",
|
| 65 |
+
"LogisticRegression",
|
| 66 |
+
"LogisticRegressionCV",
|
| 67 |
+
"MultiTaskElasticNet",
|
| 68 |
+
"MultiTaskElasticNetCV",
|
| 69 |
+
"MultiTaskLasso",
|
| 70 |
+
"MultiTaskLassoCV",
|
| 71 |
+
"OrthogonalMatchingPursuit",
|
| 72 |
+
"OrthogonalMatchingPursuitCV",
|
| 73 |
+
"PassiveAggressiveClassifier",
|
| 74 |
+
"PassiveAggressiveRegressor",
|
| 75 |
+
"Perceptron",
|
| 76 |
+
"PoissonRegressor",
|
| 77 |
+
"QuantileRegressor",
|
| 78 |
+
"RANSACRegressor",
|
| 79 |
+
"Ridge",
|
| 80 |
+
"RidgeCV",
|
| 81 |
+
"RidgeClassifier",
|
| 82 |
+
"RidgeClassifierCV",
|
| 83 |
+
"SGDClassifier",
|
| 84 |
+
"SGDOneClassSVM",
|
| 85 |
+
"SGDRegressor",
|
| 86 |
+
"TheilSenRegressor",
|
| 87 |
+
"TweedieRegressor",
|
| 88 |
+
"enet_path",
|
| 89 |
+
"lars_path",
|
| 90 |
+
"lars_path_gram",
|
| 91 |
+
"lasso_path",
|
| 92 |
+
"orthogonal_mp",
|
| 93 |
+
"orthogonal_mp_gram",
|
| 94 |
+
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from typing import TYPE_CHECKING, Any
|
| 4 |
+
|
| 5 |
+
from narwhals._compliant.any_namespace import StringNamespace
|
| 6 |
+
from narwhals._pandas_like.utils import (
|
| 7 |
+
PandasLikeSeriesNamespace,
|
| 8 |
+
align_and_extract_native,
|
| 9 |
+
get_dtype_backend,
|
| 10 |
+
is_dtype_pyarrow,
|
| 11 |
+
)
|
| 12 |
+
from narwhals._utils import str_slice_stop
|
| 13 |
+
|
| 14 |
+
if TYPE_CHECKING:
|
| 15 |
+
from narwhals._pandas_like.series import PandasLikeSeries
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class PandasLikeSeriesStringNamespace(
|
| 19 |
+
PandasLikeSeriesNamespace, StringNamespace["PandasLikeSeries"]
|
| 20 |
+
):
|
| 21 |
+
def _with_native_bool(self, result: Any) -> PandasLikeSeries:
|
| 22 |
+
# See https://narwhals-dev.github.io/narwhals/concepts/boolean/.
|
| 23 |
+
if (
|
| 24 |
+
result.dtype == object
|
| 25 |
+
and get_dtype_backend(self.native.dtype, self.implementation) is None
|
| 26 |
+
):
|
| 27 |
+
not_na = result.notna()
|
| 28 |
+
all_valid = not_na.all()
|
| 29 |
+
if not all_valid and self.implementation._backend_version() < (3,):
|
| 30 |
+
result.where(not_na, False, inplace=True)
|
| 31 |
+
result = result.astype(bool, copy=False)
|
| 32 |
+
elif not all_valid:
|
| 33 |
+
result = result.where(not_na, False).astype(bool)
|
| 34 |
+
else: # pragma: no cover
|
| 35 |
+
pass
|
| 36 |
+
return self.with_native(result)
|
| 37 |
+
|
| 38 |
+
def len_chars(self) -> PandasLikeSeries:
|
| 39 |
+
result = self.native.str.len()
|
| 40 |
+
if result.dtype == object:
|
| 41 |
+
# pandas returns `object` instead of a number for an all-null `object` column.
|
| 42 |
+
result = self.implementation.to_native_namespace().to_numeric(result)
|
| 43 |
+
return self.with_native(result)
|
| 44 |
+
|
| 45 |
+
def replace(
|
| 46 |
+
self, value: PandasLikeSeries, pattern: str, *, literal: bool, n: int
|
| 47 |
+
) -> PandasLikeSeries:
|
| 48 |
+
if n == 0:
|
| 49 |
+
return self.compliant
|
| 50 |
+
_, value_native = align_and_extract_native(self.compliant, value)
|
| 51 |
+
if not isinstance(value_native, str):
|
| 52 |
+
msg = f"{self.compliant._implementation} backed `.str.replace` only supports str replacement values"
|
| 53 |
+
raise TypeError(msg)
|
| 54 |
+
series = self.native.str.replace(
|
| 55 |
+
pat=pattern, repl=value_native, n=n, regex=not literal
|
| 56 |
+
)
|
| 57 |
+
return self.with_native(series)
|
| 58 |
+
|
| 59 |
+
def replace_all(
|
| 60 |
+
self, value: PandasLikeSeries, pattern: str, *, literal: bool
|
| 61 |
+
) -> PandasLikeSeries:
|
| 62 |
+
return self.replace(value, pattern, literal=literal, n=-1)
|
| 63 |
+
|
| 64 |
+
def strip_chars(self, characters: str | None) -> PandasLikeSeries:
|
| 65 |
+
return self.with_native(self.native.str.strip(characters))
|
| 66 |
+
|
| 67 |
+
def strip_chars_start(self, characters: str) -> PandasLikeSeries:
|
| 68 |
+
return self.with_native(self.native.str.lstrip(characters))
|
| 69 |
+
|
| 70 |
+
def strip_chars_end(self, characters: str) -> PandasLikeSeries:
|
| 71 |
+
return self.with_native(self.native.str.rstrip(characters))
|
| 72 |
+
|
| 73 |
+
def starts_with(self, prefix: PandasLikeSeries) -> PandasLikeSeries:
|
| 74 |
+
_, prefix_native = align_and_extract_native(self.compliant, prefix)
|
| 75 |
+
if not isinstance(prefix_native, str):
|
| 76 |
+
msg = f"`.str.starts_with` only supports prefix values for {self.compliant._implementation} backend"
|
| 77 |
+
raise TypeError(msg)
|
| 78 |
+
return self._with_native_bool(self.native.str.startswith(prefix_native))
|
| 79 |
+
|
| 80 |
+
def ends_with(self, suffix: PandasLikeSeries) -> PandasLikeSeries:
|
| 81 |
+
_, suffix_native = align_and_extract_native(self.compliant, suffix)
|
| 82 |
+
if not isinstance(suffix_native, str):
|
| 83 |
+
msg = f"`.str.ends_with` only supports suffix values for {self.compliant._implementation} backend"
|
| 84 |
+
raise TypeError(msg)
|
| 85 |
+
return self._with_native_bool(self.native.str.endswith(suffix_native))
|
| 86 |
+
|
| 87 |
+
def contains(self, pattern: PandasLikeSeries, *, literal: bool) -> PandasLikeSeries:
|
| 88 |
+
_, pattern_native = align_and_extract_native(self.compliant, pattern)
|
| 89 |
+
if not isinstance(pattern_native, str):
|
| 90 |
+
msg = f"`.str.contains` only supports str pattern values for {self.compliant._implementation} backend"
|
| 91 |
+
raise TypeError(msg)
|
| 92 |
+
return self._with_native_bool(
|
| 93 |
+
self.native.str.contains(pat=pattern_native, regex=not literal)
|
| 94 |
+
)
|
| 95 |
+
|
| 96 |
+
def slice(self, offset: int, length: int | None) -> PandasLikeSeries:
|
| 97 |
+
stop = str_slice_stop(offset, length)
|
| 98 |
+
return self.with_native(self.native.str.slice(start=offset, stop=stop))
|
| 99 |
+
|
| 100 |
+
def split(self, by: str) -> PandasLikeSeries:
|
| 101 |
+
implementation = self.implementation
|
| 102 |
+
if not implementation.is_cudf() and not is_dtype_pyarrow(self.native.dtype):
|
| 103 |
+
msg = (
|
| 104 |
+
"This operation requires a pyarrow-backed series. "
|
| 105 |
+
"Please refer to https://narwhals-dev.github.io/narwhals/api-reference/narwhals/#narwhals.maybe_convert_dtypes "
|
| 106 |
+
"and ensure you are using dtype_backend='pyarrow'. "
|
| 107 |
+
"Additionally, make sure you have pandas version 1.5+ and pyarrow installed. "
|
| 108 |
+
)
|
| 109 |
+
raise TypeError(msg)
|
| 110 |
+
return self.with_native(self.native.str.split(pat=by))
|
| 111 |
+
|
| 112 |
+
def to_datetime(self, format: str | None) -> PandasLikeSeries:
|
| 113 |
+
# If we know inputs are timezone-aware, we can pass `utc=True` for better performance.
|
| 114 |
+
if format and any(x in format for x in ("%z", "Z")):
|
| 115 |
+
return self.with_native(self._to_datetime(format, utc=True))
|
| 116 |
+
result = self.with_native(self._to_datetime(format, utc=False))
|
| 117 |
+
if (tz := getattr(result.dtype, "time_zone", None)) and tz != "UTC":
|
| 118 |
+
return result.dt.convert_time_zone("UTC")
|
| 119 |
+
return result
|
| 120 |
+
|
| 121 |
+
def _to_datetime(self, format: str | None, *, utc: bool) -> Any:
|
| 122 |
+
result = self.implementation.to_native_namespace().to_datetime(
|
| 123 |
+
self.native, format=format, utc=utc
|
| 124 |
+
)
|
| 125 |
+
return (
|
| 126 |
+
result.convert_dtypes(dtype_backend="pyarrow")
|
| 127 |
+
if is_dtype_pyarrow(self.native.dtype)
|
| 128 |
+
else result
|
| 129 |
+
)
|
| 130 |
+
|
| 131 |
+
def to_date(self, format: str | None) -> PandasLikeSeries:
|
| 132 |
+
return self.to_datetime(format=format).dt.date()
|
| 133 |
+
|
| 134 |
+
def to_time(self, format: str | None) -> PandasLikeSeries:
|
| 135 |
+
time_dtype = self.version.dtypes.Time()
|
| 136 |
+
return self.with_native(self._to_datetime(format, utc=False)).cast(time_dtype)
|
| 137 |
+
|
| 138 |
+
def to_uppercase(self) -> PandasLikeSeries:
|
| 139 |
+
return self.with_native(self.native.str.upper())
|
| 140 |
+
|
| 141 |
+
def to_lowercase(self) -> PandasLikeSeries:
|
| 142 |
+
return self.with_native(self.native.str.lower())
|
| 143 |
+
|
| 144 |
+
def to_titlecase(self) -> PandasLikeSeries:
|
| 145 |
+
return self.with_native(self.native.str.title())
|
| 146 |
+
|
| 147 |
+
def zfill(self, width: int) -> PandasLikeSeries:
|
| 148 |
+
if width == 0:
|
| 149 |
+
return self.compliant
|
| 150 |
+
return self.with_native(self.native.str.zfill(width))
|
| 151 |
+
|
| 152 |
+
def pad_start(self, length: int, fill_char: str) -> PandasLikeSeries:
|
| 153 |
+
return self.with_native(
|
| 154 |
+
self.native.str.pad(width=length, fillchar=fill_char, side="left")
|
| 155 |
+
)
|
| 156 |
+
|
| 157 |
+
def pad_end(self, length: int, fill_char: str) -> PandasLikeSeries:
|
| 158 |
+
return self.with_native(
|
| 159 |
+
self.native.str.pad(width=length, fillchar=fill_char, side="right")
|
| 160 |
+
)
|
shared/package-files/9b/9b633e2d6aa5d803d19bb099de8163f7b49408a1bfaea3fe3e7d519e15dda808/blob
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 ldexp_Tensor {
|
| 18 |
+
using schema = at::Tensor (const at::Tensor &, const at::Tensor &);
|
| 19 |
+
using ptr_schema = schema*;
|
| 20 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 21 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::ldexp")
|
| 22 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "Tensor")
|
| 23 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "ldexp.Tensor(Tensor self, Tensor other) -> Tensor")
|
| 24 |
+
static at::Tensor call(const at::Tensor & self, const at::Tensor & other);
|
| 25 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Tensor & other);
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
struct TORCH_API ldexp_ {
|
| 29 |
+
using schema = at::Tensor & (at::Tensor &, const 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::ldexp_")
|
| 33 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
|
| 34 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "ldexp_(Tensor(a!) self, Tensor other) -> Tensor(a!)")
|
| 35 |
+
static at::Tensor & call(at::Tensor & self, const at::Tensor & other);
|
| 36 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, at::Tensor & self, const at::Tensor & other);
|
| 37 |
+
};
|
| 38 |
+
|
| 39 |
+
struct TORCH_API ldexp_out {
|
| 40 |
+
using schema = at::Tensor & (const at::Tensor &, const at::Tensor &, at::Tensor &);
|
| 41 |
+
using ptr_schema = schema*;
|
| 42 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 43 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::ldexp")
|
| 44 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out")
|
| 45 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "ldexp.out(Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)")
|
| 46 |
+
static at::Tensor & call(const at::Tensor & self, const at::Tensor & other, at::Tensor & out);
|
| 47 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Tensor & other, at::Tensor & out);
|
| 48 |
+
};
|
| 49 |
+
|
| 50 |
+
}} // namespace at::_ops
|
shared/package-files/9b/9b65eeebf6d708da9966136f37d3d3eef925cdce7587f22da457eeee1f8ba83e/blob
ADDED
|
@@ -0,0 +1,557 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import ctypes
|
| 4 |
+
import re
|
| 5 |
+
from typing import Any
|
| 6 |
+
|
| 7 |
+
import numpy as np
|
| 8 |
+
|
| 9 |
+
from pandas._config import using_string_dtype
|
| 10 |
+
|
| 11 |
+
from pandas.compat._optional import import_optional_dependency
|
| 12 |
+
from pandas.errors import SettingWithCopyError
|
| 13 |
+
|
| 14 |
+
import pandas as pd
|
| 15 |
+
from pandas.core.interchange.dataframe_protocol import (
|
| 16 |
+
Buffer,
|
| 17 |
+
Column,
|
| 18 |
+
ColumnNullType,
|
| 19 |
+
DataFrame as DataFrameXchg,
|
| 20 |
+
DtypeKind,
|
| 21 |
+
)
|
| 22 |
+
from pandas.core.interchange.utils import (
|
| 23 |
+
ArrowCTypes,
|
| 24 |
+
Endianness,
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
_NP_DTYPES: dict[DtypeKind, dict[int, Any]] = {
|
| 28 |
+
DtypeKind.INT: {8: np.int8, 16: np.int16, 32: np.int32, 64: np.int64},
|
| 29 |
+
DtypeKind.UINT: {8: np.uint8, 16: np.uint16, 32: np.uint32, 64: np.uint64},
|
| 30 |
+
DtypeKind.FLOAT: {32: np.float32, 64: np.float64},
|
| 31 |
+
DtypeKind.BOOL: {1: bool, 8: bool},
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def from_dataframe(df, allow_copy: bool = True) -> pd.DataFrame:
|
| 36 |
+
"""
|
| 37 |
+
Build a ``pd.DataFrame`` from any DataFrame supporting the interchange protocol.
|
| 38 |
+
|
| 39 |
+
.. note::
|
| 40 |
+
|
| 41 |
+
For new development, we highly recommend using the Arrow C Data Interface
|
| 42 |
+
alongside the Arrow PyCapsule Interface instead of the interchange protocol.
|
| 43 |
+
From pandas 2.3 onwards, `from_dataframe` uses the PyCapsule Interface,
|
| 44 |
+
only falling back to the interchange protocol if that fails.
|
| 45 |
+
|
| 46 |
+
.. warning::
|
| 47 |
+
|
| 48 |
+
Due to severe implementation issues, we recommend only considering using the
|
| 49 |
+
interchange protocol in the following cases:
|
| 50 |
+
|
| 51 |
+
- converting to pandas: for pandas >= 2.0.3
|
| 52 |
+
- converting from pandas: for pandas >= 3.0.0
|
| 53 |
+
|
| 54 |
+
Parameters
|
| 55 |
+
----------
|
| 56 |
+
df : DataFrameXchg
|
| 57 |
+
Object supporting the interchange protocol, i.e. `__dataframe__` method.
|
| 58 |
+
allow_copy : bool, default: True
|
| 59 |
+
Whether to allow copying the memory to perform the conversion
|
| 60 |
+
(if false then zero-copy approach is requested).
|
| 61 |
+
|
| 62 |
+
Returns
|
| 63 |
+
-------
|
| 64 |
+
pd.DataFrame
|
| 65 |
+
|
| 66 |
+
Examples
|
| 67 |
+
--------
|
| 68 |
+
>>> df_not_necessarily_pandas = pd.DataFrame({'A': [1, 2], 'B': [3, 4]})
|
| 69 |
+
>>> interchange_object = df_not_necessarily_pandas.__dataframe__()
|
| 70 |
+
>>> interchange_object.column_names()
|
| 71 |
+
Index(['A', 'B'], dtype='object')
|
| 72 |
+
>>> df_pandas = (pd.api.interchange.from_dataframe
|
| 73 |
+
... (interchange_object.select_columns_by_name(['A'])))
|
| 74 |
+
>>> df_pandas
|
| 75 |
+
A
|
| 76 |
+
0 1
|
| 77 |
+
1 2
|
| 78 |
+
|
| 79 |
+
These methods (``column_names``, ``select_columns_by_name``) should work
|
| 80 |
+
for any dataframe library which implements the interchange protocol.
|
| 81 |
+
"""
|
| 82 |
+
if isinstance(df, pd.DataFrame):
|
| 83 |
+
return df
|
| 84 |
+
|
| 85 |
+
if hasattr(df, "__arrow_c_stream__"):
|
| 86 |
+
try:
|
| 87 |
+
pa = import_optional_dependency("pyarrow", min_version="14.0.0")
|
| 88 |
+
except ImportError:
|
| 89 |
+
# fallback to _from_dataframe
|
| 90 |
+
pass
|
| 91 |
+
else:
|
| 92 |
+
try:
|
| 93 |
+
return pa.table(df).to_pandas(zero_copy_only=not allow_copy)
|
| 94 |
+
except pa.ArrowInvalid as e:
|
| 95 |
+
raise RuntimeError(e) from e
|
| 96 |
+
|
| 97 |
+
if not hasattr(df, "__dataframe__"):
|
| 98 |
+
raise ValueError("`df` does not support __dataframe__")
|
| 99 |
+
|
| 100 |
+
return _from_dataframe(
|
| 101 |
+
df.__dataframe__(allow_copy=allow_copy), allow_copy=allow_copy
|
| 102 |
+
)
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
def _from_dataframe(df: DataFrameXchg, allow_copy: bool = True):
|
| 106 |
+
"""
|
| 107 |
+
Build a ``pd.DataFrame`` from the DataFrame interchange object.
|
| 108 |
+
|
| 109 |
+
Parameters
|
| 110 |
+
----------
|
| 111 |
+
df : DataFrameXchg
|
| 112 |
+
Object supporting the interchange protocol, i.e. `__dataframe__` method.
|
| 113 |
+
allow_copy : bool, default: True
|
| 114 |
+
Whether to allow copying the memory to perform the conversion
|
| 115 |
+
(if false then zero-copy approach is requested).
|
| 116 |
+
|
| 117 |
+
Returns
|
| 118 |
+
-------
|
| 119 |
+
pd.DataFrame
|
| 120 |
+
"""
|
| 121 |
+
pandas_dfs = []
|
| 122 |
+
for chunk in df.get_chunks():
|
| 123 |
+
pandas_df = protocol_df_chunk_to_pandas(chunk)
|
| 124 |
+
pandas_dfs.append(pandas_df)
|
| 125 |
+
|
| 126 |
+
if not allow_copy and len(pandas_dfs) > 1:
|
| 127 |
+
raise RuntimeError(
|
| 128 |
+
"To join chunks a copy is required which is forbidden by allow_copy=False"
|
| 129 |
+
)
|
| 130 |
+
if not pandas_dfs:
|
| 131 |
+
pandas_df = protocol_df_chunk_to_pandas(df)
|
| 132 |
+
elif len(pandas_dfs) == 1:
|
| 133 |
+
pandas_df = pandas_dfs[0]
|
| 134 |
+
else:
|
| 135 |
+
pandas_df = pd.concat(pandas_dfs, axis=0, ignore_index=True, copy=False)
|
| 136 |
+
|
| 137 |
+
index_obj = df.metadata.get("pandas.index", None)
|
| 138 |
+
if index_obj is not None:
|
| 139 |
+
pandas_df.index = index_obj
|
| 140 |
+
|
| 141 |
+
return pandas_df
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
def protocol_df_chunk_to_pandas(df: DataFrameXchg) -> pd.DataFrame:
|
| 145 |
+
"""
|
| 146 |
+
Convert interchange protocol chunk to ``pd.DataFrame``.
|
| 147 |
+
|
| 148 |
+
Parameters
|
| 149 |
+
----------
|
| 150 |
+
df : DataFrameXchg
|
| 151 |
+
|
| 152 |
+
Returns
|
| 153 |
+
-------
|
| 154 |
+
pd.DataFrame
|
| 155 |
+
"""
|
| 156 |
+
columns: dict[str, Any] = {}
|
| 157 |
+
buffers = [] # hold on to buffers, keeps memory alive
|
| 158 |
+
for name in df.column_names():
|
| 159 |
+
if not isinstance(name, str):
|
| 160 |
+
raise ValueError(f"Column {name} is not a string")
|
| 161 |
+
if name in columns:
|
| 162 |
+
raise ValueError(f"Column {name} is not unique")
|
| 163 |
+
col = df.get_column_by_name(name)
|
| 164 |
+
dtype = col.dtype[0]
|
| 165 |
+
if dtype in (
|
| 166 |
+
DtypeKind.INT,
|
| 167 |
+
DtypeKind.UINT,
|
| 168 |
+
DtypeKind.FLOAT,
|
| 169 |
+
DtypeKind.BOOL,
|
| 170 |
+
):
|
| 171 |
+
columns[name], buf = primitive_column_to_ndarray(col)
|
| 172 |
+
elif dtype == DtypeKind.CATEGORICAL:
|
| 173 |
+
columns[name], buf = categorical_column_to_series(col)
|
| 174 |
+
elif dtype == DtypeKind.STRING:
|
| 175 |
+
columns[name], buf = string_column_to_ndarray(col)
|
| 176 |
+
elif dtype == DtypeKind.DATETIME:
|
| 177 |
+
columns[name], buf = datetime_column_to_ndarray(col)
|
| 178 |
+
else:
|
| 179 |
+
raise NotImplementedError(f"Data type {dtype} not handled yet")
|
| 180 |
+
|
| 181 |
+
buffers.append(buf)
|
| 182 |
+
|
| 183 |
+
pandas_df = pd.DataFrame(columns)
|
| 184 |
+
pandas_df.attrs["_INTERCHANGE_PROTOCOL_BUFFERS"] = buffers
|
| 185 |
+
return pandas_df
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
def primitive_column_to_ndarray(col: Column) -> tuple[np.ndarray, Any]:
|
| 189 |
+
"""
|
| 190 |
+
Convert a column holding one of the primitive dtypes to a NumPy array.
|
| 191 |
+
|
| 192 |
+
A primitive type is one of: int, uint, float, bool.
|
| 193 |
+
|
| 194 |
+
Parameters
|
| 195 |
+
----------
|
| 196 |
+
col : Column
|
| 197 |
+
|
| 198 |
+
Returns
|
| 199 |
+
-------
|
| 200 |
+
tuple
|
| 201 |
+
Tuple of np.ndarray holding the data and the memory owner object
|
| 202 |
+
that keeps the memory alive.
|
| 203 |
+
"""
|
| 204 |
+
buffers = col.get_buffers()
|
| 205 |
+
|
| 206 |
+
data_buff, data_dtype = buffers["data"]
|
| 207 |
+
data = buffer_to_ndarray(
|
| 208 |
+
data_buff, data_dtype, offset=col.offset, length=col.size()
|
| 209 |
+
)
|
| 210 |
+
|
| 211 |
+
data = set_nulls(data, col, buffers["validity"])
|
| 212 |
+
return data, buffers
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
def categorical_column_to_series(col: Column) -> tuple[pd.Series, Any]:
|
| 216 |
+
"""
|
| 217 |
+
Convert a column holding categorical data to a pandas Series.
|
| 218 |
+
|
| 219 |
+
Parameters
|
| 220 |
+
----------
|
| 221 |
+
col : Column
|
| 222 |
+
|
| 223 |
+
Returns
|
| 224 |
+
-------
|
| 225 |
+
tuple
|
| 226 |
+
Tuple of pd.Series holding the data and the memory owner object
|
| 227 |
+
that keeps the memory alive.
|
| 228 |
+
"""
|
| 229 |
+
categorical = col.describe_categorical
|
| 230 |
+
|
| 231 |
+
if not categorical["is_dictionary"]:
|
| 232 |
+
raise NotImplementedError("Non-dictionary categoricals not supported yet")
|
| 233 |
+
|
| 234 |
+
cat_column = categorical["categories"]
|
| 235 |
+
if hasattr(cat_column, "_col"):
|
| 236 |
+
# Item "Column" of "Optional[Column]" has no attribute "_col"
|
| 237 |
+
# Item "None" of "Optional[Column]" has no attribute "_col"
|
| 238 |
+
categories = np.array(cat_column._col) # type: ignore[union-attr]
|
| 239 |
+
else:
|
| 240 |
+
raise NotImplementedError(
|
| 241 |
+
"Interchanging categorical columns isn't supported yet, and our "
|
| 242 |
+
"fallback of using the `col._col` attribute (a ndarray) failed."
|
| 243 |
+
)
|
| 244 |
+
buffers = col.get_buffers()
|
| 245 |
+
|
| 246 |
+
codes_buff, codes_dtype = buffers["data"]
|
| 247 |
+
codes = buffer_to_ndarray(
|
| 248 |
+
codes_buff, codes_dtype, offset=col.offset, length=col.size()
|
| 249 |
+
)
|
| 250 |
+
|
| 251 |
+
# Doing module in order to not get ``IndexError`` for
|
| 252 |
+
# out-of-bounds sentinel values in `codes`
|
| 253 |
+
if len(categories) > 0:
|
| 254 |
+
values = categories[codes % len(categories)]
|
| 255 |
+
else:
|
| 256 |
+
values = codes
|
| 257 |
+
|
| 258 |
+
cat = pd.Categorical(
|
| 259 |
+
values, categories=categories, ordered=categorical["is_ordered"]
|
| 260 |
+
)
|
| 261 |
+
data = pd.Series(cat)
|
| 262 |
+
|
| 263 |
+
data = set_nulls(data, col, buffers["validity"])
|
| 264 |
+
return data, buffers
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
def string_column_to_ndarray(col: Column) -> tuple[np.ndarray, Any]:
|
| 268 |
+
"""
|
| 269 |
+
Convert a column holding string data to a NumPy array.
|
| 270 |
+
|
| 271 |
+
Parameters
|
| 272 |
+
----------
|
| 273 |
+
col : Column
|
| 274 |
+
|
| 275 |
+
Returns
|
| 276 |
+
-------
|
| 277 |
+
tuple
|
| 278 |
+
Tuple of np.ndarray holding the data and the memory owner object
|
| 279 |
+
that keeps the memory alive.
|
| 280 |
+
"""
|
| 281 |
+
null_kind, sentinel_val = col.describe_null
|
| 282 |
+
|
| 283 |
+
if null_kind not in (
|
| 284 |
+
ColumnNullType.NON_NULLABLE,
|
| 285 |
+
ColumnNullType.USE_BITMASK,
|
| 286 |
+
ColumnNullType.USE_BYTEMASK,
|
| 287 |
+
):
|
| 288 |
+
raise NotImplementedError(
|
| 289 |
+
f"{null_kind} null kind is not yet supported for string columns."
|
| 290 |
+
)
|
| 291 |
+
|
| 292 |
+
buffers = col.get_buffers()
|
| 293 |
+
|
| 294 |
+
assert buffers["offsets"], "String buffers must contain offsets"
|
| 295 |
+
# Retrieve the data buffer containing the UTF-8 code units
|
| 296 |
+
data_buff, _ = buffers["data"]
|
| 297 |
+
# We're going to reinterpret the buffer as uint8, so make sure we can do it safely
|
| 298 |
+
assert col.dtype[2] in (
|
| 299 |
+
ArrowCTypes.STRING,
|
| 300 |
+
ArrowCTypes.LARGE_STRING,
|
| 301 |
+
) # format_str == utf-8
|
| 302 |
+
# Convert the buffers to NumPy arrays. In order to go from STRING to
|
| 303 |
+
# an equivalent ndarray, we claim that the buffer is uint8 (i.e., a byte array)
|
| 304 |
+
data_dtype = (
|
| 305 |
+
DtypeKind.UINT,
|
| 306 |
+
8,
|
| 307 |
+
ArrowCTypes.UINT8,
|
| 308 |
+
Endianness.NATIVE,
|
| 309 |
+
)
|
| 310 |
+
# Specify zero offset as we don't want to chunk the string data
|
| 311 |
+
data = buffer_to_ndarray(data_buff, data_dtype, offset=0, length=data_buff.bufsize)
|
| 312 |
+
|
| 313 |
+
# Retrieve the offsets buffer containing the index offsets demarcating
|
| 314 |
+
# the beginning and the ending of each string
|
| 315 |
+
offset_buff, offset_dtype = buffers["offsets"]
|
| 316 |
+
# Offsets buffer contains start-stop positions of strings in the data buffer,
|
| 317 |
+
# meaning that it has more elements than in the data buffer, do `col.size() + 1`
|
| 318 |
+
# here to pass a proper offsets buffer size
|
| 319 |
+
offsets = buffer_to_ndarray(
|
| 320 |
+
offset_buff, offset_dtype, offset=col.offset, length=col.size() + 1
|
| 321 |
+
)
|
| 322 |
+
|
| 323 |
+
null_pos = None
|
| 324 |
+
if null_kind in (ColumnNullType.USE_BITMASK, ColumnNullType.USE_BYTEMASK):
|
| 325 |
+
validity = buffers["validity"]
|
| 326 |
+
if validity is not None:
|
| 327 |
+
valid_buff, valid_dtype = validity
|
| 328 |
+
null_pos = buffer_to_ndarray(
|
| 329 |
+
valid_buff, valid_dtype, offset=col.offset, length=col.size()
|
| 330 |
+
)
|
| 331 |
+
if sentinel_val == 0:
|
| 332 |
+
null_pos = ~null_pos
|
| 333 |
+
|
| 334 |
+
# Assemble the strings from the code units
|
| 335 |
+
str_list: list[None | float | str] = [None] * col.size()
|
| 336 |
+
for i in range(col.size()):
|
| 337 |
+
# Check for missing values
|
| 338 |
+
if null_pos is not None and null_pos[i]:
|
| 339 |
+
str_list[i] = np.nan
|
| 340 |
+
continue
|
| 341 |
+
|
| 342 |
+
# Extract a range of code units
|
| 343 |
+
units = data[offsets[i] : offsets[i + 1]]
|
| 344 |
+
|
| 345 |
+
# Convert the list of code units to bytes
|
| 346 |
+
str_bytes = bytes(units)
|
| 347 |
+
|
| 348 |
+
# Create the string
|
| 349 |
+
string = str_bytes.decode(encoding="utf-8")
|
| 350 |
+
|
| 351 |
+
# Add to our list of strings
|
| 352 |
+
str_list[i] = string
|
| 353 |
+
|
| 354 |
+
if using_string_dtype():
|
| 355 |
+
res = pd.Series(str_list, dtype="str")
|
| 356 |
+
else:
|
| 357 |
+
res = np.asarray(str_list, dtype="object") # type: ignore[assignment]
|
| 358 |
+
|
| 359 |
+
return res, buffers # type: ignore[return-value]
|
| 360 |
+
|
| 361 |
+
|
| 362 |
+
def parse_datetime_format_str(format_str, data) -> pd.Series | np.ndarray:
|
| 363 |
+
"""Parse datetime `format_str` to interpret the `data`."""
|
| 364 |
+
# timestamp 'ts{unit}:tz'
|
| 365 |
+
timestamp_meta = re.match(r"ts([smun]):(.*)", format_str)
|
| 366 |
+
if timestamp_meta:
|
| 367 |
+
unit, tz = timestamp_meta.group(1), timestamp_meta.group(2)
|
| 368 |
+
if unit != "s":
|
| 369 |
+
# the format string describes only a first letter of the unit, so
|
| 370 |
+
# add one extra letter to convert the unit to numpy-style:
|
| 371 |
+
# 'm' -> 'ms', 'u' -> 'us', 'n' -> 'ns'
|
| 372 |
+
unit += "s"
|
| 373 |
+
data = data.astype(f"datetime64[{unit}]")
|
| 374 |
+
if tz != "":
|
| 375 |
+
data = pd.Series(data).dt.tz_localize("UTC").dt.tz_convert(tz)
|
| 376 |
+
return data
|
| 377 |
+
|
| 378 |
+
# date 'td{Days/Ms}'
|
| 379 |
+
date_meta = re.match(r"td([Dm])", format_str)
|
| 380 |
+
if date_meta:
|
| 381 |
+
unit = date_meta.group(1)
|
| 382 |
+
if unit == "D":
|
| 383 |
+
# NumPy doesn't support DAY unit, so converting days to seconds
|
| 384 |
+
# (converting to uint64 to avoid overflow)
|
| 385 |
+
data = (data.astype(np.uint64) * (24 * 60 * 60)).astype("datetime64[s]")
|
| 386 |
+
elif unit == "m":
|
| 387 |
+
data = data.astype("datetime64[ms]")
|
| 388 |
+
else:
|
| 389 |
+
raise NotImplementedError(f"Date unit is not supported: {unit}")
|
| 390 |
+
return data
|
| 391 |
+
|
| 392 |
+
raise NotImplementedError(f"DateTime kind is not supported: {format_str}")
|
| 393 |
+
|
| 394 |
+
|
| 395 |
+
def datetime_column_to_ndarray(col: Column) -> tuple[np.ndarray | pd.Series, Any]:
|
| 396 |
+
"""
|
| 397 |
+
Convert a column holding DateTime data to a NumPy array.
|
| 398 |
+
|
| 399 |
+
Parameters
|
| 400 |
+
----------
|
| 401 |
+
col : Column
|
| 402 |
+
|
| 403 |
+
Returns
|
| 404 |
+
-------
|
| 405 |
+
tuple
|
| 406 |
+
Tuple of np.ndarray holding the data and the memory owner object
|
| 407 |
+
that keeps the memory alive.
|
| 408 |
+
"""
|
| 409 |
+
buffers = col.get_buffers()
|
| 410 |
+
|
| 411 |
+
_, col_bit_width, format_str, _ = col.dtype
|
| 412 |
+
dbuf, _ = buffers["data"]
|
| 413 |
+
# Consider dtype being `uint` to get number of units passed since the 01.01.1970
|
| 414 |
+
|
| 415 |
+
data = buffer_to_ndarray(
|
| 416 |
+
dbuf,
|
| 417 |
+
(
|
| 418 |
+
DtypeKind.INT,
|
| 419 |
+
col_bit_width,
|
| 420 |
+
getattr(ArrowCTypes, f"INT{col_bit_width}"),
|
| 421 |
+
Endianness.NATIVE,
|
| 422 |
+
),
|
| 423 |
+
offset=col.offset,
|
| 424 |
+
length=col.size(),
|
| 425 |
+
)
|
| 426 |
+
|
| 427 |
+
data = parse_datetime_format_str(format_str, data) # type: ignore[assignment]
|
| 428 |
+
data = set_nulls(data, col, buffers["validity"])
|
| 429 |
+
return data, buffers
|
| 430 |
+
|
| 431 |
+
|
| 432 |
+
def buffer_to_ndarray(
|
| 433 |
+
buffer: Buffer,
|
| 434 |
+
dtype: tuple[DtypeKind, int, str, str],
|
| 435 |
+
*,
|
| 436 |
+
length: int,
|
| 437 |
+
offset: int = 0,
|
| 438 |
+
) -> np.ndarray:
|
| 439 |
+
"""
|
| 440 |
+
Build a NumPy array from the passed buffer.
|
| 441 |
+
|
| 442 |
+
Parameters
|
| 443 |
+
----------
|
| 444 |
+
buffer : Buffer
|
| 445 |
+
Buffer to build a NumPy array from.
|
| 446 |
+
dtype : tuple
|
| 447 |
+
Data type of the buffer conforming protocol dtypes format.
|
| 448 |
+
offset : int, default: 0
|
| 449 |
+
Number of elements to offset from the start of the buffer.
|
| 450 |
+
length : int, optional
|
| 451 |
+
If the buffer is a bit-mask, specifies a number of bits to read
|
| 452 |
+
from the buffer. Has no effect otherwise.
|
| 453 |
+
|
| 454 |
+
Returns
|
| 455 |
+
-------
|
| 456 |
+
np.ndarray
|
| 457 |
+
|
| 458 |
+
Notes
|
| 459 |
+
-----
|
| 460 |
+
The returned array doesn't own the memory. The caller of this function is
|
| 461 |
+
responsible for keeping the memory owner object alive as long as
|
| 462 |
+
the returned NumPy array is being used.
|
| 463 |
+
"""
|
| 464 |
+
kind, bit_width, _, _ = dtype
|
| 465 |
+
|
| 466 |
+
column_dtype = _NP_DTYPES.get(kind, {}).get(bit_width, None)
|
| 467 |
+
if column_dtype is None:
|
| 468 |
+
raise NotImplementedError(f"Conversion for {dtype} is not yet supported.")
|
| 469 |
+
|
| 470 |
+
# TODO: No DLPack yet, so need to construct a new ndarray from the data pointer
|
| 471 |
+
# and size in the buffer plus the dtype on the column. Use DLPack as NumPy supports
|
| 472 |
+
# it since https://github.com/numpy/numpy/pull/19083
|
| 473 |
+
ctypes_type = np.ctypeslib.as_ctypes_type(column_dtype)
|
| 474 |
+
|
| 475 |
+
if bit_width == 1:
|
| 476 |
+
assert length is not None, "`length` must be specified for a bit-mask buffer."
|
| 477 |
+
pa = import_optional_dependency("pyarrow")
|
| 478 |
+
arr = pa.BooleanArray.from_buffers(
|
| 479 |
+
pa.bool_(),
|
| 480 |
+
length,
|
| 481 |
+
[None, pa.foreign_buffer(buffer.ptr, length)],
|
| 482 |
+
offset=offset,
|
| 483 |
+
)
|
| 484 |
+
return np.asarray(arr)
|
| 485 |
+
else:
|
| 486 |
+
data_pointer = ctypes.cast(
|
| 487 |
+
buffer.ptr + (offset * bit_width // 8), ctypes.POINTER(ctypes_type)
|
| 488 |
+
)
|
| 489 |
+
if length > 0:
|
| 490 |
+
return np.ctypeslib.as_array(data_pointer, shape=(length,))
|
| 491 |
+
return np.array([], dtype=ctypes_type)
|
| 492 |
+
|
| 493 |
+
|
| 494 |
+
def set_nulls(
|
| 495 |
+
data: np.ndarray | pd.Series,
|
| 496 |
+
col: Column,
|
| 497 |
+
validity: tuple[Buffer, tuple[DtypeKind, int, str, str]] | None,
|
| 498 |
+
allow_modify_inplace: bool = True,
|
| 499 |
+
):
|
| 500 |
+
"""
|
| 501 |
+
Set null values for the data according to the column null kind.
|
| 502 |
+
|
| 503 |
+
Parameters
|
| 504 |
+
----------
|
| 505 |
+
data : np.ndarray or pd.Series
|
| 506 |
+
Data to set nulls in.
|
| 507 |
+
col : Column
|
| 508 |
+
Column object that describes the `data`.
|
| 509 |
+
validity : tuple(Buffer, dtype) or None
|
| 510 |
+
The return value of ``col.buffers()``. We do not access the ``col.buffers()``
|
| 511 |
+
here to not take the ownership of the memory of buffer objects.
|
| 512 |
+
allow_modify_inplace : bool, default: True
|
| 513 |
+
Whether to modify the `data` inplace when zero-copy is possible (True) or always
|
| 514 |
+
modify a copy of the `data` (False).
|
| 515 |
+
|
| 516 |
+
Returns
|
| 517 |
+
-------
|
| 518 |
+
np.ndarray or pd.Series
|
| 519 |
+
Data with the nulls being set.
|
| 520 |
+
"""
|
| 521 |
+
if validity is None:
|
| 522 |
+
return data
|
| 523 |
+
null_kind, sentinel_val = col.describe_null
|
| 524 |
+
null_pos = None
|
| 525 |
+
|
| 526 |
+
if null_kind == ColumnNullType.USE_SENTINEL:
|
| 527 |
+
null_pos = pd.Series(data) == sentinel_val
|
| 528 |
+
elif null_kind in (ColumnNullType.USE_BITMASK, ColumnNullType.USE_BYTEMASK):
|
| 529 |
+
assert validity, "Expected to have a validity buffer for the mask"
|
| 530 |
+
valid_buff, valid_dtype = validity
|
| 531 |
+
null_pos = buffer_to_ndarray(
|
| 532 |
+
valid_buff, valid_dtype, offset=col.offset, length=col.size()
|
| 533 |
+
)
|
| 534 |
+
if sentinel_val == 0:
|
| 535 |
+
null_pos = ~null_pos
|
| 536 |
+
elif null_kind in (ColumnNullType.NON_NULLABLE, ColumnNullType.USE_NAN):
|
| 537 |
+
pass
|
| 538 |
+
else:
|
| 539 |
+
raise NotImplementedError(f"Null kind {null_kind} is not yet supported.")
|
| 540 |
+
|
| 541 |
+
if null_pos is not None and np.any(null_pos):
|
| 542 |
+
if not allow_modify_inplace:
|
| 543 |
+
data = data.copy()
|
| 544 |
+
try:
|
| 545 |
+
data[null_pos] = None
|
| 546 |
+
except TypeError:
|
| 547 |
+
# TypeError happens if the `data` dtype appears to be non-nullable
|
| 548 |
+
# in numpy notation (bool, int, uint). If this happens,
|
| 549 |
+
# cast the `data` to nullable float dtype.
|
| 550 |
+
data = data.astype(float)
|
| 551 |
+
data[null_pos] = None
|
| 552 |
+
except SettingWithCopyError:
|
| 553 |
+
# `SettingWithCopyError` may happen for datetime-like with missing values.
|
| 554 |
+
data = data.copy()
|
| 555 |
+
data[null_pos] = None
|
| 556 |
+
|
| 557 |
+
return data
|
shared/package-files/9b/9b66f7e1cf75ec85b9a3e43fe936081e5b0af6549494d8b2ac84d3507ff3c1ec/blob
ADDED
|
@@ -0,0 +1,353 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""This is invoked in a subprocess to call the build backend hooks.
|
| 2 |
+
|
| 3 |
+
It expects:
|
| 4 |
+
- Command line args: hook_name, control_dir
|
| 5 |
+
- Environment variables:
|
| 6 |
+
PEP517_BUILD_BACKEND=entry.point:spec
|
| 7 |
+
PEP517_BACKEND_PATH=paths (separated with os.pathsep)
|
| 8 |
+
- control_dir/input.json:
|
| 9 |
+
- {"kwargs": {...}}
|
| 10 |
+
|
| 11 |
+
Results:
|
| 12 |
+
- control_dir/output.json
|
| 13 |
+
- {"return_val": ...}
|
| 14 |
+
"""
|
| 15 |
+
import json
|
| 16 |
+
import os
|
| 17 |
+
import os.path
|
| 18 |
+
import re
|
| 19 |
+
import shutil
|
| 20 |
+
import sys
|
| 21 |
+
import traceback
|
| 22 |
+
from glob import glob
|
| 23 |
+
from importlib import import_module
|
| 24 |
+
from os.path import join as pjoin
|
| 25 |
+
|
| 26 |
+
# This file is run as a script, and `import wrappers` is not zip-safe, so we
|
| 27 |
+
# include write_json() and read_json() from wrappers.py.
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def write_json(obj, path, **kwargs):
|
| 31 |
+
with open(path, 'w', encoding='utf-8') as f:
|
| 32 |
+
json.dump(obj, f, **kwargs)
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def read_json(path):
|
| 36 |
+
with open(path, encoding='utf-8') as f:
|
| 37 |
+
return json.load(f)
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
class BackendUnavailable(Exception):
|
| 41 |
+
"""Raised if we cannot import the backend"""
|
| 42 |
+
def __init__(self, traceback):
|
| 43 |
+
self.traceback = traceback
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
class BackendInvalid(Exception):
|
| 47 |
+
"""Raised if the backend is invalid"""
|
| 48 |
+
def __init__(self, message):
|
| 49 |
+
self.message = message
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
class HookMissing(Exception):
|
| 53 |
+
"""Raised if a hook is missing and we are not executing the fallback"""
|
| 54 |
+
def __init__(self, hook_name=None):
|
| 55 |
+
super().__init__(hook_name)
|
| 56 |
+
self.hook_name = hook_name
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
def contained_in(filename, directory):
|
| 60 |
+
"""Test if a file is located within the given directory."""
|
| 61 |
+
filename = os.path.normcase(os.path.abspath(filename))
|
| 62 |
+
directory = os.path.normcase(os.path.abspath(directory))
|
| 63 |
+
return os.path.commonprefix([filename, directory]) == directory
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def _build_backend():
|
| 67 |
+
"""Find and load the build backend"""
|
| 68 |
+
# Add in-tree backend directories to the front of sys.path.
|
| 69 |
+
backend_path = os.environ.get('PEP517_BACKEND_PATH')
|
| 70 |
+
if backend_path:
|
| 71 |
+
extra_pathitems = backend_path.split(os.pathsep)
|
| 72 |
+
sys.path[:0] = extra_pathitems
|
| 73 |
+
|
| 74 |
+
ep = os.environ['PEP517_BUILD_BACKEND']
|
| 75 |
+
mod_path, _, obj_path = ep.partition(':')
|
| 76 |
+
try:
|
| 77 |
+
obj = import_module(mod_path)
|
| 78 |
+
except ImportError:
|
| 79 |
+
raise BackendUnavailable(traceback.format_exc())
|
| 80 |
+
|
| 81 |
+
if backend_path:
|
| 82 |
+
if not any(
|
| 83 |
+
contained_in(obj.__file__, path)
|
| 84 |
+
for path in extra_pathitems
|
| 85 |
+
):
|
| 86 |
+
raise BackendInvalid("Backend was not loaded from backend-path")
|
| 87 |
+
|
| 88 |
+
if obj_path:
|
| 89 |
+
for path_part in obj_path.split('.'):
|
| 90 |
+
obj = getattr(obj, path_part)
|
| 91 |
+
return obj
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
def _supported_features():
|
| 95 |
+
"""Return the list of options features supported by the backend.
|
| 96 |
+
|
| 97 |
+
Returns a list of strings.
|
| 98 |
+
The only possible value is 'build_editable'.
|
| 99 |
+
"""
|
| 100 |
+
backend = _build_backend()
|
| 101 |
+
features = []
|
| 102 |
+
if hasattr(backend, "build_editable"):
|
| 103 |
+
features.append("build_editable")
|
| 104 |
+
return features
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
def get_requires_for_build_wheel(config_settings):
|
| 108 |
+
"""Invoke the optional get_requires_for_build_wheel hook
|
| 109 |
+
|
| 110 |
+
Returns [] if the hook is not defined.
|
| 111 |
+
"""
|
| 112 |
+
backend = _build_backend()
|
| 113 |
+
try:
|
| 114 |
+
hook = backend.get_requires_for_build_wheel
|
| 115 |
+
except AttributeError:
|
| 116 |
+
return []
|
| 117 |
+
else:
|
| 118 |
+
return hook(config_settings)
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
def get_requires_for_build_editable(config_settings):
|
| 122 |
+
"""Invoke the optional get_requires_for_build_editable hook
|
| 123 |
+
|
| 124 |
+
Returns [] if the hook is not defined.
|
| 125 |
+
"""
|
| 126 |
+
backend = _build_backend()
|
| 127 |
+
try:
|
| 128 |
+
hook = backend.get_requires_for_build_editable
|
| 129 |
+
except AttributeError:
|
| 130 |
+
return []
|
| 131 |
+
else:
|
| 132 |
+
return hook(config_settings)
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
def prepare_metadata_for_build_wheel(
|
| 136 |
+
metadata_directory, config_settings, _allow_fallback):
|
| 137 |
+
"""Invoke optional prepare_metadata_for_build_wheel
|
| 138 |
+
|
| 139 |
+
Implements a fallback by building a wheel if the hook isn't defined,
|
| 140 |
+
unless _allow_fallback is False in which case HookMissing is raised.
|
| 141 |
+
"""
|
| 142 |
+
backend = _build_backend()
|
| 143 |
+
try:
|
| 144 |
+
hook = backend.prepare_metadata_for_build_wheel
|
| 145 |
+
except AttributeError:
|
| 146 |
+
if not _allow_fallback:
|
| 147 |
+
raise HookMissing()
|
| 148 |
+
else:
|
| 149 |
+
return hook(metadata_directory, config_settings)
|
| 150 |
+
# fallback to build_wheel outside the try block to avoid exception chaining
|
| 151 |
+
# which can be confusing to users and is not relevant
|
| 152 |
+
whl_basename = backend.build_wheel(metadata_directory, config_settings)
|
| 153 |
+
return _get_wheel_metadata_from_wheel(whl_basename, metadata_directory,
|
| 154 |
+
config_settings)
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
def prepare_metadata_for_build_editable(
|
| 158 |
+
metadata_directory, config_settings, _allow_fallback):
|
| 159 |
+
"""Invoke optional prepare_metadata_for_build_editable
|
| 160 |
+
|
| 161 |
+
Implements a fallback by building an editable wheel if the hook isn't
|
| 162 |
+
defined, unless _allow_fallback is False in which case HookMissing is
|
| 163 |
+
raised.
|
| 164 |
+
"""
|
| 165 |
+
backend = _build_backend()
|
| 166 |
+
try:
|
| 167 |
+
hook = backend.prepare_metadata_for_build_editable
|
| 168 |
+
except AttributeError:
|
| 169 |
+
if not _allow_fallback:
|
| 170 |
+
raise HookMissing()
|
| 171 |
+
try:
|
| 172 |
+
build_hook = backend.build_editable
|
| 173 |
+
except AttributeError:
|
| 174 |
+
raise HookMissing(hook_name='build_editable')
|
| 175 |
+
else:
|
| 176 |
+
whl_basename = build_hook(metadata_directory, config_settings)
|
| 177 |
+
return _get_wheel_metadata_from_wheel(whl_basename,
|
| 178 |
+
metadata_directory,
|
| 179 |
+
config_settings)
|
| 180 |
+
else:
|
| 181 |
+
return hook(metadata_directory, config_settings)
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
WHEEL_BUILT_MARKER = 'PEP517_ALREADY_BUILT_WHEEL'
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
def _dist_info_files(whl_zip):
|
| 188 |
+
"""Identify the .dist-info folder inside a wheel ZipFile."""
|
| 189 |
+
res = []
|
| 190 |
+
for path in whl_zip.namelist():
|
| 191 |
+
m = re.match(r'[^/\\]+-[^/\\]+\.dist-info/', path)
|
| 192 |
+
if m:
|
| 193 |
+
res.append(path)
|
| 194 |
+
if res:
|
| 195 |
+
return res
|
| 196 |
+
raise Exception("No .dist-info folder found in wheel")
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
def _get_wheel_metadata_from_wheel(
|
| 200 |
+
whl_basename, metadata_directory, config_settings):
|
| 201 |
+
"""Extract the metadata from a wheel.
|
| 202 |
+
|
| 203 |
+
Fallback for when the build backend does not
|
| 204 |
+
define the 'get_wheel_metadata' hook.
|
| 205 |
+
"""
|
| 206 |
+
from zipfile import ZipFile
|
| 207 |
+
with open(os.path.join(metadata_directory, WHEEL_BUILT_MARKER), 'wb'):
|
| 208 |
+
pass # Touch marker file
|
| 209 |
+
|
| 210 |
+
whl_file = os.path.join(metadata_directory, whl_basename)
|
| 211 |
+
with ZipFile(whl_file) as zipf:
|
| 212 |
+
dist_info = _dist_info_files(zipf)
|
| 213 |
+
zipf.extractall(path=metadata_directory, members=dist_info)
|
| 214 |
+
return dist_info[0].split('/')[0]
|
| 215 |
+
|
| 216 |
+
|
| 217 |
+
def _find_already_built_wheel(metadata_directory):
|
| 218 |
+
"""Check for a wheel already built during the get_wheel_metadata hook.
|
| 219 |
+
"""
|
| 220 |
+
if not metadata_directory:
|
| 221 |
+
return None
|
| 222 |
+
metadata_parent = os.path.dirname(metadata_directory)
|
| 223 |
+
if not os.path.isfile(pjoin(metadata_parent, WHEEL_BUILT_MARKER)):
|
| 224 |
+
return None
|
| 225 |
+
|
| 226 |
+
whl_files = glob(os.path.join(metadata_parent, '*.whl'))
|
| 227 |
+
if not whl_files:
|
| 228 |
+
print('Found wheel built marker, but no .whl files')
|
| 229 |
+
return None
|
| 230 |
+
if len(whl_files) > 1:
|
| 231 |
+
print('Found multiple .whl files; unspecified behaviour. '
|
| 232 |
+
'Will call build_wheel.')
|
| 233 |
+
return None
|
| 234 |
+
|
| 235 |
+
# Exactly one .whl file
|
| 236 |
+
return whl_files[0]
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
def build_wheel(wheel_directory, config_settings, metadata_directory=None):
|
| 240 |
+
"""Invoke the mandatory build_wheel hook.
|
| 241 |
+
|
| 242 |
+
If a wheel was already built in the
|
| 243 |
+
prepare_metadata_for_build_wheel fallback, this
|
| 244 |
+
will copy it rather than rebuilding the wheel.
|
| 245 |
+
"""
|
| 246 |
+
prebuilt_whl = _find_already_built_wheel(metadata_directory)
|
| 247 |
+
if prebuilt_whl:
|
| 248 |
+
shutil.copy2(prebuilt_whl, wheel_directory)
|
| 249 |
+
return os.path.basename(prebuilt_whl)
|
| 250 |
+
|
| 251 |
+
return _build_backend().build_wheel(wheel_directory, config_settings,
|
| 252 |
+
metadata_directory)
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
def build_editable(wheel_directory, config_settings, metadata_directory=None):
|
| 256 |
+
"""Invoke the optional build_editable hook.
|
| 257 |
+
|
| 258 |
+
If a wheel was already built in the
|
| 259 |
+
prepare_metadata_for_build_editable fallback, this
|
| 260 |
+
will copy it rather than rebuilding the wheel.
|
| 261 |
+
"""
|
| 262 |
+
backend = _build_backend()
|
| 263 |
+
try:
|
| 264 |
+
hook = backend.build_editable
|
| 265 |
+
except AttributeError:
|
| 266 |
+
raise HookMissing()
|
| 267 |
+
else:
|
| 268 |
+
prebuilt_whl = _find_already_built_wheel(metadata_directory)
|
| 269 |
+
if prebuilt_whl:
|
| 270 |
+
shutil.copy2(prebuilt_whl, wheel_directory)
|
| 271 |
+
return os.path.basename(prebuilt_whl)
|
| 272 |
+
|
| 273 |
+
return hook(wheel_directory, config_settings, metadata_directory)
|
| 274 |
+
|
| 275 |
+
|
| 276 |
+
def get_requires_for_build_sdist(config_settings):
|
| 277 |
+
"""Invoke the optional get_requires_for_build_wheel hook
|
| 278 |
+
|
| 279 |
+
Returns [] if the hook is not defined.
|
| 280 |
+
"""
|
| 281 |
+
backend = _build_backend()
|
| 282 |
+
try:
|
| 283 |
+
hook = backend.get_requires_for_build_sdist
|
| 284 |
+
except AttributeError:
|
| 285 |
+
return []
|
| 286 |
+
else:
|
| 287 |
+
return hook(config_settings)
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
class _DummyException(Exception):
|
| 291 |
+
"""Nothing should ever raise this exception"""
|
| 292 |
+
|
| 293 |
+
|
| 294 |
+
class GotUnsupportedOperation(Exception):
|
| 295 |
+
"""For internal use when backend raises UnsupportedOperation"""
|
| 296 |
+
def __init__(self, traceback):
|
| 297 |
+
self.traceback = traceback
|
| 298 |
+
|
| 299 |
+
|
| 300 |
+
def build_sdist(sdist_directory, config_settings):
|
| 301 |
+
"""Invoke the mandatory build_sdist hook."""
|
| 302 |
+
backend = _build_backend()
|
| 303 |
+
try:
|
| 304 |
+
return backend.build_sdist(sdist_directory, config_settings)
|
| 305 |
+
except getattr(backend, 'UnsupportedOperation', _DummyException):
|
| 306 |
+
raise GotUnsupportedOperation(traceback.format_exc())
|
| 307 |
+
|
| 308 |
+
|
| 309 |
+
HOOK_NAMES = {
|
| 310 |
+
'get_requires_for_build_wheel',
|
| 311 |
+
'prepare_metadata_for_build_wheel',
|
| 312 |
+
'build_wheel',
|
| 313 |
+
'get_requires_for_build_editable',
|
| 314 |
+
'prepare_metadata_for_build_editable',
|
| 315 |
+
'build_editable',
|
| 316 |
+
'get_requires_for_build_sdist',
|
| 317 |
+
'build_sdist',
|
| 318 |
+
'_supported_features',
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
|
| 322 |
+
def main():
|
| 323 |
+
if len(sys.argv) < 3:
|
| 324 |
+
sys.exit("Needs args: hook_name, control_dir")
|
| 325 |
+
hook_name = sys.argv[1]
|
| 326 |
+
control_dir = sys.argv[2]
|
| 327 |
+
if hook_name not in HOOK_NAMES:
|
| 328 |
+
sys.exit("Unknown hook: %s" % hook_name)
|
| 329 |
+
hook = globals()[hook_name]
|
| 330 |
+
|
| 331 |
+
hook_input = read_json(pjoin(control_dir, 'input.json'))
|
| 332 |
+
|
| 333 |
+
json_out = {'unsupported': False, 'return_val': None}
|
| 334 |
+
try:
|
| 335 |
+
json_out['return_val'] = hook(**hook_input['kwargs'])
|
| 336 |
+
except BackendUnavailable as e:
|
| 337 |
+
json_out['no_backend'] = True
|
| 338 |
+
json_out['traceback'] = e.traceback
|
| 339 |
+
except BackendInvalid as e:
|
| 340 |
+
json_out['backend_invalid'] = True
|
| 341 |
+
json_out['backend_error'] = e.message
|
| 342 |
+
except GotUnsupportedOperation as e:
|
| 343 |
+
json_out['unsupported'] = True
|
| 344 |
+
json_out['traceback'] = e.traceback
|
| 345 |
+
except HookMissing as e:
|
| 346 |
+
json_out['hook_missing'] = True
|
| 347 |
+
json_out['missing_hook_name'] = e.hook_name or hook_name
|
| 348 |
+
|
| 349 |
+
write_json(json_out, pjoin(control_dir, 'output.json'), indent=2)
|
| 350 |
+
|
| 351 |
+
|
| 352 |
+
if __name__ == '__main__':
|
| 353 |
+
main()
|
shared/package-files/9b/9b6742f1d21425a930997735c01c838096af851948a118f4923bade4c777e9e7/blob
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace compositeimplicitautograd {
|
| 19 |
+
|
| 20 |
+
TORCH_API at::Tensor _upsample_bilinear2d_aa(const at::Tensor & input, at::OptionalIntArrayRef output_size, bool align_corners, c10::optional<at::ArrayRef<double>> scale_factors);
|
| 21 |
+
TORCH_API at::Tensor _upsample_bilinear2d_aa_symint(const at::Tensor & input, at::OptionalSymIntArrayRef output_size, bool align_corners, c10::optional<at::ArrayRef<double>> scale_factors);
|
| 22 |
+
|
| 23 |
+
} // namespace compositeimplicitautograd
|
| 24 |
+
} // namespace at
|
shared/package-files/9b/9b6cdb3f80bbf7a16f415b15566b175028b3f0fae3d8efa94f9e6b6c70363700/blob
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <Python.h>
|
| 4 |
+
|
| 5 |
+
// @generated from ../tools/autograd/templates/python_functions.h
|
| 6 |
+
|
| 7 |
+
// Python bindings for automatically generated autograd functions
|
| 8 |
+
|
| 9 |
+
namespace torch { namespace autograd { namespace generated {
|
| 10 |
+
|
| 11 |
+
void initialize_autogenerated_functions_0(PyObject* module);
|
| 12 |
+
void initialize_autogenerated_functions_1(PyObject* module);
|
| 13 |
+
void initialize_autogenerated_functions_2(PyObject* module);
|
| 14 |
+
void initialize_autogenerated_functions_3(PyObject* module);
|
| 15 |
+
void initialize_autogenerated_functions_4(PyObject* module);
|
| 16 |
+
|
| 17 |
+
inline void initialize_autogenerated_functions(PyObject* module) {
|
| 18 |
+
initialize_autogenerated_functions_0(module);
|
| 19 |
+
initialize_autogenerated_functions_1(module);
|
| 20 |
+
initialize_autogenerated_functions_2(module);
|
| 21 |
+
initialize_autogenerated_functions_3(module);
|
| 22 |
+
initialize_autogenerated_functions_4(module);
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
}}} // namespace torch::autograd::generated
|
shared/package-files/9b/9b6d58df002d41cfa38ba55e6fa93f33983a034672148e1e81c853767c21fa94/blob
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""For when pip wants to check the date or time.
|
| 2 |
+
"""
|
| 3 |
+
|
| 4 |
+
import datetime
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def today_is_later_than(year: int, month: int, day: int) -> bool:
|
| 8 |
+
today = datetime.date.today()
|
| 9 |
+
given = datetime.date(year, month, day)
|
| 10 |
+
|
| 11 |
+
return today > given
|
shared/package-files/9b/9b6e400eb85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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# history.tcl --
|
| 2 |
+
#
|
| 3 |
+
# Implementation of the history command.
|
| 4 |
+
#
|
| 5 |
+
# Copyright (c) 1997 Sun Microsystems, Inc.
|
| 6 |
+
#
|
| 7 |
+
# See the file "license.terms" for information on usage and redistribution of
|
| 8 |
+
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
| 9 |
+
#
|
| 10 |
+
|
| 11 |
+
# The tcl::history array holds the history list and some additional
|
| 12 |
+
# bookkeeping variables.
|
| 13 |
+
#
|
| 14 |
+
# nextid the index used for the next history list item.
|
| 15 |
+
# keep the max size of the history list
|
| 16 |
+
# oldest the index of the oldest item in the history.
|
| 17 |
+
|
| 18 |
+
namespace eval ::tcl {
|
| 19 |
+
variable history
|
| 20 |
+
if {![info exists history]} {
|
| 21 |
+
array set history {
|
| 22 |
+
nextid 0
|
| 23 |
+
keep 20
|
| 24 |
+
oldest -20
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
namespace ensemble create -command ::tcl::history -map {
|
| 29 |
+
add ::tcl::HistAdd
|
| 30 |
+
change ::tcl::HistChange
|
| 31 |
+
clear ::tcl::HistClear
|
| 32 |
+
event ::tcl::HistEvent
|
| 33 |
+
info ::tcl::HistInfo
|
| 34 |
+
keep ::tcl::HistKeep
|
| 35 |
+
nextid ::tcl::HistNextID
|
| 36 |
+
redo ::tcl::HistRedo
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
# history --
|
| 41 |
+
#
|
| 42 |
+
# This is the main history command. See the man page for its interface.
|
| 43 |
+
# This does some argument checking and calls the helper ensemble in the
|
| 44 |
+
# tcl namespace.
|
| 45 |
+
|
| 46 |
+
proc ::history {args} {
|
| 47 |
+
# If no command given, we're doing 'history info'. Can't be done with an
|
| 48 |
+
# ensemble unknown handler, as those don't fire when no subcommand is
|
| 49 |
+
# given at all.
|
| 50 |
+
|
| 51 |
+
if {![llength $args]} {
|
| 52 |
+
set args info
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
# Tricky stuff needed to make stack and errors come out right!
|
| 56 |
+
tailcall apply {arglist {tailcall history {*}$arglist} ::tcl} $args
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
# (unnamed) --
|
| 60 |
+
#
|
| 61 |
+
# Callback when [::history] is destroyed. Destroys the implementation.
|
| 62 |
+
#
|
| 63 |
+
# Parameters:
|
| 64 |
+
# oldName what the command was called.
|
| 65 |
+
# newName what the command is now called (an empty string).
|
| 66 |
+
# op the operation (= delete).
|
| 67 |
+
#
|
| 68 |
+
# Results:
|
| 69 |
+
# none
|
| 70 |
+
#
|
| 71 |
+
# Side Effects:
|
| 72 |
+
# The implementation of the [::history] command ceases to exist.
|
| 73 |
+
|
| 74 |
+
trace add command ::history delete [list apply {{oldName newName op} {
|
| 75 |
+
variable history
|
| 76 |
+
unset -nocomplain history
|
| 77 |
+
foreach c [info procs ::tcl::Hist*] {
|
| 78 |
+
rename $c {}
|
| 79 |
+
}
|
| 80 |
+
rename ::tcl::history {}
|
| 81 |
+
} ::tcl}]
|
| 82 |
+
|
| 83 |
+
# tcl::HistAdd --
|
| 84 |
+
#
|
| 85 |
+
# Add an item to the history, and optionally eval it at the global scope
|
| 86 |
+
#
|
| 87 |
+
# Parameters:
|
| 88 |
+
# event the command to add
|
| 89 |
+
# exec (optional) a substring of "exec" causes the command to
|
| 90 |
+
# be evaled.
|
| 91 |
+
# Results:
|
| 92 |
+
# If executing, then the results of the command are returned
|
| 93 |
+
#
|
| 94 |
+
# Side Effects:
|
| 95 |
+
# Adds to the history list
|
| 96 |
+
|
| 97 |
+
proc ::tcl::HistAdd {event {exec {}}} {
|
| 98 |
+
variable history
|
| 99 |
+
|
| 100 |
+
if {
|
| 101 |
+
[prefix longest {exec {}} $exec] eq ""
|
| 102 |
+
&& [llength [info level 0]] == 3
|
| 103 |
+
} then {
|
| 104 |
+
return -code error "bad argument \"$exec\": should be \"exec\""
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
# Do not add empty commands to the history
|
| 108 |
+
if {[string trim $event] eq ""} {
|
| 109 |
+
return ""
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
# Maintain the history
|
| 113 |
+
set history([incr history(nextid)]) $event
|
| 114 |
+
unset -nocomplain history([incr history(oldest)])
|
| 115 |
+
|
| 116 |
+
# Only execute if 'exec' (or non-empty prefix of it) given
|
| 117 |
+
if {$exec eq ""} {
|
| 118 |
+
return ""
|
| 119 |
+
}
|
| 120 |
+
tailcall eval $event
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
# tcl::HistKeep --
|
| 124 |
+
#
|
| 125 |
+
# Set or query the limit on the length of the history list
|
| 126 |
+
#
|
| 127 |
+
# Parameters:
|
| 128 |
+
# limit (optional) the length of the history list
|
| 129 |
+
#
|
| 130 |
+
# Results:
|
| 131 |
+
# If no limit is specified, the current limit is returned
|
| 132 |
+
#
|
| 133 |
+
# Side Effects:
|
| 134 |
+
# Updates history(keep) if a limit is specified
|
| 135 |
+
|
| 136 |
+
proc ::tcl::HistKeep {{count {}}} {
|
| 137 |
+
variable history
|
| 138 |
+
if {[llength [info level 0]] == 1} {
|
| 139 |
+
return $history(keep)
|
| 140 |
+
}
|
| 141 |
+
if {![string is integer -strict $count] || ($count < 0)} {
|
| 142 |
+
return -code error "illegal keep count \"$count\""
|
| 143 |
+
}
|
| 144 |
+
set oldold $history(oldest)
|
| 145 |
+
set history(oldest) [expr {$history(nextid) - $count}]
|
| 146 |
+
for {} {$oldold <= $history(oldest)} {incr oldold} {
|
| 147 |
+
unset -nocomplain history($oldold)
|
| 148 |
+
}
|
| 149 |
+
set history(keep) $count
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
# tcl::HistClear --
|
| 153 |
+
#
|
| 154 |
+
# Erase the history list
|
| 155 |
+
#
|
| 156 |
+
# Parameters:
|
| 157 |
+
# none
|
| 158 |
+
#
|
| 159 |
+
# Results:
|
| 160 |
+
# none
|
| 161 |
+
#
|
| 162 |
+
# Side Effects:
|
| 163 |
+
# Resets the history array, except for the keep limit
|
| 164 |
+
|
| 165 |
+
proc ::tcl::HistClear {} {
|
| 166 |
+
variable history
|
| 167 |
+
set keep $history(keep)
|
| 168 |
+
unset history
|
| 169 |
+
array set history [list \
|
| 170 |
+
nextid 0 \
|
| 171 |
+
keep $keep \
|
| 172 |
+
oldest -$keep \
|
| 173 |
+
]
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
# tcl::HistInfo --
|
| 177 |
+
#
|
| 178 |
+
# Return a pretty-printed version of the history list
|
| 179 |
+
#
|
| 180 |
+
# Parameters:
|
| 181 |
+
# num (optional) the length of the history list to return
|
| 182 |
+
#
|
| 183 |
+
# Results:
|
| 184 |
+
# A formatted history list
|
| 185 |
+
|
| 186 |
+
proc ::tcl::HistInfo {{count {}}} {
|
| 187 |
+
variable history
|
| 188 |
+
if {[llength [info level 0]] == 1} {
|
| 189 |
+
set count [expr {$history(keep) + 1}]
|
| 190 |
+
} elseif {![string is integer -strict $count]} {
|
| 191 |
+
return -code error "bad integer \"$count\""
|
| 192 |
+
}
|
| 193 |
+
set result {}
|
| 194 |
+
set newline ""
|
| 195 |
+
for {set i [expr {$history(nextid) - $count + 1}]} \
|
| 196 |
+
{$i <= $history(nextid)} {incr i} {
|
| 197 |
+
if {![info exists history($i)]} {
|
| 198 |
+
continue
|
| 199 |
+
}
|
| 200 |
+
set cmd [string map [list \n \n\t] [string trimright $history($i) \ \n]]
|
| 201 |
+
append result $newline[format "%6d %s" $i $cmd]
|
| 202 |
+
set newline \n
|
| 203 |
+
}
|
| 204 |
+
return $result
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
# tcl::HistRedo --
|
| 208 |
+
#
|
| 209 |
+
# Fetch the previous or specified event, execute it, and then replace
|
| 210 |
+
# the current history item with that event.
|
| 211 |
+
#
|
| 212 |
+
# Parameters:
|
| 213 |
+
# event (optional) index of history item to redo. Defaults to -1,
|
| 214 |
+
# which means the previous event.
|
| 215 |
+
#
|
| 216 |
+
# Results:
|
| 217 |
+
# Those of the command being redone.
|
| 218 |
+
#
|
| 219 |
+
# Side Effects:
|
| 220 |
+
# Replaces the current history list item with the one being redone.
|
| 221 |
+
|
| 222 |
+
proc ::tcl::HistRedo {{event -1}} {
|
| 223 |
+
variable history
|
| 224 |
+
|
| 225 |
+
set i [HistIndex $event]
|
| 226 |
+
if {$i == $history(nextid)} {
|
| 227 |
+
return -code error "cannot redo the current event"
|
| 228 |
+
}
|
| 229 |
+
set cmd $history($i)
|
| 230 |
+
HistChange $cmd 0
|
| 231 |
+
tailcall eval $cmd
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
# tcl::HistIndex --
|
| 235 |
+
#
|
| 236 |
+
# Map from an event specifier to an index in the history list.
|
| 237 |
+
#
|
| 238 |
+
# Parameters:
|
| 239 |
+
# event index of history item to redo.
|
| 240 |
+
# If this is a positive number, it is used directly.
|
| 241 |
+
# If it is a negative number, then it counts back to a previous
|
| 242 |
+
# event, where -1 is the most recent event.
|
| 243 |
+
# A string can be matched, either by being the prefix of a
|
| 244 |
+
# command or by matching a command with string match.
|
| 245 |
+
#
|
| 246 |
+
# Results:
|
| 247 |
+
# The index into history, or an error if the index didn't match.
|
| 248 |
+
|
| 249 |
+
proc ::tcl::HistIndex {event} {
|
| 250 |
+
variable history
|
| 251 |
+
if {![string is integer -strict $event]} {
|
| 252 |
+
for {set i [expr {$history(nextid)-1}]} {[info exists history($i)]} \
|
| 253 |
+
{incr i -1} {
|
| 254 |
+
if {[string match $event* $history($i)]} {
|
| 255 |
+
return $i
|
| 256 |
+
}
|
| 257 |
+
if {[string match $event $history($i)]} {
|
| 258 |
+
return $i
|
| 259 |
+
}
|
| 260 |
+
}
|
| 261 |
+
return -code error "no event matches \"$event\""
|
| 262 |
+
} elseif {$event <= 0} {
|
| 263 |
+
set i [expr {$history(nextid) + $event}]
|
| 264 |
+
} else {
|
| 265 |
+
set i $event
|
| 266 |
+
}
|
| 267 |
+
if {$i <= $history(oldest)} {
|
| 268 |
+
return -code error "event \"$event\" is too far in the past"
|
| 269 |
+
}
|
| 270 |
+
if {$i > $history(nextid)} {
|
| 271 |
+
return -code error "event \"$event\" hasn't occured yet"
|
| 272 |
+
}
|
| 273 |
+
return $i
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
# tcl::HistEvent --
|
| 277 |
+
#
|
| 278 |
+
# Map from an event specifier to the value in the history list.
|
| 279 |
+
#
|
| 280 |
+
# Parameters:
|
| 281 |
+
# event index of history item to redo. See index for a description of
|
| 282 |
+
# possible event patterns.
|
| 283 |
+
#
|
| 284 |
+
# Results:
|
| 285 |
+
# The value from the history list.
|
| 286 |
+
|
| 287 |
+
proc ::tcl::HistEvent {{event -1}} {
|
| 288 |
+
variable history
|
| 289 |
+
set i [HistIndex $event]
|
| 290 |
+
if {![info exists history($i)]} {
|
| 291 |
+
return ""
|
| 292 |
+
}
|
| 293 |
+
return [string trimright $history($i) \ \n]
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
# tcl::HistChange --
|
| 297 |
+
#
|
| 298 |
+
# Replace a value in the history list.
|
| 299 |
+
#
|
| 300 |
+
# Parameters:
|
| 301 |
+
# newValue The new value to put into the history list.
|
| 302 |
+
# event (optional) index of history item to redo. See index for a
|
| 303 |
+
# description of possible event patterns. This defaults to 0,
|
| 304 |
+
# which specifies the current event.
|
| 305 |
+
#
|
| 306 |
+
# Side Effects:
|
| 307 |
+
# Changes the history list.
|
| 308 |
+
|
| 309 |
+
proc ::tcl::HistChange {newValue {event 0}} {
|
| 310 |
+
variable history
|
| 311 |
+
set i [HistIndex $event]
|
| 312 |
+
set history($i) $newValue
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
# tcl::HistNextID --
|
| 316 |
+
#
|
| 317 |
+
# Returns the number of the next history event.
|
| 318 |
+
#
|
| 319 |
+
# Parameters:
|
| 320 |
+
# None.
|
| 321 |
+
#
|
| 322 |
+
# Side Effects:
|
| 323 |
+
# None.
|
| 324 |
+
|
| 325 |
+
proc ::tcl::HistNextID {} {
|
| 326 |
+
variable history
|
| 327 |
+
return [expr {$history(nextid) + 1}]
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
return
|
| 331 |
+
|
| 332 |
+
# Local Variables:
|
| 333 |
+
# mode: tcl
|
| 334 |
+
# fill-column: 78
|
| 335 |
+
# End:
|
shared/package-files/9b/9b6fd8df3c9d5193733e9bbcf27f303cd5aa6b17da01330a128ff30205ccab26/blob
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import dataclasses
|
| 4 |
+
import inspect
|
| 5 |
+
from types import FunctionType
|
| 6 |
+
from typing import Any
|
| 7 |
+
from typing import final
|
| 8 |
+
from typing import Generic
|
| 9 |
+
from typing import TypeVar
|
| 10 |
+
import warnings
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
class PytestWarning(UserWarning):
|
| 14 |
+
"""Base class for all warnings emitted by pytest."""
|
| 15 |
+
|
| 16 |
+
__module__ = "pytest"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
@final
|
| 20 |
+
class PytestAssertRewriteWarning(PytestWarning):
|
| 21 |
+
"""Warning emitted by the pytest assert rewrite module."""
|
| 22 |
+
|
| 23 |
+
__module__ = "pytest"
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
@final
|
| 27 |
+
class PytestCacheWarning(PytestWarning):
|
| 28 |
+
"""Warning emitted by the cache plugin in various situations."""
|
| 29 |
+
|
| 30 |
+
__module__ = "pytest"
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
@final
|
| 34 |
+
class PytestConfigWarning(PytestWarning):
|
| 35 |
+
"""Warning emitted for configuration issues."""
|
| 36 |
+
|
| 37 |
+
__module__ = "pytest"
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
@final
|
| 41 |
+
class PytestCollectionWarning(PytestWarning):
|
| 42 |
+
"""Warning emitted when pytest is not able to collect a file or symbol in a module."""
|
| 43 |
+
|
| 44 |
+
__module__ = "pytest"
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
class PytestDeprecationWarning(PytestWarning, DeprecationWarning):
|
| 48 |
+
"""Warning class for features that will be removed in a future version."""
|
| 49 |
+
|
| 50 |
+
__module__ = "pytest"
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
class PytestRemovedIn9Warning(PytestDeprecationWarning):
|
| 54 |
+
"""Warning class for features that will be removed in pytest 9."""
|
| 55 |
+
|
| 56 |
+
__module__ = "pytest"
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
class PytestReturnNotNoneWarning(PytestWarning):
|
| 60 |
+
"""Warning emitted when a test function is returning value other than None."""
|
| 61 |
+
|
| 62 |
+
__module__ = "pytest"
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
@final
|
| 66 |
+
class PytestExperimentalApiWarning(PytestWarning, FutureWarning):
|
| 67 |
+
"""Warning category used to denote experiments in pytest.
|
| 68 |
+
|
| 69 |
+
Use sparingly as the API might change or even be removed completely in a
|
| 70 |
+
future version.
|
| 71 |
+
"""
|
| 72 |
+
|
| 73 |
+
__module__ = "pytest"
|
| 74 |
+
|
| 75 |
+
@classmethod
|
| 76 |
+
def simple(cls, apiname: str) -> PytestExperimentalApiWarning:
|
| 77 |
+
return cls(f"{apiname} is an experimental api that may change over time")
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
@final
|
| 81 |
+
class PytestUnhandledCoroutineWarning(PytestReturnNotNoneWarning):
|
| 82 |
+
"""Warning emitted for an unhandled coroutine.
|
| 83 |
+
|
| 84 |
+
A coroutine was encountered when collecting test functions, but was not
|
| 85 |
+
handled by any async-aware plugin.
|
| 86 |
+
Coroutine test functions are not natively supported.
|
| 87 |
+
"""
|
| 88 |
+
|
| 89 |
+
__module__ = "pytest"
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
@final
|
| 93 |
+
class PytestUnknownMarkWarning(PytestWarning):
|
| 94 |
+
"""Warning emitted on use of unknown markers.
|
| 95 |
+
|
| 96 |
+
See :ref:`mark` for details.
|
| 97 |
+
"""
|
| 98 |
+
|
| 99 |
+
__module__ = "pytest"
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
@final
|
| 103 |
+
class PytestUnraisableExceptionWarning(PytestWarning):
|
| 104 |
+
"""An unraisable exception was reported.
|
| 105 |
+
|
| 106 |
+
Unraisable exceptions are exceptions raised in :meth:`__del__ <object.__del__>`
|
| 107 |
+
implementations and similar situations when the exception cannot be raised
|
| 108 |
+
as normal.
|
| 109 |
+
"""
|
| 110 |
+
|
| 111 |
+
__module__ = "pytest"
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
@final
|
| 115 |
+
class PytestUnhandledThreadExceptionWarning(PytestWarning):
|
| 116 |
+
"""An unhandled exception occurred in a :class:`~threading.Thread`.
|
| 117 |
+
|
| 118 |
+
Such exceptions don't propagate normally.
|
| 119 |
+
"""
|
| 120 |
+
|
| 121 |
+
__module__ = "pytest"
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
_W = TypeVar("_W", bound=PytestWarning)
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
@final
|
| 128 |
+
@dataclasses.dataclass
|
| 129 |
+
class UnformattedWarning(Generic[_W]):
|
| 130 |
+
"""A warning meant to be formatted during runtime.
|
| 131 |
+
|
| 132 |
+
This is used to hold warnings that need to format their message at runtime,
|
| 133 |
+
as opposed to a direct message.
|
| 134 |
+
"""
|
| 135 |
+
|
| 136 |
+
category: type[_W]
|
| 137 |
+
template: str
|
| 138 |
+
|
| 139 |
+
def format(self, **kwargs: Any) -> _W:
|
| 140 |
+
"""Return an instance of the warning category, formatted with given kwargs."""
|
| 141 |
+
return self.category(self.template.format(**kwargs))
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
def warn_explicit_for(method: FunctionType, message: PytestWarning) -> None:
|
| 145 |
+
"""
|
| 146 |
+
Issue the warning :param:`message` for the definition of the given :param:`method`
|
| 147 |
+
|
| 148 |
+
this helps to log warnings for functions defined prior to finding an issue with them
|
| 149 |
+
(like hook wrappers being marked in a legacy mechanism)
|
| 150 |
+
"""
|
| 151 |
+
lineno = method.__code__.co_firstlineno
|
| 152 |
+
filename = inspect.getfile(method)
|
| 153 |
+
module = method.__module__
|
| 154 |
+
mod_globals = method.__globals__
|
| 155 |
+
try:
|
| 156 |
+
warnings.warn_explicit(
|
| 157 |
+
message,
|
| 158 |
+
type(message),
|
| 159 |
+
filename=filename,
|
| 160 |
+
module=module,
|
| 161 |
+
registry=mod_globals.setdefault("__warningregistry__", {}),
|
| 162 |
+
lineno=lineno,
|
| 163 |
+
)
|
| 164 |
+
except Warning as w:
|
| 165 |
+
# If warnings are errors (e.g. -Werror), location information gets lost, so we add it to the message.
|
| 166 |
+
raise type(w)(f"{w}\n at {filename}:{lineno}") from None
|
shared/package-files/9b/9b717166deba6db15d053b26793d1c34c4a756495065bafecb0657dd9461794f/blob
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .module import Module
|
| 2 |
+
from .. import functional as F
|
| 3 |
+
|
| 4 |
+
from torch import Tensor
|
| 5 |
+
|
| 6 |
+
__all__ = ['ChannelShuffle']
|
| 7 |
+
|
| 8 |
+
class ChannelShuffle(Module):
|
| 9 |
+
r"""Divides and rearranges the channels in a tensor.
|
| 10 |
+
|
| 11 |
+
This operation divides the channels in a tensor of shape :math:`(*, C , H, W)`
|
| 12 |
+
into g groups and rearranges them as :math:`(*, \frac{C}{g}, g, H, W)`,
|
| 13 |
+
while keeping the original tensor shape.
|
| 14 |
+
|
| 15 |
+
Args:
|
| 16 |
+
groups (int): number of groups to divide channels in.
|
| 17 |
+
|
| 18 |
+
Examples::
|
| 19 |
+
|
| 20 |
+
>>> # xdoctest: +IGNORE_WANT("FIXME: incorrect want")
|
| 21 |
+
>>> channel_shuffle = nn.ChannelShuffle(2)
|
| 22 |
+
>>> input = torch.randn(1, 4, 2, 2)
|
| 23 |
+
>>> print(input)
|
| 24 |
+
[[[[1, 2],
|
| 25 |
+
[3, 4]],
|
| 26 |
+
[[5, 6],
|
| 27 |
+
[7, 8]],
|
| 28 |
+
[[9, 10],
|
| 29 |
+
[11, 12]],
|
| 30 |
+
[[13, 14],
|
| 31 |
+
[15, 16]],
|
| 32 |
+
]]
|
| 33 |
+
>>> output = channel_shuffle(input)
|
| 34 |
+
>>> print(output)
|
| 35 |
+
[[[[1, 2],
|
| 36 |
+
[3, 4]],
|
| 37 |
+
[[9, 10],
|
| 38 |
+
[11, 12]],
|
| 39 |
+
[[5, 6],
|
| 40 |
+
[7, 8]],
|
| 41 |
+
[[13, 14],
|
| 42 |
+
[15, 16]],
|
| 43 |
+
]]
|
| 44 |
+
"""
|
| 45 |
+
|
| 46 |
+
__constants__ = ['groups']
|
| 47 |
+
groups: int
|
| 48 |
+
|
| 49 |
+
def __init__(self, groups: int) -> None:
|
| 50 |
+
super().__init__()
|
| 51 |
+
self.groups = groups
|
| 52 |
+
|
| 53 |
+
def forward(self, input: Tensor) -> Tensor:
|
| 54 |
+
return F.channel_shuffle(input, self.groups)
|
| 55 |
+
|
| 56 |
+
def extra_repr(self) -> str:
|
| 57 |
+
return f'groups={self.groups}'
|
shared/package-files/9b/9b7207dba4c2ccb0e94bc72dbf324a2c0f31e35e2eaf98e55f7b1d4f8b01e26f/blob
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections.abc import Generator
|
| 2 |
+
from contextlib import contextmanager
|
| 3 |
+
import pathlib
|
| 4 |
+
import tempfile
|
| 5 |
+
|
| 6 |
+
import pytest
|
| 7 |
+
|
| 8 |
+
from pandas.io.pytables import HDFStore
|
| 9 |
+
|
| 10 |
+
tables = pytest.importorskip("tables")
|
| 11 |
+
# set these parameters so we don't have file sharing
|
| 12 |
+
tables.parameters.MAX_NUMEXPR_THREADS = 1
|
| 13 |
+
tables.parameters.MAX_BLOSC_THREADS = 1
|
| 14 |
+
tables.parameters.MAX_THREADS = 1
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def safe_close(store):
|
| 18 |
+
try:
|
| 19 |
+
if store is not None:
|
| 20 |
+
store.close()
|
| 21 |
+
except OSError:
|
| 22 |
+
pass
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
# contextmanager to ensure the file cleanup
|
| 26 |
+
@contextmanager
|
| 27 |
+
def ensure_clean_store(
|
| 28 |
+
path, mode="a", complevel=None, complib=None, fletcher32=False
|
| 29 |
+
) -> Generator[HDFStore, None, None]:
|
| 30 |
+
with tempfile.TemporaryDirectory() as tmpdirname:
|
| 31 |
+
tmp_path = pathlib.Path(tmpdirname, path)
|
| 32 |
+
with HDFStore(
|
| 33 |
+
tmp_path,
|
| 34 |
+
mode=mode,
|
| 35 |
+
complevel=complevel,
|
| 36 |
+
complib=complib,
|
| 37 |
+
fletcher32=fletcher32,
|
| 38 |
+
) as store:
|
| 39 |
+
yield store
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def _maybe_remove(store, key):
|
| 43 |
+
"""
|
| 44 |
+
For tests using tables, try removing the table to be sure there is
|
| 45 |
+
no content from previous tests using the same table name.
|
| 46 |
+
"""
|
| 47 |
+
try:
|
| 48 |
+
store.remove(key)
|
| 49 |
+
except (ValueError, KeyError):
|
| 50 |
+
pass
|